diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/K_neighbor_query.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/K_neighbor_query.h index 0b72f5115a4..54beee32af0 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/K_neighbor_query.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/K_neighbor_query.h @@ -134,10 +134,10 @@ namespace Point_set { template K_neighbor_query( const InputRange& input_range, + const Point_map point_map, const CGAL_NP_CLASS& np = parameters::default_values()) : m_input_range(input_range), - m_point_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::point_map), PointMap())), + m_point_map(point_map), m_index_to_point_map(m_input_range, m_point_map), m_distance(m_index_to_point_map), m_tree( diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_circle_fit_region.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_circle_fit_region.h index 7500f19665f..339cca9cd1a 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_circle_fit_region.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_circle_fit_region.h @@ -162,12 +162,12 @@ namespace Point_set { template Least_squares_circle_fit_region( const InputRange& input_range, + const Point_map point_map, + const Normal_map normal_map, const CGAL_NP_CLASS& np = parameters::default_values()) : m_input_range(input_range), - m_point_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::point_map), PointMap())), - m_normal_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::normal_map), NormalMap())), + m_point_map(point_map), + m_normal_map(normal_map), m_traits(parameters::choose_parameter(parameters::get_parameter( np, internal_np::geom_traits), GeomTraits())), m_sqrt(Get_sqrt::sqrt_object(m_traits)), diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_circle_fit_sorting.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_circle_fit_sorting.h index 2bc84eba645..0fc27825c05 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_circle_fit_sorting.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_circle_fit_sorting.h @@ -112,15 +112,16 @@ namespace Point_set { \pre `input_range.size() > 0` */ - template + template Least_squares_circle_fit_sorting( const InputRange& input_range, NeighborQuery& neighbor_query, + const Point_map point_map, + const Dummy, const CGAL_NP_CLASS& np = parameters::default_values()) : m_input_range(input_range), m_neighbor_query(neighbor_query), - m_point_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::point_map), PointMap())), + m_point_map(point_map), m_traits(parameters::choose_parameter(parameters::get_parameter( np, internal_np::geom_traits), GeomTraits())) { diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_cylinder_fit_region.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_cylinder_fit_region.h index d0d9f3cbf1c..b6e51ca0fb7 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_cylinder_fit_region.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_cylinder_fit_region.h @@ -162,12 +162,12 @@ namespace Point_set { template Least_squares_cylinder_fit_region( const InputRange& input_range, + const Point_map point_map, + const Normal_map normal_map, const CGAL_NP_CLASS& np = parameters::default_values()) : m_input_range(input_range), - m_point_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::point_map), PointMap())), - m_normal_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::normal_map), NormalMap())), + m_point_map(point_map), + m_normal_map(normal_map), m_traits(parameters::choose_parameter(parameters::get_parameter( np, internal_np::geom_traits), GeomTraits())), m_sqrt(Get_sqrt::sqrt_object(m_traits)), diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_cylinder_fit_sorting.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_cylinder_fit_sorting.h index 439b85accf3..381483f34e2 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_cylinder_fit_sorting.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_cylinder_fit_sorting.h @@ -127,13 +127,13 @@ namespace Point_set { Least_squares_cylinder_fit_sorting( const InputRange& input_range, NeighborQuery& neighbor_query, + const Point_map point_map, + const Normal_map normal_map, const CGAL_NP_CLASS& np = parameters::default_values()) : m_input_range(input_range), m_neighbor_query(neighbor_query), - m_point_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::point_map), PointMap())), - m_normal_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::normal_map), NormalMap())), + m_point_map(point_map), + m_normal_map(normal_map), m_traits(parameters::choose_parameter(parameters::get_parameter( np, internal_np::geom_traits), GeomTraits())) { diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_line_fit_region.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_line_fit_region.h index 05cbb9d8420..44535aee23c 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_line_fit_region.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_line_fit_region.h @@ -148,12 +148,12 @@ namespace Point_set { template Least_squares_line_fit_region( const InputRange& input_range, + const Point_map point_map, + const Normal_map normal_map, const CGAL_NP_CLASS& np = parameters::default_values()) : m_input_range(input_range), - m_point_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::point_map), PointMap())), - m_normal_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::normal_map), NormalMap())), + m_point_map(point_map), + m_normal_map(normal_map), m_traits(parameters::choose_parameter(parameters::get_parameter( np, internal_np::geom_traits), GeomTraits())), m_squared_length_2(m_traits.compute_squared_length_2_object()), diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_line_fit_sorting.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_line_fit_sorting.h index 0b8ea162493..d06cabd2d6e 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_line_fit_sorting.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_line_fit_sorting.h @@ -112,15 +112,16 @@ namespace Point_set { \pre `input_range.size() > 0` */ - template + template Least_squares_line_fit_sorting( const InputRange& input_range, NeighborQuery& neighbor_query, + const Point_map point_map, + const Dummy, const CGAL_NP_CLASS& np = parameters::default_values()) : m_input_range(input_range), m_neighbor_query(neighbor_query), - m_point_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::point_map), PointMap())), + m_point_map(point_map), m_traits(parameters::choose_parameter(parameters::get_parameter( np, internal_np::geom_traits), GeomTraits())) { diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_plane_fit_region.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_plane_fit_region.h index 7d055d8c5d3..4452c99c28f 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_plane_fit_region.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_plane_fit_region.h @@ -148,12 +148,12 @@ namespace Point_set { template Least_squares_plane_fit_region( const InputRange& input_range, + const Point_map point_map, + const Normal_map normal_map, const CGAL_NP_CLASS& np = parameters::default_values()) : m_input_range(input_range), - m_point_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::point_map), PointMap())), - m_normal_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::normal_map), NormalMap())), + m_point_map(point_map), + m_normal_map(normal_map), m_traits(parameters::choose_parameter(parameters::get_parameter( np, internal_np::geom_traits), GeomTraits())), m_squared_length_3(m_traits.compute_squared_length_3_object()), diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_plane_fit_sorting.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_plane_fit_sorting.h index 472e9a9433b..339aa538f7a 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_plane_fit_sorting.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_plane_fit_sorting.h @@ -112,15 +112,17 @@ namespace Point_set { \pre `input_range.size() > 0` */ - template + template Least_squares_plane_fit_sorting( const InputRange& input_range, NeighborQuery& neighbor_query, + const Point_map point_map, + const Dummy, const CGAL_NP_CLASS& np = parameters::default_values()) : m_input_range(input_range), m_neighbor_query(neighbor_query), - m_point_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::point_map), PointMap())), + m_point_map(point_map), m_traits(parameters::choose_parameter(parameters::get_parameter( np, internal_np::geom_traits), GeomTraits())) { diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_sphere_fit_region.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_sphere_fit_region.h index b2626570a7c..d2eb73f516d 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_sphere_fit_region.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_sphere_fit_region.h @@ -161,12 +161,12 @@ namespace Point_set { template Least_squares_sphere_fit_region( const InputRange& input_range, + const Point_map point_map, + const Normal_map normal_map, const CGAL_NP_CLASS& np = parameters::default_values()) : m_input_range(input_range), - m_point_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::point_map), PointMap())), - m_normal_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::normal_map), NormalMap())), + m_point_map(point_map), + m_normal_map(normal_map), m_traits(parameters::choose_parameter(parameters::get_parameter( np, internal_np::geom_traits), GeomTraits())), m_sqrt(Get_sqrt::sqrt_object(m_traits)), diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_sphere_fit_sorting.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_sphere_fit_sorting.h index 54a4eb1996a..f9cb2cfac5c 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_sphere_fit_sorting.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Least_squares_sphere_fit_sorting.h @@ -112,15 +112,17 @@ namespace Point_set { \pre `input_range.size() > 0` */ - template + template Least_squares_sphere_fit_sorting( const InputRange& input_range, NeighborQuery& neighbor_query, + const Point_map point_map, + const Dummy, const CGAL_NP_CLASS& np= parameters::default_values()) : m_input_range(input_range), m_neighbor_query(neighbor_query), - m_point_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::point_map), PointMap())), + m_point_map(point_map), m_traits(parameters::choose_parameter(parameters::get_parameter( np, internal_np::geom_traits), GeomTraits())) { diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Sphere_neighbor_query.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Sphere_neighbor_query.h index 542875bc0bb..a74280708e5 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Sphere_neighbor_query.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/Region_growing_on_point_set/Sphere_neighbor_query.h @@ -131,10 +131,10 @@ namespace Point_set { template Sphere_neighbor_query( const InputRange& input_range, + const Point_map point_map, const CGAL_NP_CLASS& np = parameters::default_values()) : m_input_range(input_range), - m_point_map(parameters::choose_parameter(parameters::get_parameter( - np, internal_np::point_map), PointMap())), + m_point_map(point_map), m_index_to_point_map(m_input_range, m_point_map), m_tree( boost::counting_iterator(0), diff --git a/Shape_detection/include/CGAL/Shape_detection/Region_growing/internal/free_functions.h b/Shape_detection/include/CGAL/Shape_detection/Region_growing/internal/free_functions.h index 797d418620f..ce2a440fc2d 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Region_growing/internal/free_functions.h +++ b/Shape_detection/include/CGAL/Shape_detection/Region_growing/internal/free_functions.h @@ -16,11 +16,6 @@ #include -#include -#include -#include -#include - #include #include #include @@ -28,7 +23,7 @@ #include // TODO: this is not using generic programming for FaceGraph and PointSet -// as a consequence, artifical depencencies on Surface_mesh, Polyhedron, +// as a consequence, artificial dependencies on Surface_mesh, Polyhedron, // HDS and Point_set_3 are done. namespace CGAL { @@ -37,161 +32,79 @@ namespace internal { template< typename InputRange, +typename PointMap, +typename NormalMap, typename OutputIterator, typename CGAL_NP_TEMPLATE_PARAMETERS> OutputIterator region_growing_lines( - const InputRange& points_with_normals, OutputIterator regions, const CGAL_NP_CLASS& np = parameters::default_values()) { + const InputRange& points, PointMap point_map, NormalMap normal_map, OutputIterator regions, const CGAL_NP_CLASS& np = parameters::default_values()) { - using Input_range = InputRange; - using Point_with_normal = typename Input_range::value_type; - using Point_type = typename Point_with_normal::first_type; - using Traits = typename Kernel_traits::Kernel; - using Point_map = CGAL::First_of_pair_property_map; - using Normal_map = CGAL::Second_of_pair_property_map; + using Kernel = typename Kernel_traits::value_type>::Kernel; + using Neighbor_query = Point_set::K_neighbor_query; + using Region_type = Point_set::Least_squares_line_fit_region; + using Sorting = Point_set::Least_squares_line_fit_sorting; + using Region_growing = Region_growing; - using Neighbor_query = Point_set::K_neighbor_query; - using Region_type = Point_set::Least_squares_line_fit_region; - using Sorting = Point_set::Least_squares_line_fit_sorting; - using Region_growing = Region_growing; - - Neighbor_query neighbor_query(points_with_normals, np); - Region_type region_type(points_with_normals, np); - Sorting sorting(points_with_normals, neighbor_query, np); + Neighbor_query neighbor_query(points, point_map, np); + Region_type region_type(points, point_map, normal_map, np); + Sorting sorting(points, neighbor_query, point_map, np); sorting.sort(); Region_growing region_growing( - points_with_normals, neighbor_query, region_type, sorting.seed_map()); + points, neighbor_query, region_type, sorting.seed_map()); region_growing.detect(regions); return regions; } template< typename InputRange, +typename PointMap, +typename NormalMap, typename OutputIterator, typename CGAL_NP_TEMPLATE_PARAMETERS> OutputIterator region_growing_planes( - const InputRange& points_with_normals, OutputIterator regions, const CGAL_NP_CLASS& np = parameters::default_values()) { + InputRange& points, PointMap point_map, NormalMap normal_map, OutputIterator regions, const CGAL_NP_CLASS& np = parameters::default_values()) { - using Input_range = InputRange; - using Point_with_normal = typename Input_range::value_type; - using Point_type = typename Point_with_normal::first_type; - using Traits = typename Kernel_traits::Kernel; - using Point_map = CGAL::First_of_pair_property_map; - using Normal_map = CGAL::Second_of_pair_property_map; + using Kernel = typename Kernel_traits::value_type>::Kernel; + using Neighbor_query = Point_set::K_neighbor_query; + using Region_type = Point_set::Least_squares_plane_fit_region; + using Sorting = Point_set::Least_squares_plane_fit_sorting; + using Region_growing = Region_growing; - using Neighbor_query = Point_set::K_neighbor_query; - using Region_type = Point_set::Least_squares_plane_fit_region; - using Sorting = Point_set::Least_squares_plane_fit_sorting; - using Region_growing = Region_growing; - - Neighbor_query neighbor_query(points_with_normals, np); - Region_type region_type(points_with_normals, np); - Sorting sorting(points_with_normals, neighbor_query, np); + Neighbor_query neighbor_query(points, point_map, np); + Region_type region_type(points, point_map, normal_map, np); + Sorting sorting(points, neighbor_query, point_map, np); sorting.sort(); Region_growing region_growing( - points_with_normals, neighbor_query, region_type, sorting.seed_map()); + points, neighbor_query, region_type, sorting.seed_map()); region_growing.detect(regions); return regions; } template< -typename PointType, -typename VectorType, -typename OutputIterator, -typename CGAL_NP_TEMPLATE_PARAMETERS_NO_DEFAULT> -OutputIterator region_growing_planes( - const CGAL::Point_set_3& point_set, OutputIterator regions, const CGAL_NP_CLASS& np) { - - using Point_type = PointType; - using Vector_type = VectorType; - using Traits = typename Kernel_traits::Kernel; - using Point_set_3 = CGAL::Point_set_3; - using Point_map = typename Point_set_3::Point_map; - using Normal_map = typename Point_set_3::Vector_map; - - using Neighbor_query = Point_set::K_neighbor_query; - using Region_type = Point_set::Least_squares_plane_fit_region; - using Sorting = Point_set::Least_squares_plane_fit_sorting; - using Region_growing = Region_growing; - - CGAL_precondition(point_set.has_normal_map()); - Neighbor_query neighbor_query(point_set, np); - Region_type region_type(point_set, np); - Sorting sorting(point_set, neighbor_query, np); - sorting.sort(); - - Region_growing region_growing( - point_set, neighbor_query, region_type, sorting.seed_map()); - region_growing.detect(regions); - return regions; -} - -template< -typename PointType, -typename VectorType, -typename OutputIterator> -OutputIterator region_growing_planes( - const CGAL::Point_set_3& point_set, OutputIterator regions) { - - return region_growing_planes( - point_set, regions, CGAL::parameters:: - point_map(point_set.point_map()). - normal_map(point_set.normal_map())); -} - -template< -typename GeomTraits, +typename PolygonMesh, typename OutputIterator, typename CGAL_NP_TEMPLATE_PARAMETERS> -OutputIterator region_growing_planes( - const CGAL::Polyhedron_3& polyhedron, - OutputIterator regions, const CGAL_NP_CLASS& np = parameters::default_values()) { +OutputIterator region_growing_planes_polygon_mesh( + const PolygonMesh& polygon_mesh, OutputIterator regions, const CGAL_NP_CLASS& np = parameters::default_values()) { - using Traits = GeomTraits; - using Polyhedron = CGAL::Polyhedron_3; - using Face_range = typename CGAL::Iterator_range::face_iterator>; - using Neighbor_query = Polygon_mesh::One_ring_neighbor_query; - using Region_type = Polygon_mesh::Least_squares_plane_fit_region; - using Sorting = Polygon_mesh::Least_squares_plane_fit_sorting; + using Kernel = typename Kernel_traits::Kernel; + using Face_iterator = typename boost::graph_traits::face_iterator; + using Face_range = Iterator_range; + + using Neighbor_query = Polygon_mesh::One_ring_neighbor_query; + using Region_type = Polygon_mesh::Least_squares_plane_fit_region; + using Sorting = Polygon_mesh::Least_squares_plane_fit_sorting; using Region_growing = Region_growing; - const Face_range face_range = faces(polyhedron); - Neighbor_query neighbor_query(polyhedron); - Region_type region_type(polyhedron, np); - Sorting sorting(polyhedron, neighbor_query, np); + Neighbor_query neighbor_query(polygon_mesh); + Region_type region_type(polygon_mesh, np); + Sorting sorting(polygon_mesh, neighbor_query, np); sorting.sort(); Region_growing region_growing( - face_range, neighbor_query, region_type, sorting.seed_map()); - region_growing.detect(regions); - return regions; -} - -template< -typename PointType, -typename OutputIterator, -typename CGAL_NP_TEMPLATE_PARAMETERS> -OutputIterator region_growing_planes( - const CGAL::Surface_mesh& surface_mesh, OutputIterator regions, const CGAL_NP_CLASS& np = parameters::default_values()) { - - using Point_type = PointType; - using Traits = typename Kernel_traits::Kernel; - using Surface_mesh = CGAL::Surface_mesh; - using Face_range = typename Surface_mesh::Face_range; - using Neighbor_query = Polygon_mesh::One_ring_neighbor_query; - using Region_type = Polygon_mesh::Least_squares_plane_fit_region; - using Sorting = Polygon_mesh::Least_squares_plane_fit_sorting; - using Region_growing = Region_growing; - - const Face_range face_range = faces(surface_mesh); - Neighbor_query neighbor_query(surface_mesh); - Region_type region_type(surface_mesh, np); - Sorting sorting(surface_mesh, neighbor_query, np); - sorting.sort(); - - Region_growing region_growing( - face_range, neighbor_query, region_type, sorting.seed_map()); + faces(polygon_mesh), neighbor_query, region_type, sorting.seed_map()); region_growing.detect(regions); return regions; } @@ -203,15 +116,14 @@ typename CGAL_NP_TEMPLATE_PARAMETERS> OutputIterator region_growing_polylines( const InputRange& polyline, OutputIterator regions, const CGAL_NP_CLASS& np = parameters::default_values()) { - using Input_range = InputRange; - using Point_type = typename Input_range::value_type; - using Traits = typename Kernel_traits::Kernel; + using Point_type = typename InputRange::value_type; + using Kernel = typename Kernel_traits::Kernel; using Point_map = CGAL::Identity_property_map; - using Neighbor_query = Polyline::One_ring_neighbor_query; - using Region_type = Polyline::Least_squares_line_fit_region; - using Sorting = Polyline::Least_squares_line_fit_sorting; - using Region_growing = Region_growing; + using Neighbor_query = Polyline::One_ring_neighbor_query; + using Region_type = Polyline::Least_squares_line_fit_region; + using Sorting = Polyline::Least_squares_line_fit_sorting; + using Region_growing = Region_growing; Neighbor_query neighbor_query(polyline); Region_type region_type(polyline, np); diff --git a/Shape_detection/test/Shape_detection/test_region_growing_basic.cpp b/Shape_detection/test/Shape_detection/test_region_growing_basic.cpp index de47140ae76..226d065485d 100644 --- a/Shape_detection/test/Shape_detection/test_region_growing_basic.cpp +++ b/Shape_detection/test/Shape_detection/test_region_growing_basic.cpp @@ -45,8 +45,8 @@ int main(int argc, char *argv[]) { assert(input_range.size() == 3634); // Create parameter classes. - Neighbor_query neighbor_query(input_range); - Region_type region_type(input_range); + Neighbor_query neighbor_query(input_range, Point_map()); + Region_type region_type(input_range, Point_map(), Normal_map()); // Run region growing. Region_growing region_growing( diff --git a/Shape_detection/test/Shape_detection/test_region_growing_on_cube.cpp b/Shape_detection/test/Shape_detection/test_region_growing_on_cube.cpp index 42fabc4a152..527eb38be26 100644 --- a/Shape_detection/test/Shape_detection/test_region_growing_on_cube.cpp +++ b/Shape_detection/test/Shape_detection/test_region_growing_on_cube.cpp @@ -94,7 +94,7 @@ bool test_region_growing_on_cube(int argc, char *argv[]) { // Test free functions and stability. for (std::size_t k = 0; k < 3; ++k) { regions.clear(); - SD::internal::region_growing_planes( + SD::internal::region_growing_planes_polygon_mesh( polyhedron, std::back_inserter(regions), CGAL::parameters:: maximum_distance(distance_threshold). diff --git a/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_2.cpp b/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_2.cpp index cae861cbdd1..d9384c3348e 100644 --- a/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_2.cpp +++ b/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_2.cpp @@ -58,9 +58,12 @@ bool test_region_growing_on_point_set_2(int argc, char *argv[]) { // Create parameter classes. Neighbor_query neighbor_query( - input_range, CGAL::parameters::sphere_radius(sphere_radius)); + input_range, Point_map(), + CGAL::parameters::sphere_radius(sphere_radius)); Region_type region_type( input_range, + Point_map(), + Normal_map(), CGAL::parameters:: maximum_distance(distance_threshold). maximum_angle(angle_threshold). diff --git a/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_2_with_sorting.cpp b/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_2_with_sorting.cpp index b65e6fed294..ec50ed1fd9e 100644 --- a/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_2_with_sorting.cpp +++ b/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_2_with_sorting.cpp @@ -61,9 +61,9 @@ bool test(int argc, char** argv, const std::string name, const std::size_t minr, // Create parameter classes. Neighbor_query neighbor_query( - input_range, CGAL::parameters::k_neighbors(k)); + input_range, Point_map(), CGAL::parameters::k_neighbors(k)); Region_type region_type( - input_range, + input_range, Point_map(), Normal_map(), CGAL::parameters:: maximum_distance(max_distance). maximum_angle(max_angle). @@ -71,7 +71,7 @@ bool test(int argc, char** argv, const std::string name, const std::size_t minr, // Sort indices. Sorting sorting( - input_range, neighbor_query); + input_range, neighbor_query, Point_map(), Normal_map()); sorting.sort(); // Run region growing. @@ -89,7 +89,8 @@ bool test(int argc, char** argv, const std::string name, const std::size_t minr, for (std::size_t k = 0; k < 3; ++k) { regions.clear(); SD::internal::region_growing_lines( - input_range, std::back_inserter(regions), + input_range, Point_map(), Normal_map(), + std::back_inserter(regions), CGAL::parameters:: maximum_distance(max_distance). maximum_angle(max_angle). diff --git a/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_3.cpp b/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_3.cpp index 83f2f17796e..a3f6290f7ea 100644 --- a/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_3.cpp +++ b/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_3.cpp @@ -55,18 +55,18 @@ bool test_region_growing_on_point_set_3(int argc, char *argv[]) { // Create parameter classes. Neighbor_query neighbor_query( - input_range, CGAL::parameters:: - sphere_radius(sphere_radius). - point_map(input_range.point_map())); + input_range, + input_range.point_map(), + CGAL::parameters:: + sphere_radius(sphere_radius)); Region_type region_type( - input_range, + input_range, input_range.point_map(), + input_range.normal_map(), CGAL::parameters:: maximum_distance(distance_threshold). maximum_angle(angle_threshold). - minimum_region_size(min_region_size). - point_map(input_range.point_map()). - normal_map(input_range.normal_map())); + minimum_region_size(min_region_size)); // Run region growing. Region_growing region_growing( diff --git a/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_3_with_sorting.cpp b/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_3_with_sorting.cpp index 6d5d8890d51..93617fedc34 100644 --- a/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_3_with_sorting.cpp +++ b/Shape_detection/test/Shape_detection/test_region_growing_on_point_set_3_with_sorting.cpp @@ -65,16 +65,14 @@ bool test( // Create parameter classes. Neighbor_query neighbor_query( - input_range, CGAL::parameters:: - k_neighbors(k). - point_map(input_range.point_map())); + input_range, input_range.point_map(), CGAL::parameters:: + k_neighbors(k)); // Sort indices. Sorting sorting( input_range, neighbor_query, - CGAL::parameters:: - point_map(input_range.point_map()). - normal_map(input_range.normal_map())); + input_range.point_map(), + input_range.normal_map()); sorting.sort(); // Run region growing. @@ -97,13 +95,14 @@ bool test( for (std::size_t k = 0; k < 3; ++k) { regions.clear(); SD::internal::region_growing_planes( - input_range, std::back_inserter(regions), + input_range, + input_range.point_map(), + input_range.normal_map(), + std::back_inserter(regions), CGAL::parameters:: maximum_distance(max_distance). maximum_angle(max_angle). - minimum_region_size(min_region_size). - point_map(input_range.point_map()). - normal_map(input_range.normal_map())); + minimum_region_size(min_region_size)); assert(regions.size() == 7); } @@ -122,12 +121,12 @@ int main(int argc, char *argv[]) { const FT max_distance = FT(2); const FT max_angle = FT(20); const std::size_t min_region_size = 50; - return Plane_region(input_range, CGAL::parameters:: - maximum_distance(max_distance). + return Plane_region(input_range, + input_range.point_map(), + input_range.normal_map(), + CGAL::parameters::maximum_distance(max_distance). maximum_angle(max_angle). - minimum_region_size(min_region_size). - point_map(input_range.point_map()). - normal_map(input_range.normal_map())); + minimum_region_size(min_region_size)); }, [](const auto& region) -> bool { std::cout << "- num regions planes: " << region.size() << std::endl; @@ -146,12 +145,12 @@ int main(int argc, char *argv[]) { const FT max_distance = FT(1) / FT(100); const FT max_angle = FT(10); const std::size_t min_region_size = 50; - return Sphere_region(input_range, CGAL::parameters:: - maximum_distance(max_distance). + return Sphere_region(input_range, + input_range.point_map(), + input_range.normal_map(), + CGAL::parameters::maximum_distance(max_distance). maximum_angle(max_angle). - minimum_region_size(min_region_size). - point_map(input_range.point_map()). - normal_map(input_range.normal_map())); + minimum_region_size(min_region_size)); }, [](const auto& region) -> bool { std::cout << "- num regions spheres: " << region.size() << std::endl; @@ -170,12 +169,12 @@ int main(int argc, char *argv[]) { const FT max_distance = FT(1) / FT(20); const FT max_angle = FT(5); const std::size_t min_region_size = 200; - return Cylinder_region(input_range, CGAL::parameters:: - maximum_distance(max_distance). + return Cylinder_region(input_range, + input_range.point_map(), + input_range.normal_map(), + CGAL::parameters::maximum_distance(max_distance). maximum_angle(max_angle). - minimum_region_size(min_region_size). - point_map(input_range.point_map()). - normal_map(input_range.normal_map())); + minimum_region_size(min_region_size)); }, [](const auto& region) -> bool { std::cout << "- num regions cylinders: " << region.size() << std::endl; diff --git a/Shape_detection/test/Shape_detection/test_region_growing_on_polygon_mesh_with_sorting.cpp b/Shape_detection/test/Shape_detection/test_region_growing_on_polygon_mesh_with_sorting.cpp index 9b6bed4e294..ad5397b58d5 100644 --- a/Shape_detection/test/Shape_detection/test_region_growing_on_polygon_mesh_with_sorting.cpp +++ b/Shape_detection/test/Shape_detection/test_region_growing_on_polygon_mesh_with_sorting.cpp @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) { // Test free functions and stability. for (std::size_t k = 0; k < 3; ++k) { regions.clear(); - SD::internal::region_growing_planes( + SD::internal::region_growing_planes_polygon_mesh( polygon_mesh, std::back_inserter(regions), CGAL::parameters:: maximum_distance(distance_threshold). diff --git a/Shape_detection/test/Shape_detection/test_region_growing_strict.cpp b/Shape_detection/test/Shape_detection/test_region_growing_strict.cpp index befb4ab030d..401d7b2a5a7 100644 --- a/Shape_detection/test/Shape_detection/test_region_growing_strict.cpp +++ b/Shape_detection/test/Shape_detection/test_region_growing_strict.cpp @@ -11,6 +11,11 @@ #include #include +#include +#include +#include +#include + #include #include #include @@ -45,7 +50,10 @@ bool test_lines_points_with_normals() { assert(points_with_normals.size() == 9); std::vector< std::vector > regions; CGAL::Shape_detection::internal::region_growing_lines( - points_with_normals, std::back_inserter(regions)); + points_with_normals, + CGAL::First_of_pair_property_map >(), + CGAL::Second_of_pair_property_map >(), + std::back_inserter(regions)); assert(regions.size() == 3); assert(regions[0].size() == 3); assert(regions[1].size() == 3); @@ -201,7 +209,7 @@ bool test_lines_segment_set_3() { assert(surface_mesh.number_of_faces() == 7320); std::vector< std::vector > regions; - CGAL::Shape_detection::internal::region_growing_planes( + CGAL::Shape_detection::internal::region_growing_planes_polygon_mesh( surface_mesh, std::back_inserter(regions)); assert(regions.size() == 9); @@ -259,7 +267,10 @@ bool test_planes_points_with_normals() { assert(points_with_normals.size() == 9); std::vector< std::vector > regions; CGAL::Shape_detection::internal::region_growing_planes( - points_with_normals, std::back_inserter(regions)); + points_with_normals, + CGAL::First_of_pair_property_map >(), + CGAL::Second_of_pair_property_map >(), + std::back_inserter(regions)); assert(regions.size() == 1); assert(regions[0].size() == 9); return true; @@ -295,7 +306,10 @@ bool test_planes_point_set() { std::vector< std::vector > regions; CGAL::Shape_detection::internal::region_growing_planes( - point_set, std::back_inserter(regions)); + point_set, + point_set.point_map(), + point_set.normal_map(), + std::back_inserter(regions)); assert(regions.size() == 1); assert(regions[0].size() == 9); return true; @@ -318,7 +332,7 @@ bool test_planes_polyhedron() { assert(polyhedron.size_of_facets() == 4); std::vector< std::vector > regions; - CGAL::Shape_detection::internal::region_growing_planes( + CGAL::Shape_detection::internal::region_growing_planes_polygon_mesh( polyhedron, std::back_inserter(regions)); assert(regions.size() == polyhedron.size_of_facets()); return true; @@ -340,7 +354,7 @@ bool test_planes_surface_mesh() { assert(surface_mesh.number_of_faces() == 7320); std::vector< std::vector > regions; - CGAL::Shape_detection::internal::region_growing_planes( + CGAL::Shape_detection::internal::region_growing_planes_polygon_mesh( surface_mesh, std::back_inserter(regions)); assert(regions.size() == 9); return true; diff --git a/Shape_detection/test/Shape_detection/test_validity_sampled_data.cpp b/Shape_detection/test/Shape_detection/test_validity_sampled_data.cpp index 3a3062638c0..b5508aeff89 100644 --- a/Shape_detection/test/Shape_detection/test_validity_sampled_data.cpp +++ b/Shape_detection/test/Shape_detection/test_validity_sampled_data.cpp @@ -112,9 +112,10 @@ void test_copied_point_cloud (const Point_set& original_points, std::size_t nb) CGAL::Real_timer t; t.start(); RG_query rg_query ( - points, CGAL::parameters::sphere_radius(parameters.cluster_epsilon)); + points, Point_map(), + CGAL::parameters::sphere_radius(parameters.cluster_epsilon)); RG_region rg_region ( - points, + points, Point_map(), Normal_map(), CGAL::parameters:: maximum_distance(parameters.epsilon). cosine_value(parameters.normal_threshold).