diff --git a/Point_set_shape_detection_3/test/Point_set_shape_detection_3/generators.h b/Point_set_shape_detection_3/test/Point_set_shape_detection_3/generators.h index bdf0678d1fb..038948d7399 100644 --- a/Point_set_shape_detection_3/test/Point_set_shape_detection_3/generators.h +++ b/Point_set_shape_detection_3/test/Point_set_shape_detection_3/generators.h @@ -15,53 +15,56 @@ fl_t random_float(fl_t min, fl_t max) { } template -typename CGAL::Vector_3 random_normal() { +CGAL::Vector_3 random_normal() { + typedef typename K::FT FT; CGAL::Vector_3 n; do { - n = CGAL::Vector_3(random_float((K::FT) -1.0, (K::FT) 1.0), - random_float((K::FT) -1.0, (K::FT) 1.0), - random_float((K::FT) -1.0, (K::FT) 1.0)); - } while (n.squared_length() < (K::FT) 0.001); + n = CGAL::Vector_3(random_float((FT) -1.0, (FT) 1.0), + random_float((FT) -1.0, (FT) 1.0), + random_float((FT) -1.0, (FT) 1.0)); + } while (n.squared_length() < (FT) 0.001); - n = n * (K::FT) 1.0 / (CGAL::sqrt(n.squared_length())); + n = n * (FT) 1.0 / (CGAL::sqrt(n.squared_length())); return n; } template -typename CGAL::Point_3 random_point_in(const CGAL::Bbox_3& bbox) { +CGAL::Point_3 random_point_in(const CGAL::Bbox_3& bbox) { typedef typename K::FT FT; - FT x = random_float((K::FT) bbox.xmin(), (K::FT) bbox.xmax()); - FT y = random_float((K::FT) bbox.ymin(), (K::FT) bbox.ymax()); - FT z = random_float((K::FT) bbox.zmin(), (K::FT) bbox.zmax()); + FT x = random_float((FT) bbox.xmin(), (FT) bbox.xmax()); + FT y = random_float((FT) bbox.ymin(), (FT) bbox.ymax()); + FT z = random_float((FT) bbox.zmin(), (FT) bbox.zmax()); - return typename CGAL::Point_3(x, y, z); + return CGAL::Point_3(x, y, z); } template -typename CGAL::Point_with_normal_3 random_pwn_in(const CGAL::Bbox_3 &bbox) { - return typename CGAL::Point_with_normal_3(random_point_in(bbox), +CGAL::Point_with_normal_3 random_pwn_in(const CGAL::Bbox_3 &bbox) { + return CGAL::Point_with_normal_3(random_point_in(bbox), random_normal()); } template -typename CGAL::Vector_3 normalize(typename CGAL::Vector_3 const& v) { - typename K::FT l = CGAL::sqrt(v.squared_length()); - if (l < (K::FT) 0.00001) - return typename CGAL::Vector_3((K::FT) 0, (K::FT) 0, (K::FT) 0); +CGAL::Vector_3 normalize(CGAL::Vector_3 const& v) { + typedef typename K::FT FT; + FT l = CGAL::sqrt(v.squared_length()); + if (l < (FT) 0.00001) + return CGAL::Vector_3((FT) 0, (FT) 0, (FT) 0); else return v * l; } template void sample_sphere(const std::size_t num_points, - typename CGAL::Point_3 const& center, typename K::FT radius, + CGAL::Point_3 const& center, typename K::FT radius, OutputIterator points) { + typedef typename K::FT FT; for (std::size_t i = 0;i < num_points;++i) { - CGAL::Vector_3 direction(random_float((K::FT) -1, (K::FT) 1), - random_float((K::FT) -1, (K::FT) 1), - random_float((K::FT) -1,(K::FT) 1)); - direction = direction * ((K::FT) 1.0 / CGAL::sqrt(direction.squared_length())); + CGAL::Vector_3 direction(random_float((FT) -1, (FT) 1), + random_float((FT) -1, (FT) 1), + random_float((FT) -1,(FT) 1)); + direction = direction * ((FT) 1.0 / CGAL::sqrt(direction.squared_length())); CGAL::Point_3 p = center + direction * radius; @@ -72,10 +75,11 @@ void sample_sphere(const std::size_t num_points, template void sample_random_sphere_in_box(const std::size_t num_points, - const CGAL::Bbox_3 &bbox, typename CGAL::Point_3 ¢er, + const CGAL::Bbox_3 &bbox, CGAL::Point_3 ¢er, typename K::FT &radius, OutputIterator points) { + typedef typename K::FT FT; // Generate random parameters - radius = random_float((K::FT) 0.01, (K::FT) 5); + radius = random_float((FT) 0.01, (FT) 5); center = random_point_in(bbox); sample_sphere(num_points, center, radius, points); @@ -83,23 +87,24 @@ void sample_random_sphere_in_box(const std::size_t num_points, template void sample_cylinder(const std::size_t num_points, - const typename CGAL::Point_3 ¢er, - const typename CGAL::Vector_3 &axis, const typename K::FT radius, - const typename K::FT length, OutputIterator points) { + const CGAL::Point_3 ¢er, + const CGAL::Vector_3 &axis, typename K::FT radius, + typename K::FT length, OutputIterator points) { + typedef typename K::FT FT; // Sample shape for (size_t i = 0 ; i < num_points ; ++i) { CGAL::Vector_3 normal( - random_float((K::FT) -1, (K::FT) 1), - random_float((K::FT) -1, (K::FT) 1), - random_float((K::FT) -1, (K::FT) 1)); + random_float((FT) -1, (FT) 1), + random_float((FT) -1, (FT) 1), + random_float((FT) -1, (FT) 1)); normal = normal - ((normal * axis) * axis); - if (normal.squared_length() < (K::FT)0.0001) { + if (normal.squared_length() < (FT)0.0001) { i--; continue; } - normal = normal * ((K::FT)1.0 / CGAL::sqrt(normal.squared_length())); + normal = normal * ((FT)1.0 / CGAL::sqrt(normal.squared_length())); - typename K::FT l = random_float(-length, length); + FT l = random_float(-length, length); CGAL::Point_3 p = center + axis * l + radius * normal; *points = CGAL::Point_with_normal_3(p, normal); @@ -109,13 +114,14 @@ void sample_cylinder(const std::size_t num_points, template void sample_random_cylinder(const std::size_t num_points, - typename CGAL::Point_3 ¢er, - typename CGAL::Vector_3 &axis, typename K::FT &radius, + CGAL::Point_3 ¢er, + CGAL::Vector_3 &axis, typename K::FT &radius, OutputIterator points) { + typedef typename K::FT FT; // Generate random parameters axis = random_normal(); - radius = random_float((K::FT) 0.5, (K::FT) 5); - typename K::FT length = random_float((K::FT) 0.2, (K::FT) 10); + radius = random_float((FT) 0.5, (FT) 5); + FT length = random_float((FT) 0.2, (FT) 10); // Find random center point placed on the plane through // the origin with 'axis' as normal. @@ -124,18 +130,18 @@ void sample_random_cylinder(const std::size_t num_points, v = v * 1.0 / CGAL::sqrt(v.squared_length()); u = CGAL::cross_product(v, axis); - center = CGAL::ORIGIN + random_float((K::FT) -5, (K::FT) 5) * u + random_float((K::FT) -5, (K::FT) 5) * v; + center = CGAL::ORIGIN + random_float((FT) -5, (FT) 5) * u + random_float((FT) -5, (FT) 5) * v; sample_cylinder(num_points, center, axis, radius, length, points); } template void sample_cone(const std::size_t num_points, - typename CGAL::Point_3 const& apex, - typename CGAL::Vector_3 const& axis, typename K::FT angle, + CGAL::Point_3 const& apex, + CGAL::Vector_3 const& axis, typename K::FT angle, typename K::FT s, typename K::FT e, OutputIterator points) { typedef typename K::FT FT; - typedef typename CGAL::Vector_3 Vector; + typedef CGAL::Vector_3 Vector; FT radiusGrow = std::tan(angle); FT cosAng = std::cos(angle); @@ -143,26 +149,26 @@ void sample_cone(const std::size_t num_points, for (size_t i = 0 ; i < num_points ; ++i) { - Vector normal(random_float((K::FT) -1, (K::FT) 1), - random_float((K::FT)-1, (K::FT) 1), - random_float((K::FT)-1, (K::FT) 1)); + Vector normal(random_float((FT) -1, (FT) 1), + random_float((FT)-1, (FT) 1), + random_float((FT)-1, (FT) 1)); normal = normal - ((normal * axis) * axis); - if (normal.squared_length() < (K::FT) 0.0001) { + if (normal.squared_length() < (FT) 0.0001) { i--; continue; } - normal = normal * ((K::FT) 1.0 / CGAL::sqrt(normal.squared_length())); + normal = normal * ((FT) 1.0 / CGAL::sqrt(normal.squared_length())); FT l = random_float(s, e); CGAL::Point_3 p = apex + axis * l + (l * radiusGrow) * normal; // axis is pointing down from apex - normal = normal * (K::FT) 1.0 / (CGAL::sqrt(normal.squared_length())); + normal = normal * (FT) 1.0 / (CGAL::sqrt(normal.squared_length())); // normal is pointing from axis to surface point normal = normal * cosAng - axis * sinAng; l = CGAL::sqrt(normal.squared_length()); - if ((K::FT) 0.95 > l || l > (K::FT) 1.05) + if ((FT) 0.95 > l || l > (FT) 1.05) std::cout << "normal not normalized" << std::endl; *points = CGAL::Point_with_normal_3(p, normal); @@ -172,22 +178,24 @@ void sample_cone(const std::size_t num_points, template void sample_random_cone(const std::size_t num_points, - typename CGAL::Point_3 &apex, typename CGAL::Vector_3 &axis, + CGAL::Point_3 &apex, CGAL::Vector_3 &axis, typename K::FT &angle, OutputIterator points) { + typedef typename K::FT FT; // Generate random parameters apex = random_point_in(CGAL::Bbox_3(-5, -5, -5, 5, 5, 5)); axis = random_normal(); - angle = random_float((K::FT) 0.2, (K::FT) 1.4); - K::FT start = random_float((K::FT) 0, (K::FT) 2.5); - K::FT end = start + random_float((K::FT) 0.5, (K::FT) 2.5); + angle = random_float((FT) 0.2, (FT) 1.4); + FT start = random_float((FT) 0, (FT) 2.5); + FT end = start + random_float((FT) 0.5, (FT) 2.5); sample_cone(num_points, apex, axis, angle, start, end, points); } template void sample_random_parallelogram_in_box(const std::size_t num_points, - const CGAL::Bbox_3 &bbox, typename CGAL::Vector_3 &normal, + const CGAL::Bbox_3 &bbox, CGAL::Vector_3 &normal, typename K::FT &dist, OutputIterator points) { + typedef typename K::FT FT; // Generate random plane from 3 non collinear points. CGAL::Vector_3 u, v; CGAL::Point_3 p[3]; @@ -199,8 +207,8 @@ void sample_random_parallelogram_in_box(const std::size_t num_points, CGAL::Vector_3 a = p[1] - p[0]; CGAL::Vector_3 b = p[2] - p[0]; - if (a.squared_length() < (K::FT) 4.0 || b.squared_length() < (K::FT) 4.0) { - normal = CGAL::Vector_3((K::FT) 0, (K::FT) 0, (K::FT) 0); + if (a.squared_length() < (FT) 4.0 || b.squared_length() < (FT) 4.0) { + normal = CGAL::Vector_3((FT) 0, (FT) 0, (FT) 0); continue; } @@ -209,9 +217,9 @@ void sample_random_parallelogram_in_box(const std::size_t num_points, normal = CGAL::cross_product(a, b); // repeat if angle between a and b is small - } while (normal.squared_length() < (K::FT) 0.2); + } while (normal.squared_length() < (FT) 0.2); - normal = normal * (K::FT) 1.0 / CGAL::sqrt(normal.squared_length()); + normal = normal * (FT) 1.0 / CGAL::sqrt(normal.squared_length()); dist = -((p[0] - CGAL::ORIGIN) * normal); // sample @@ -220,8 +228,8 @@ void sample_random_parallelogram_in_box(const std::size_t num_points, v = p[2] - p[0]; for (std::size_t i = 0;i < num_points; ++i) { - K::FT s = random_float((K::FT) 0, (K::FT) 1); - K::FT t = random_float((K::FT) 0, (K::FT) 1); + FT s = random_float((FT) 0, (FT) 1); + FT t = random_float((FT) 0, (FT) 1); *points = CGAL::Point_with_normal_3(p[0] + s * u + t * v, normal); ++points; @@ -230,18 +238,19 @@ void sample_random_parallelogram_in_box(const std::size_t num_points, template void generate_points_on_torus(const std::size_t num_points, - typename const CGAL::Point_3 ¢er, - typename const CGAL::Vector_3 &axis, - typename const K::FT major_radius, - typename const K::FT minor_radius, + const CGAL::Point_3 ¢er, + const CGAL::Vector_3 &axis, + typename K::FT major_radius, + typename K::FT minor_radius, OutputIterator points) { + typedef typename K::FT FT; size_t i = 0; // calculate basis CGAL::Vector_3 b1, b2; - b1 = CGAL::cross_product(axis, CGAL::Vector_3((K::FT) 0, (K::FT) 0, (K::FT) 1)); - if (b1.squared_length() < (K::FT) 0.1) - b1 = CGAL::cross_product(axis, CGAL::Vector_3((K::FT) 0, (K::FT) 1, (K::FT) 0)); + b1 = CGAL::cross_product(axis, CGAL::Vector_3((FT) 0, (FT) 0, (FT) 1)); + if (b1.squared_length() < (FT) 0.1) + b1 = CGAL::cross_product(axis, CGAL::Vector_3((FT) 0, (FT) 1, (FT) 0)); b1 = b1 / CGAL::sqrt(b1.squared_length()); b2 = CGAL::cross_product(axis, b1); @@ -249,8 +258,8 @@ void generate_points_on_torus(const std::size_t num_points, for (size_t i = 0 ; i < num_points ; ++i) { - K::FT tau = random_float((K::FT) 0, (K::FT) (2 * 3.141592656)); - K::FT phi = random_float((K::FT) 0, (K::FT) (2 * 3.141592656)); + FT tau = random_float((FT) 0, (FT) (2 * 3.141592656)); + FT phi = random_float((FT) 0, (FT) (2 * 3.141592656)); CGAL::Vector_3 normal = sin(tau) * b1 + cos(tau) * b2; normal = normal / CGAL::sqrt(normal.squared_length()); @@ -264,21 +273,24 @@ void generate_points_on_torus(const std::size_t num_points, } template -void sample_random_torus(const std::size_t num_points, typename CGAL::Point_3 ¢er, - typename CGAL::Vector_3 &axis, typename K::FT &major_radius, +void sample_random_torus(const std::size_t num_points, CGAL::Point_3 ¢er, + CGAL::Vector_3 &axis, typename K::FT &major_radius, typename K::FT &minor_radius, OutputIterator points) { + typedef typename K::FT FT; // Generate random parameters center = random_point_in(CGAL::Bbox_3(-5, -5, -5, 5, 5, 5)); axis = random_normal(); - major_radius = random_float((K::FT) 1.0, (K::FT) 5.0); - minor_radius = random_float((K::FT) 0.1, (K::FT) 1.0); + major_radius = random_float((FT) 1.0, (FT) 5.0); + minor_radius = random_float((FT) 0.1, (FT) 1.0); generate_points_on_torus(num_points, center, axis, major_radius, minor_radius, points); } template -void filter_by_distance(typename const CGAL::Plane_3 &plane, typename K::FT dist, std::vector &points) { - K::FT d2 = dist * dist; +void filter_by_distance( + const CGAL::Plane_3 &plane, typename K::FT dist, + std::vector

&points) { + typename K::FT d2 = dist * dist; std::vector

::iterator it = points.begin(); while (it != points.end()) { diff --git a/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_cone_parameters.cpp b/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_cone_parameters.cpp index 506185ebb4e..ba5fe2f1c27 100644 --- a/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_cone_parameters.cpp +++ b/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_cone_parameters.cpp @@ -13,12 +13,13 @@ bool test_cone_parameters() { const int NB_ROUNDS = 10; const int NB_POINTS = 1000; - typedef typename CGAL::Point_with_normal_3 Pwn; - typedef typename CGAL::Point_3 Point; - typedef typename CGAL::Vector_3 Vector; + typedef typename K::FT FT; + typedef CGAL::Point_with_normal_3 Pwn; + typedef CGAL::Point_3 Point; + typedef CGAL::Vector_3 Vector; typedef std::vector Pwn_vector; - typedef typename CGAL::Identity_property_map Point_map; - typedef typename CGAL::Normal_of_point_with_normal_pmap Normal_map; + typedef CGAL::Identity_property_map Point_map; + typedef CGAL::Normal_of_point_with_normal_pmap Normal_map; typedef CGAL::Shape_detection_3::Efficient_RANSAC_traits< K, Pwn_vector, Point_map, Normal_map> Traits; @@ -34,7 +35,7 @@ bool test_cone_parameters() { // generate random points on random cone Vector axis; Point apex; - K::FT angle = 0; + FT angle = 0; CGAL::Bbox_3 bbox(-10, -10, -10, 10, 10, 10); sample_random_cone(NB_POINTS, apex, axis, angle, @@ -67,7 +68,7 @@ bool test_cone_parameters() { typename Efficient_ransac::Shape_range shapes = ransac.shapes(); - // check: unique shape detected + // check: unique shape detected if (shapes.size() != 1) continue; @@ -78,12 +79,12 @@ bool test_cone_parameters() { continue; // Check radius and alignment with axis. - if (abs(angle - cone->angle()) > (K::FT) 0.02 || abs(abs(axis * cone->axis()) - (K::FT) 1.0) > (K::FT) 0.02) + if (abs(angle - cone->angle()) > (FT) 0.02 || abs(abs(axis * cone->axis()) - (FT) 1.0) > (FT) 0.02) continue; // Check apex. Point pos = cone->apex(); - if ((pos - apex).squared_length() > (K::FT) 0.0004) + if ((pos - apex).squared_length() > (FT) 0.0004) continue; success++; diff --git a/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_cylinders_parameters.cpp b/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_cylinders_parameters.cpp index 30fd0ac8b92..633457982a2 100644 --- a/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_cylinders_parameters.cpp +++ b/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_cylinders_parameters.cpp @@ -12,13 +12,13 @@ template bool test_cylinder_parameters() { const int NB_ROUNDS = 10; const int NB_POINTS = 1000; - - typedef typename CGAL::Point_with_normal_3 Pwn; - typedef typename CGAL::Point_3 Point; - typedef typename CGAL::Vector_3 Vector; + + typedef CGAL::Point_with_normal_3 Pwn; + typedef CGAL::Point_3 Point; + typedef CGAL::Vector_3 Vector; typedef std::vector Pwn_vector; - typedef typename CGAL::Identity_property_map Point_map; - typedef typename CGAL::Normal_of_point_with_normal_pmap Normal_map; + typedef CGAL::Identity_property_map Point_map; + typedef CGAL::Normal_of_point_with_normal_pmap Normal_map; typedef CGAL::Shape_detection_3::Efficient_RANSAC_traits< K, Pwn_vector, Point_map, Normal_map> Traits; diff --git a/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_plane_connected_component.cpp b/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_plane_connected_component.cpp index 028d093fd9a..0cdf34fab2d 100644 --- a/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_plane_connected_component.cpp +++ b/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_plane_connected_component.cpp @@ -11,13 +11,14 @@ template bool test_plane_connected_component() { const int NB_ROUNDS = 10; - - typedef typename CGAL::Point_with_normal_3 Pwn; - typedef typename CGAL::Point_3 Point; - typedef typename CGAL::Vector_3 Vector; + + typedef typename K::FT FT; + typedef CGAL::Point_with_normal_3 Pwn; + typedef CGAL::Point_3 Point; + typedef CGAL::Vector_3 Vector; typedef std::vector Pwn_vector; - typedef typename CGAL::Identity_property_map Point_map; - typedef typename CGAL::Normal_of_point_with_normal_pmap Normal_map; + typedef CGAL::Identity_property_map Point_map; + typedef CGAL::Normal_of_point_with_normal_pmap Normal_map; typedef typename CGAL::Shape_detection_3::Efficient_RANSAC_traits Traits; @@ -37,16 +38,16 @@ bool test_plane_connected_component() { // Sample 4 rectangles with 0.05 spacing between points // and 0.2 spacing between rectangles. - Vector offset[] = {Vector((K::FT) 0, (K::FT) 0, (K::FT) 0), - Vector((K::FT) 1.2, (K::FT) 0, (K::FT) 0), - Vector((K::FT) 0, (K::FT) 1.2, (K::FT) 0), - Vector((K::FT) 1.2, (K::FT) 1.2, (K::FT) 0)}; + Vector offset[] = {Vector((FT) 0, (FT) 0, (FT) 0), + Vector((FT) 1.2, (FT) 0, (FT) 0), + Vector((FT) 0, (FT) 1.2, (FT) 0), + Vector((FT) 1.2, (FT) 1.2, (FT) 0)}; for (std::size_t j = 0;j<4;j++) { for (std::size_t x = 0;x<=20;x++) for (std::size_t y = 0;y<=20;y++) - points.push_back(Pwn(Point(K::FT(x * 0.05), K::FT(y * 0.05), (K::FT) 0) + offset[j], - Vector((K::FT) 0, (K::FT) 0, (K::FT) 1))); + points.push_back(Pwn(Point(FT(x * 0.05), FT(y * 0.05), (FT) 0) + offset[j], + Vector((FT) 0, (FT) 0, (FT) 1))); } Efficient_ransac ransac; diff --git a/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_plane_parameters.cpp b/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_plane_parameters.cpp index 0610363b5fc..6789ed091e4 100644 --- a/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_plane_parameters.cpp +++ b/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_plane_parameters.cpp @@ -32,7 +32,7 @@ bool test_plane_parameters() { for (std::size_t i = 0;i bool test_sphere_parameters() { const int NB_ROUNDS = 10; const int NB_POINTS = 1000; - - typedef typename CGAL::Point_with_normal_3 Pwn; - typedef typename CGAL::Point_3 Point; - typedef typename CGAL::Vector_3 Vector; + + typedef typename K::FT FT; + typedef CGAL::Point_with_normal_3 Pwn; + typedef CGAL::Point_3 Point; + typedef CGAL::Vector_3 Vector; typedef std::vector Pwn_vector; - typedef typename CGAL::Identity_property_map Point_map; - typedef typename CGAL::Normal_of_point_with_normal_pmap Normal_map; + typedef CGAL::Identity_property_map Point_map; + typedef CGAL::Normal_of_point_with_normal_pmap Normal_map; typedef CGAL::Shape_detection_3::Efficient_RANSAC_traits< K, Pwn_vector, Point_map, Normal_map> Traits; @@ -32,7 +33,7 @@ bool test_sphere_parameters() { Pwn_vector points; // generate random points on random sphere - typename K::FT radius = 0; + FT radius = 0; Point center; CGAL::Bbox_3 bbox(-10, -10, -10, 10, 10, 10); @@ -77,12 +78,12 @@ bool test_sphere_parameters() { continue; // Check radius and alignment with axis. - if (abs(radius - sphere->radius()) > (K::FT) 0.02) + if (abs(radius - sphere->radius()) > (FT) 0.02) continue; // Check center. Point pos = sphere->center(); - if ((pos - center).squared_length() > (K::FT) 0.0004) + if ((pos - center).squared_length() > (FT) 0.0004) continue; success++; diff --git a/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_torus_parameters.cpp b/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_torus_parameters.cpp index 1b119aae2f0..da3c23391ad 100644 --- a/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_torus_parameters.cpp +++ b/Point_set_shape_detection_3/test/Point_set_shape_detection_3/test_torus_parameters.cpp @@ -12,13 +12,14 @@ template bool test_torus_parameters() { const int NB_ROUNDS = 10; const int NB_POINTS = 1000; - - typedef typename CGAL::Point_with_normal_3 Pwn; - typedef typename CGAL::Point_3 Point; - typedef typename CGAL::Vector_3 Vector; + + typedef typename K::FT FT; + typedef CGAL::Point_with_normal_3 Pwn; + typedef CGAL::Point_3 Point; + typedef CGAL::Vector_3 Vector; typedef std::vector Pwn_vector; - typedef typename CGAL::Identity_property_map Point_map; - typedef typename CGAL::Normal_of_point_with_normal_pmap Normal_map; + typedef CGAL::Identity_property_map Point_map; + typedef CGAL::Normal_of_point_with_normal_pmap Normal_map; typedef CGAL::Shape_detection_3::Efficient_RANSAC_traits< K, Pwn_vector, Point_map, Normal_map> Traits; @@ -32,8 +33,8 @@ bool test_torus_parameters() { Pwn_vector points; // generate random points on random cylinder - K::FT minor_radius = (K::FT) 0; - K::FT major_radius = (K::FT) 0; + FT minor_radius = (FT) 0; + FT major_radius = (FT) 0; Vector axis; Point center; CGAL::Bbox_3 bbox(-10, -10, -10, 10, 10, 10); @@ -83,13 +84,13 @@ bool test_torus_parameters() { Point pos = torus->center(); // Check radii and alignment with axis. - if (abs(major_radius - torus->major_radius()) > (K::FT) 0.02 - || abs(minor_radius - torus->minor_radius()) > (K::FT) 0.02 - || abs(abs(axis * torus->axis()) - 1.0) > (K::FT) 0.02) + if (abs(major_radius - torus->major_radius()) > (FT) 0.02 + || abs(minor_radius - torus->minor_radius()) > (FT) 0.02 + || abs(abs(axis * torus->axis()) - 1.0) > (FT) 0.02) continue; // Check center. - if ((pos - center).squared_length() > (K::FT) 0.0004) + if ((pos - center).squared_length() > (FT) 0.0004) continue; success++;