From 9acece5b28ad1ed7f1ae83a49fbf424d5ee36e8f Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Thu, 12 Aug 2021 17:11:09 +0200 Subject: [PATCH] better unified NP --- .../regularize_framework.cpp | 2 +- .../regularize_open_contour.cpp | 14 +- .../regularize_planes.cpp | 7 +- .../Contours/Longest_direction_2.h | 33 ++- .../Contours/User_defined_directions_2.h | 38 ++- .../Shape_regularization/QP_regularization.h | 38 ++- .../Segments/Delaunay_neighbor_query_2.h | 32 ++- .../regularize_contours.h | 26 +- .../Shape_regularization/regularize_planes.h | 238 +++++++++------- .../regularize_segments.h | 253 ++++++++---------- .../Shape_regularization/test_0_segments.cpp | 3 +- .../Shape_regularization/test_1_segment.cpp | 3 +- .../Shape_regularization/test_2_segments.cpp | 8 +- .../Shape_regularization/test_3_segments.cpp | 4 +- .../Shape_regularization/test_4_segments.cpp | 4 +- .../test_equal_contours.cpp | 4 +- .../test_neighbor_query.cpp | 3 +- .../Shape_regularization/test_overloads.cpp | 68 ++++- .../test_plane_regularization.cpp | 14 +- 19 files changed, 477 insertions(+), 315 deletions(-) diff --git a/Shape_regularization/examples/Shape_regularization/regularize_framework.cpp b/Shape_regularization/examples/Shape_regularization/regularize_framework.cpp index c158e267470..52cea518436 100644 --- a/Shape_regularization/examples/Shape_regularization/regularize_framework.cpp +++ b/Shape_regularization/examples/Shape_regularization/regularize_framework.cpp @@ -72,7 +72,7 @@ int main() { }; Regularizer regularizer( - objects, neighbor_query, regularization_type, quadratic_program, Kernel()); + objects, neighbor_query, regularization_type, quadratic_program); regularizer.regularize(); std::cout << "* regularized 2 objects" << std::endl; diff --git a/Shape_regularization/examples/Shape_regularization/regularize_open_contour.cpp b/Shape_regularization/examples/Shape_regularization/regularize_open_contour.cpp index 977227dffde..09f519a162c 100644 --- a/Shape_regularization/examples/Shape_regularization/regularize_open_contour.cpp +++ b/Shape_regularization/examples/Shape_regularization/regularize_open_contour.cpp @@ -4,14 +4,13 @@ #include // Typedefs. -using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel; -using FT = typename Kernel::FT; -using Point_2 = typename Kernel::Point_2; -using Contour = std::vector; -using Point_map = CGAL::Identity_property_map; +using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel; +using FT = typename Kernel::FT; +using Point_2 = typename Kernel::Point_2; +using Contour = std::vector; using Contour_directions = - CGAL::Shape_regularization::Contours::Longest_direction_2; + CGAL::Shape_regularization::Contours::Longest_direction_2; int main(int argc, char *argv[]) { @@ -35,8 +34,7 @@ int main(int argc, char *argv[]) { // Regularize. const bool is_closed = false; - Contour_directions directions( - contour, is_closed, Point_map()); + Contour_directions directions(contour, is_closed); std::vector regularized; CGAL::Shape_regularization::Contours::regularize_open_contour( diff --git a/Shape_regularization/examples/Shape_regularization/regularize_planes.cpp b/Shape_regularization/examples/Shape_regularization/regularize_planes.cpp index 1635af98458..7cf8871fcbe 100644 --- a/Shape_regularization/examples/Shape_regularization/regularize_planes.cpp +++ b/Shape_regularization/examples/Shape_regularization/regularize_planes.cpp @@ -53,10 +53,11 @@ int main(int argc, char** argv) { // Regularize detected planes. CGAL::Shape_regularization::Planes::regularize_planes( planes, - Plane_map(), points, - Point_map(), - CGAL::parameters::plane_index_map( + CGAL::parameters:: + plane_map(Plane_map()). + point_map(Point_map()). + plane_index_map( CGAL::Shape_detection::Point_to_shape_index_map(points, planes)). regularize_coplanarity(false). // do not regularize coplanarity maximum_angle(FT(10))); // 10 degrees of tolerance for parallelism / orthogonality diff --git a/Shape_regularization/include/CGAL/Shape_regularization/Contours/Longest_direction_2.h b/Shape_regularization/include/CGAL/Shape_regularization/Contours/Longest_direction_2.h index 97f8db5397c..7b673cb7f9a 100644 --- a/Shape_regularization/include/CGAL/Shape_regularization/Contours/Longest_direction_2.h +++ b/Shape_regularization/include/CGAL/Shape_regularization/Contours/Longest_direction_2.h @@ -70,25 +70,39 @@ namespace Contours { /*! \brief initializes all internal data structures. + \tparam NamedParameters + a sequence of \ref bgl_namedparameters "Named Parameters" + \param input_range a const range of ordered 2D points, which form a contour \param is_closed indicates whether the contour is closed or open - \param point_map - an instance of `PointMap` that maps an item from input range to `GeomTraits::Point_2`; - this parameter can be omitted, the identity map `CGAL::Identity_property_map` is then used + \param np + an optional sequence of \ref bgl_namedparameters "Named Parameters" + among the ones listed below; this parameter can be omitted, + the default values are then used + + \cgalNamedParamsBegin + \cgalParamNBegin{point_map} + \cgalParamDescription{an instance of `PointMap` that maps an item from `input_range` + to `GeomTraits::Point_2`} + \cgalParamDefault{`PointMap()`} + \cgalParamNEnd + \cgalNamedParamsEnd \pre input_range.size() >= 3 for closed contours \pre input_range.size() >= 2 for open contours */ + template Longest_direction_2( const InputRange& input_range, const bool is_closed, - const PointMap point_map = PointMap()) : + const NamedParameters& np) : m_input_range(input_range), - m_point_map(point_map) { + m_point_map(parameters::choose_parameter(parameters::get_parameter( + np, internal_np::point_map), PointMap())) { CGAL_precondition(m_input_range.size() >= 2); @@ -107,6 +121,15 @@ namespace Contours { } } + /// \cond SKIP_IN_MANUAL + Longest_direction_2( + const InputRange& input_range, + const bool is_closed) : + Longest_direction_2( + input_range, is_closed, CGAL::parameters::all_default()) + { } + /// \endcond + /// @} /// \name Directions diff --git a/Shape_regularization/include/CGAL/Shape_regularization/Contours/User_defined_directions_2.h b/Shape_regularization/include/CGAL/Shape_regularization/Contours/User_defined_directions_2.h index d395126d035..7dc87ec436f 100644 --- a/Shape_regularization/include/CGAL/Shape_regularization/Contours/User_defined_directions_2.h +++ b/Shape_regularization/include/CGAL/Shape_regularization/Contours/User_defined_directions_2.h @@ -74,6 +74,9 @@ namespace Contours { \tparam DirectionRange a model of `ConstRange` whose value type is `GeomTraits::Direction_2` + \tparam NamedParameters + a sequence of \ref bgl_namedparameters "Named Parameters" + \param input_range a const range of ordered 2D points, which form a contour @@ -83,9 +86,18 @@ namespace Contours { \param direction_range a const range with user-specified principal directions - \param point_map - an instance of `PointMap` that maps an item from input range to `GeomTraits::Point_2`; - this parameter can be omitted, the identity map `CGAL::Identity_property_map` is then used + \param np + an optional sequence of \ref bgl_namedparameters "Named Parameters" + among the ones listed below; this parameter can be omitted, + the default values are then used + + \cgalNamedParamsBegin + \cgalParamNBegin{point_map} + \cgalParamDescription{an instance of `PointMap` that maps an item from `input_range` + to `GeomTraits::Point_2`} + \cgalParamDefault{`PointMap()`} + \cgalParamNEnd + \cgalNamedParamsEnd \pre direction_range.size() >= 1 \pre direction_range.size() == input_range.size() for closed contours @@ -94,14 +106,17 @@ namespace Contours { \pre input_range.size() >= 3 for closed contours \pre input_range.size() >= 2 for open contours */ - template + template< + typename DirectionRange, + typename NamedParameters> User_defined_directions_2( const InputRange& input_range, const bool is_closed, const DirectionRange& direction_range, - const PointMap point_map = PointMap()) : + const NamedParameters& np) : m_input_range(input_range), - m_point_map(point_map), + m_point_map(parameters::choose_parameter(parameters::get_parameter( + np, internal_np::point_map), PointMap())), m_max_angle_2(FT(5)) { CGAL_precondition(input_range.size() >= 2); @@ -124,6 +139,17 @@ namespace Contours { } } + /// \cond SKIP_IN_MANUAL + template + User_defined_directions_2( + const InputRange& input_range, + const bool is_closed, + const DirectionRange& direction_range) : + User_defined_directions_2( + input_range, is_closed, direction_range, CGAL::parameters::all_default()) + { } + /// \endcond + /// @} /// \name Directions diff --git a/Shape_regularization/include/CGAL/Shape_regularization/QP_regularization.h b/Shape_regularization/include/CGAL/Shape_regularization/QP_regularization.h index c1ac234b944..6875f93161d 100644 --- a/Shape_regularization/include/CGAL/Shape_regularization/QP_regularization.h +++ b/Shape_regularization/include/CGAL/Shape_regularization/QP_regularization.h @@ -107,6 +107,9 @@ namespace Shape_regularization { /*! \brief initializes all internal data structures. + \tparam NamedParameters + a sequence of \ref bgl_namedparameters "Named Parameters" + \param input_range a const range of input objects for shape regularization @@ -121,28 +124,51 @@ namespace Shape_regularization { \param quadratic_program an instance of `QPSolver` to solve the quadratic programming problem - \param traits - an instance of `GeomTraits`; this parameter can be omitted if the traits class - can be deduced from the input value type + \param np + an optional sequence of \ref bgl_namedparameters "Named Parameters" + among the ones listed below; this parameter can be omitted, + the default values are then used + + \cgalNamedParamsBegin + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{`GeomTraits()`} + \cgalParamNEnd + \cgalNamedParamsEnd \pre input_range.size() >= 2 */ + template QP_regularization( const InputRange& input_range, NeighQuery& neighbor_query, RegType& regularization_type, QPSolver& quadratic_program, - const GeomTraits& traits = GeomTraits()) : + const NamedParameters& np) : m_input_range(input_range), m_neighbor_query(neighbor_query), m_regularization_type(regularization_type), m_quadratic_program(quadratic_program), - m_traits(traits), + m_traits(parameters::choose_parameter(parameters::get_parameter( + np, internal_np::geom_traits), GeomTraits())), m_parameters(Parameters()) { clear(); } + /// \cond SKIP_IN_MANUAL + QP_regularization( + const InputRange& input_range, + NeighQuery& neighbor_query, + RegType& regularization_type, + QPSolver& quadratic_program) : + QP_regularization( + input_range, neighbor_query, regularization_type, quadratic_program, + CGAL::parameters::all_default()) + { } + /// \endcond + /// @} /// \name Regularization @@ -238,7 +264,7 @@ namespace Shape_regularization { // The field m_traits is not currently used. We should probably remove the // reference in case it will be used in the future! - const Traits& m_traits; + const Traits m_traits; const Parameters m_parameters; FT m_max_bound; diff --git a/Shape_regularization/include/CGAL/Shape_regularization/Segments/Delaunay_neighbor_query_2.h b/Shape_regularization/include/CGAL/Shape_regularization/Segments/Delaunay_neighbor_query_2.h index c2433e516f5..8de981cddd6 100644 --- a/Shape_regularization/include/CGAL/Shape_regularization/Segments/Delaunay_neighbor_query_2.h +++ b/Shape_regularization/include/CGAL/Shape_regularization/Segments/Delaunay_neighbor_query_2.h @@ -84,25 +84,47 @@ namespace Segments { /*! \brief initializes all internal data structures. + \tparam NamedParameters + a sequence of \ref bgl_namedparameters "Named Parameters" + \param input_range a const range of 2D segments - \param segment_map - an instance of `SegmentMap` that maps an item from input range to `GeomTraits::Segment_2`; - this parameter can be omitted, the identity map `CGAL::Identity_property_map` is then used + \param np + an optional sequence of \ref bgl_namedparameters "Named Parameters" + among the ones listed below; this parameter can be omitted, + the default values are then used + + \cgalNamedParamsBegin + \cgalParamNBegin{segment_map} + \cgalParamDescription{an instance of `SegmentMap` that maps an item from `input_range` + to `GeomTraits::Segment_2`} + \cgalParamDefault{`SegmentMap()`} + \cgalParamNEnd + \cgalNamedParamsEnd \pre input_range.size() >= 2 */ + template Delaunay_neighbor_query_2( const InputRange& input_range, - const SegmentMap segment_map = SegmentMap()) : + const NamedParameters& np) : m_input_range(input_range), - m_segment_map(segment_map) { + m_segment_map(parameters::choose_parameter(parameters::get_parameter( + np, internal_np::segment_map), SegmentMap())) { clear(); create_unique_group(); } + /// \cond SKIP_IN_MANUAL + Delaunay_neighbor_query_2( + InputRange& input_range) : + Delaunay_neighbor_query_2( + input_range, CGAL::parameters::all_default()) + { } + /// \endcond + /*! \brief inserts a group of segments from `input_range` and finds their neighbors within the group. diff --git a/Shape_regularization/include/CGAL/Shape_regularization/regularize_contours.h b/Shape_regularization/include/CGAL/Shape_regularization/regularize_contours.h index 9e3433fe1b8..dfc70e03bcf 100644 --- a/Shape_regularization/include/CGAL/Shape_regularization/regularize_contours.h +++ b/Shape_regularization/include/CGAL/Shape_regularization/regularize_contours.h @@ -127,8 +127,10 @@ namespace Contours { using Point_2 = typename PointMap::value_type; using GeomTraits = typename CGAL::Kernel_traits::Kernel; - GeomTraits traits; - PointMap point_map; + const PointMap point_map = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::point_map), PointMap()); + const GeomTraits traits = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::geom_traits), GeomTraits()); CGAL_precondition(input_range.size() >= 3); using Contour_regularizer = @@ -176,12 +178,13 @@ namespace Contours { CGAL_precondition(input_range.size() >= 3); using Iterator_type = typename InputRange::const_iterator; using Point_2 = typename std::iterator_traits::value_type; - using Kernel = typename Kernel_traits::Kernel; - using Contour_directions = Longest_direction_2; + using GeomTraits = typename Kernel_traits::Kernel; + using Contour_directions = Longest_direction_2; + GeomTraits traits; Contour_directions directions(input_range, true); return regularize_closed_contour( - input_range, directions, contour); + input_range, directions, contour, CGAL::parameters::geom_traits(traits)); } /*! @@ -266,8 +269,10 @@ namespace Contours { using Point_2 = typename PointMap::value_type; using GeomTraits = typename CGAL::Kernel_traits::Kernel; - GeomTraits traits; - PointMap point_map; + const PointMap point_map = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::point_map), PointMap()); + const GeomTraits traits = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::geom_traits), GeomTraits()); CGAL_precondition(input_range.size() >= 2); using Contour_regularizer = @@ -315,12 +320,13 @@ namespace Contours { CGAL_precondition(input_range.size() >= 3); using Iterator_type = typename InputRange::const_iterator; using Point_2 = typename std::iterator_traits::value_type; - using Kernel = typename Kernel_traits::Kernel; - using Contour_directions = Longest_direction_2; + using GeomTraits = typename Kernel_traits::Kernel; + using Contour_directions = Longest_direction_2; + GeomTraits traits; Contour_directions directions(input_range, false); return regularize_open_contour( - input_range, directions, contour); + input_range, directions, contour, CGAL::parameters::geom_traits(traits)); } } // namespace Contours diff --git a/Shape_regularization/include/CGAL/Shape_regularization/regularize_planes.h b/Shape_regularization/include/CGAL/Shape_regularization/regularize_planes.h index 9a1080b6799..0da06dd658a 100644 --- a/Shape_regularization/include/CGAL/Shape_regularization/regularize_planes.h +++ b/Shape_regularization/include/CGAL/Shape_regularization/regularize_planes.h @@ -276,109 +276,7 @@ namespace Planes { #ifdef CGAL_TYPENAME_FOR_MSC #undef CGAL_TYPENAME_FOR_MSC #endif - /// \endcond - /*! - \ingroup PkgShapeRegularizationRefPlanes - - \brief Hierarchical plane regularization. - - Given a set of detected planes with their corresponding inlier sets, - this function enables to reinforce four types of regularities among these planes: - - *Parallelism*: planes, which are detected as near parallel, are made exactly parallel. - - *Orthogonality*: planes, which are detected as near orthogonal, are made exactly orthogonal. - - *Coplanarity*: parallel planes, which are detected as near coplanar, are made exactly coplanar. - - *Axis-Symmetry*: planes, which are detected as near symmetrical with respect to a user-specified axis, - are made exactly symmetrical. - - %Planes are directly modified. Points are left unaltered, as well as their - relationship to the planes (no transfer of a point from a primitive plane to another). - - This function infers a traits class `GeomTraits` from the `PointMap` value type. - - The implementation follows \cgalCite{cgal:vla-lod-15}. - - \tparam PlaneRange - a model of `Range` whose iterator type is `RandomAccessIterator` - - \tparam PlaneMap - a model of `WritablePropertyMap` with the value type `CGAL::Plane_3` - - \tparam PointRange - a model of `ConstRange` whose iterator type is `RandomAccessIterator` - - \tparam PointMap - a model of `ReadablePropertyMap` with the value type `CGAL::Point_3` - - \tparam NamedParameters - a sequence of \ref bgl_namedparameters "Named Parameters" - - \param planes - a range of planes to be regularized - - \param plane_map - an instance of `PlaneMap` that maps an item from plane range to `GeomTraits::Plane_3` - - \param points - a const range of points assigned to planes, see the `plane_index_map` below - for more details - - \param point_map - an instance of `PointMap` that maps an item from point range to `GeomTraits::Point_3` - - \param np - an optional sequence of \ref bgl_namedparameters "Named Parameters" - among the ones listed below; this parameter can be omitted, - the default values are then used - - \cgalNamedParamsBegin - \cgalParamNBegin{plane_index_map} - \cgalParamDescription{a property map that associates the index of a point - in the `points` range to the index of a plane in the `planes` range (-1 if - point is not assigned to a plane)} - \cgalParamType{a model of `ReadablePropertyMap` with `std::size_t` as key type - and `int` as value type} - \cgalParamDefault{no default value} - \cgalParamNEnd - \cgalParamNBegin{maximum_angle} - \cgalParamDescription{maximum allowed angle in degrees between plane normals used - for parallelism, orthogonality, and axis symmetry} - \cgalParamType{`GeomTraits::FT`} - \cgalParamDefault{25 degrees} - \cgalParamNEnd - \cgalParamNBegin{maximum_offset} - \cgalParamDescription{maximum allowed orthogonal distance between two parallel planes - such that they are considered to be coplanar} - \cgalParamType{`GeomTraits::FT`} - \cgalParamDefault{0.01 unit length} - \cgalParamNEnd - \cgalParamNBegin{regularize_parallelism} - \cgalParamDescription{indicates whether parallelism should be regularized or not} - \cgalParamType{boolean} - \cgalParamDefault{true} - \cgalParamNEnd - \cgalParamNBegin{regularize_orthogonality} - \cgalParamDescription{indicates whether orthogonality should be regularized or not} - \cgalParamType{boolean} - \cgalParamDefault{true} - \cgalParamNEnd - \cgalParamNBegin{regularize_coplanarity} - \cgalParamDescription{indicates whether coplanarity should be regularized or not} - \cgalParamType{boolean} - \cgalParamDefault{true} - \cgalParamNEnd - \cgalParamNBegin{regularize_axis_symmetry} - \cgalParamDescription{indicates whether axis symmetry should be regularized or not} - \cgalParamType{boolean} - \cgalParamDefault{true} - \cgalParamNEnd - \cgalParamNBegin{symmetry_direction} - \cgalParamDescription{an axis for symmetry regularization} - \cgalParamType{`GeomTraits::Vector_3`} - \cgalParamDefault{Z axis that is `GeomTraits::Vector_3(0, 0, 1)`} - \cgalParamNEnd - \cgalNamedParamsEnd - */ template< typename PlaneRange, typename PlaneMap, @@ -440,7 +338,6 @@ namespace Planes { tol_angle, tol_copln, sym_dir); } - /// \cond SKIP_IN_MANUAL template< typename PlaneRange, typename PlaneMap, @@ -457,6 +354,141 @@ namespace Planes { } /// \endcond + /*! + \ingroup PkgShapeRegularizationRefPlanes + + \brief Hierarchical plane regularization. + + Given a set of detected planes with their corresponding inlier sets, + this function enables to reinforce four types of regularities among these planes: + - *Parallelism*: planes, which are detected as near parallel, are made exactly parallel. + - *Orthogonality*: planes, which are detected as near orthogonal, are made exactly orthogonal. + - *Coplanarity*: parallel planes, which are detected as near coplanar, are made exactly coplanar. + - *Axis-Symmetry*: planes, which are detected as near symmetrical with respect to a user-specified axis, + are made exactly symmetrical. + + %Planes are directly modified. Points are left unaltered, as well as their + relationship to the planes (no transfer of a point from a primitive plane to another). + + This function infers a traits class `GeomTraits` from the `PointRange` value type. + + The implementation follows \cgalCite{cgal:vla-lod-15}. + + \tparam PlaneRange + a model of `Range` whose iterator type is `RandomAccessIterator` + + \tparam PointRange + a model of `ConstRange` whose iterator type is `RandomAccessIterator` + + \tparam NamedParameters + a sequence of \ref bgl_namedparameters "Named Parameters" + + \param planes + a range of planes to be regularized + + \param points + a const range of points assigned to planes, see the `plane_index_map` below + for more details + + \param np + an optional sequence of \ref bgl_namedparameters "Named Parameters" + among the ones listed below; this parameter can be omitted, + the default values are then used + + \cgalNamedParamsBegin + \cgalParamNBegin{plane_map} + \cgalParamDescription{a property map that maps a plane from `planes` range to `CGAL::Plane_3`} + \cgalParamType{a model of `WritablePropertyMap` with the value type `CGAL::Plane_3`} + \cgalParamDefault{`PlaneMap()`} + \cgalParamNEnd + \cgalParamNBegin{point_map} + \cgalParamDescription{a property map that maps a point from `points` range to `CGAL::Point_3`} + \cgalParamType{a model of `ReadablePropertyMap` with the value type `CGAL::Point_3`} + \cgalParamDefault{`PointMap()`} + \cgalParamNEnd + \cgalParamNBegin{plane_index_map} + \cgalParamDescription{a property map that associates the index of a point + in the `points` range to the index of a plane in the `planes` range (-1 if + point is not assigned to a plane)} + \cgalParamType{a model of `ReadablePropertyMap` with `std::size_t` as key type and `int` as value type} + \cgalParamDefault{`PlaneIndexMap()`} + \cgalParamNEnd + \cgalParamNBegin{maximum_angle} + \cgalParamDescription{maximum allowed angle in degrees between plane normals used + for parallelism, orthogonality, and axis symmetry} + \cgalParamType{`GeomTraits::FT`} + \cgalParamDefault{25 degrees} + \cgalParamNEnd + \cgalParamNBegin{maximum_offset} + \cgalParamDescription{maximum allowed orthogonal distance between two parallel planes + such that they are considered to be coplanar} + \cgalParamType{`GeomTraits::FT`} + \cgalParamDefault{0.01 unit length} + \cgalParamNEnd + \cgalParamNBegin{regularize_parallelism} + \cgalParamDescription{indicates whether parallelism should be regularized or not} + \cgalParamType{boolean} + \cgalParamDefault{true} + \cgalParamNEnd + \cgalParamNBegin{regularize_orthogonality} + \cgalParamDescription{indicates whether orthogonality should be regularized or not} + \cgalParamType{boolean} + \cgalParamDefault{true} + \cgalParamNEnd + \cgalParamNBegin{regularize_coplanarity} + \cgalParamDescription{indicates whether coplanarity should be regularized or not} + \cgalParamType{boolean} + \cgalParamDefault{true} + \cgalParamNEnd + \cgalParamNBegin{regularize_axis_symmetry} + \cgalParamDescription{indicates whether axis symmetry should be regularized or not} + \cgalParamType{boolean} + \cgalParamDefault{true} + \cgalParamNEnd + \cgalParamNBegin{symmetry_direction} + \cgalParamDescription{an axis for symmetry regularization} + \cgalParamType{`GeomTraits::Vector_3`} + \cgalParamDefault{Z axis that is `GeomTraits::Vector_3(0, 0, 1)`} + \cgalParamNEnd + \cgalNamedParamsEnd + */ + template< + typename PlaneRange, + typename PointRange, + typename NamedParameters> + void regularize_planes( + PlaneRange& planes, + const PointRange& points, + const NamedParameters& np) { + + using parameters::get_parameter; + using parameters::choose_parameter; + + using PlaneMap = typename CGAL::Point_set_processing_3:: + GetPlaneMap::type; + const PlaneMap plane_map = + choose_parameter(get_parameter(np, internal_np::plane_map), PlaneMap()); + + using PointMap = typename CGAL:: + GetPointMap::type; + const PointMap point_map = + choose_parameter(get_parameter(np, internal_np::point_map), PointMap()); + + regularize_planes(planes, plane_map, points, point_map, np); + } + + /// \cond SKIP_IN_MANUAL + template< + typename PlaneRange, + typename PointRange> + void regularize_planes( + PlaneRange& planes, const PointRange& points) { + + regularize_planes( + planes, points, CGAL::parameters::all_default()); + } + /// \endcond + } // namespace Planes } // namespace Shape_regularization } // namespace CGAL diff --git a/Shape_regularization/include/CGAL/Shape_regularization/regularize_segments.h b/Shape_regularization/include/CGAL/Shape_regularization/regularize_segments.h index c729a3a076f..ae7af2c8465 100644 --- a/Shape_regularization/include/CGAL/Shape_regularization/regularize_segments.h +++ b/Shape_regularization/include/CGAL/Shape_regularization/regularize_segments.h @@ -82,8 +82,8 @@ namespace Segments { \tparam QPSolver a model of `QuadraticProgramTraits` - \tparam GeomTraits - a model of `Kernel` + \tparam NamedParameters + a sequence of \ref bgl_namedparameters "Named Parameters" \param input_range a const range of input segments for shape regularization @@ -92,21 +92,32 @@ namespace Segments { an instance of `NeighQuery` that is used internally to access neighbors of a segment; this parameter can be omitted together with the `regularization_type` parameter, in this case, all types of regularities - will be reinforced on the whole input range + will be reinforced on the whole input range and the default solver will be used (see below) \param regularization_type an instance of `RegType` that is used internally to obtain bounds and target values required by the regularization; this parameter can be omitted together with the `neighbor_query` parameter, in this case, all types of regularities will be reinforced on the whole input range + and the default solver will be used (see below) \param quadratic_program an instance of `QPSolver` to solve the quadratic programming problem; this parameter can be omitted, the default solver is `CGAL::OSQP_quadratic_program_traits` - \param traits - an instance of `GeomTraits`; this parameter can be omitted if the traits class - can be deduced from the input value type + \param np + an optional sequence of \ref bgl_namedparameters "Named Parameters" + among the ones listed below; this parameter can be omitted, + the default values are then used + + \cgalNamedParamsBegin + \cgalParamNBegin{geom_traits} + \cgalParamDescription{an instance of geometric traits class} + \cgalParamType{a model of `Kernel`} + \cgalParamDefault{a CGAL `Kernel` deduced from the point type, + using `CGAL::Kernel_traits`} + \cgalParamNEnd + \cgalNamedParamsEnd \pre input_range.size() >= 2 @@ -118,135 +129,49 @@ namespace Segments { typename NeighQuery, typename RegType, typename QPSolver, - typename GeomTraits> + typename NamedParameters> void regularize_segments( InputRange& input_range, NeighQuery& neighbor_query, RegType& regularization_type, QPSolver& quadratic_program, - const GeomTraits& traits) { + const NamedParameters& np) { + + using SegmentMap = typename internal::GetSegmentMap::type; + using Segment_2 = typename SegmentMap::value_type; + using GeomTraits = typename CGAL::Kernel_traits::Kernel; CGAL_precondition(input_range.size() >= 2); using Regularizer = QP_regularization< GeomTraits, InputRange, NeighQuery, RegType, QPSolver>; Regularizer regularizer( - input_range, neighbor_query, regularization_type, quadratic_program, traits); + input_range, neighbor_query, regularization_type, quadratic_program, np); regularizer.regularize(); } - /*! - \ingroup PkgShapeRegularizationRefSegments - - \brief regularizes angles in a set of 2D segments. - - Given a set of unordered 2D segments, this function enables to reinforce - two types of regularities among these segments: - - *Parallelism*: segments, which are detected as near parallel, are made exactly parallel. - - *Orthogonality*: segments, which are detected as near orthogonal, are made exactly orthogonal. - - \tparam InputRange - a model of `ConstRange` whose iterator type is `RandomAccessIterator` - - \tparam GeomTraits - a model of `Kernel` - - \param input_range - a const range of input segments for angle regularization - - \param traits - an instance of `GeomTraits`; this parameter can be omitted if the traits class - can be deduced from the input value type - - \pre input_range.size() >= 2 - - \sa `regularize_segments()` - \sa `regularize_offsets()` - */ - template< - typename InputRange, - typename GeomTraits> - void regularize_angles( - InputRange& input_range, - const GeomTraits& traits) { - - CGAL_precondition(input_range.size() >= 2); - using Neighbor_query = Delaunay_neighbor_query_2; - using Angle_regularization = Angle_regularization_2; - - Neighbor_query neighbor_query(input_range); - Angle_regularization angle_regularization(input_range); - regularize_segments( - input_range, neighbor_query, angle_regularization, traits); - } - - /*! - \ingroup PkgShapeRegularizationRefSegments - - \brief regularizes offsets in a set of 2D segments. - - Given a set of parallel 2D segments, this function enables to reinforce - the collinearity property among these segments that is all parallel segments, - which are detected as near collinear, are made exactly collinear. - - \tparam InputRange - a model of `ConstRange` whose iterator type is `RandomAccessIterator` - - \tparam GeomTraits - a model of `Kernel` - - \param input_range - a const range of input segments for offset regularization - - \param traits - an instance of `GeomTraits`; this parameter can be omitted if the traits class - can be deduced from the input value type - - \pre input_range.size() >= 2 - - \sa `regularize_segments()` - \sa `regularize_angles()` - */ - template< - typename InputRange, - typename GeomTraits> - void regularize_offsets( - InputRange& input_range, - const GeomTraits& traits) { - - CGAL_precondition(input_range.size() >= 2); - using Neighbor_query = Delaunay_neighbor_query_2; - using Offset_regularization = Offset_regularization_2; - - Neighbor_query neighbor_query(input_range); - Offset_regularization offset_regularization(input_range); - regularize_segments( - input_range, neighbor_query, offset_regularization, traits); - } - - #if defined(CGAL_USE_OSQP) || defined(DOXYGEN_RUNNING) - /// \cond SKIP_IN_MANUAL template< typename InputRange, typename NeighQuery, typename RegType, - typename GeomTraits> + typename QPSolver> void regularize_segments( InputRange& input_range, NeighQuery& neighbor_query, RegType& regularization_type, - const GeomTraits& traits) { + QPSolver& quadratic_program) { CGAL_precondition(input_range.size() >= 2); - using FT = typename GeomTraits::FT; - using QP = CGAL::OSQP_quadratic_program_traits; - QP quadratic_program; - regularize_segments( - input_range, neighbor_query, regularization_type, quadratic_program, traits); + input_range, neighbor_query, regularization_type, quadratic_program, + CGAL::parameters::all_default()); } + /// \endcond + #if defined(CGAL_USE_OSQP) || defined(DOXYGEN_RUNNING) + + /// \cond SKIP_IN_MANUAL template< typename InputRange, typename NeighQuery, @@ -267,17 +192,19 @@ namespace Segments { QP quadratic_program; regularize_segments( - input_range, neighbor_query, regularization_type, quadratic_program, traits); + input_range, neighbor_query, regularization_type, quadratic_program, + CGAL::parameters::geom_traits(traits)); } - template< - typename InputRange, - typename GeomTraits> + template void regularize_segments( - InputRange& input_range, - const GeomTraits& traits) { + InputRange& input_range) { CGAL_precondition(input_range.size() >= 2); + using Iterator_type = typename InputRange::const_iterator; + using Segment_2 = typename std::iterator_traits::value_type; + using GeomTraits = typename Kernel_traits::Kernel; + using Indices = std::vector; using Neighbor_query = Delaunay_neighbor_query_2; using Angle_regularization = Angle_regularization_2; @@ -287,7 +214,7 @@ namespace Segments { Neighbor_query neighbor_query(input_range); Angle_regularization angle_regularization(input_range); regularize_segments( - input_range, neighbor_query, angle_regularization, traits); + input_range, neighbor_query, angle_regularization); std::vector parallel_groups; angle_regularization.parallel_groups( @@ -301,22 +228,33 @@ namespace Segments { offset_regularization.add_group(parallel_group); } regularize_segments( - input_range, neighbor_query, offset_regularization, traits); + input_range, neighbor_query, offset_regularization); } + /// \endcond - template - void regularize_segments( - InputRange& input_range) { + /*! + \ingroup PkgShapeRegularizationRefSegments - CGAL_precondition(input_range.size() >= 2); - using Iterator_type = typename InputRange::const_iterator; - using Segment_2 = typename std::iterator_traits::value_type; - using GeomTraits = typename Kernel_traits::Kernel; - GeomTraits traits; + \brief regularizes angles in a set of 2D segments. - regularize_segments(input_range, traits); - } + Given a set of unordered 2D segments, this function enables to reinforce + two types of regularities among these segments: + - *Parallelism*: segments, which are detected as near parallel, are made exactly parallel. + - *Orthogonality*: segments, which are detected as near orthogonal, are made exactly orthogonal. + This is an utility function based on `regularize_segments()` that is using default parameters. + + \tparam InputRange + a model of `ConstRange` whose iterator type is `RandomAccessIterator` + + \param input_range + a const range of input segments for angle regularization + + \pre input_range.size() >= 2 + + \sa `regularize_segments()` + \sa `regularize_offsets()` + */ template void regularize_angles( InputRange& input_range) { @@ -325,11 +263,38 @@ namespace Segments { using Iterator_type = typename InputRange::const_iterator; using Segment_2 = typename std::iterator_traits::value_type; using GeomTraits = typename Kernel_traits::Kernel; - GeomTraits traits; - regularize_angles(input_range, traits); + using Neighbor_query = Delaunay_neighbor_query_2; + using Angle_regularization = Angle_regularization_2; + + Neighbor_query neighbor_query(input_range); + Angle_regularization angle_regularization(input_range); + regularize_segments( + input_range, neighbor_query, angle_regularization); } + /*! + \ingroup PkgShapeRegularizationRefSegments + + \brief regularizes offsets in a set of 2D segments. + + Given a set of parallel 2D segments, this function enables to reinforce + the collinearity property among these segments that is all parallel segments, + which are detected as near collinear, are made exactly collinear. + + This is an utility function based on `regularize_segments()` that is using default parameters. + + \tparam InputRange + a model of `ConstRange` whose iterator type is `RandomAccessIterator` + + \param input_range + a const range of input segments for offset regularization + + \pre input_range.size() >= 2 + + \sa `regularize_segments()` + \sa `regularize_angles()` + */ template void regularize_offsets( InputRange& input_range) { @@ -338,11 +303,15 @@ namespace Segments { using Iterator_type = typename InputRange::const_iterator; using Segment_2 = typename std::iterator_traits::value_type; using GeomTraits = typename Kernel_traits::Kernel; - GeomTraits traits; - regularize_offsets(input_range, traits); + using Neighbor_query = Delaunay_neighbor_query_2; + using Offset_regularization = Offset_regularization_2; + + Neighbor_query neighbor_query(input_range); + Offset_regularization offset_regularization(input_range); + regularize_segments( + input_range, neighbor_query, offset_regularization); } - /// \endcond #endif // CGAL_USE_OSQP or DOXYGEN_RUNNING @@ -426,8 +395,10 @@ namespace Segments { using Segment_2 = typename SegmentMap::value_type; using GeomTraits = typename CGAL::Kernel_traits::Kernel; - GeomTraits traits; - SegmentMap segment_map; + const SegmentMap segment_map = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::segment_map), SegmentMap()); + const GeomTraits traits = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::geom_traits), GeomTraits()); CGAL_precondition(input_range.size() >= 1); using Parallel_groups_2 = internal::Parallel_groups_2< @@ -531,8 +502,10 @@ namespace Segments { using Segment_2 = typename SegmentMap::value_type; using GeomTraits = typename CGAL::Kernel_traits::Kernel; - GeomTraits traits; - SegmentMap segment_map; + const SegmentMap segment_map = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::segment_map), SegmentMap()); + const GeomTraits traits = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::geom_traits), GeomTraits()); CGAL_precondition(input_range.size() >= 1); using Collinear_groups_2 = internal::Collinear_groups_2< @@ -636,8 +609,10 @@ namespace Segments { using Segment_2 = typename SegmentMap::value_type; using GeomTraits = typename CGAL::Kernel_traits::Kernel; - GeomTraits traits; - SegmentMap segment_map; + const SegmentMap segment_map = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::segment_map), SegmentMap()); + const GeomTraits traits = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::geom_traits), GeomTraits()); CGAL_precondition(input_range.size() >= 1); using Orthogonal_groups_2 = internal::Orthogonal_groups_2< @@ -740,8 +715,10 @@ namespace Segments { using Segment_2 = typename SegmentMap::value_type; using GeomTraits = typename CGAL::Kernel_traits::Kernel; - GeomTraits traits; - SegmentMap segment_map; + const SegmentMap segment_map = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::segment_map), SegmentMap()); + const GeomTraits traits = parameters::choose_parameter( + parameters::get_parameter(np, internal_np::geom_traits), GeomTraits()); CGAL_precondition(input_range.size() >= 1); using Unique_segments_2 = internal::Unique_segments_2< diff --git a/Shape_regularization/test/Shape_regularization/test_0_segments.cpp b/Shape_regularization/test/Shape_regularization/test_0_segments.cpp index 93f430e3625..55267e93bae 100644 --- a/Shape_regularization/test/Shape_regularization/test_0_segments.cpp +++ b/Shape_regularization/test/Shape_regularization/test_0_segments.cpp @@ -32,7 +32,8 @@ void test_0_segments() { // saver.export_eps_segments(segments, "0_input", 100); - NQ neighbor_query(segments, smap); + NQ neighbor_query( + segments, CGAL::parameters::segment_map(smap)); AR angle_regularization( segments, CGAL::parameters::segment_map(smap)); diff --git a/Shape_regularization/test/Shape_regularization/test_1_segment.cpp b/Shape_regularization/test/Shape_regularization/test_1_segment.cpp index 4aab8295826..6f60aac077a 100644 --- a/Shape_regularization/test/Shape_regularization/test_1_segment.cpp +++ b/Shape_regularization/test/Shape_regularization/test_1_segment.cpp @@ -35,7 +35,8 @@ void test_1_segment() { // saver.export_segments(segments, "1_input", 100); - NQ neighbor_query(segments, smap); + NQ neighbor_query( + segments, CGAL::parameters::segment_map(smap)); AR angle_regularization( segments, CGAL::parameters::segment_map(smap)); diff --git a/Shape_regularization/test/Shape_regularization/test_2_segments.cpp b/Shape_regularization/test/Shape_regularization/test_2_segments.cpp index 6231804ceaa..e8758a6e77a 100644 --- a/Shape_regularization/test/Shape_regularization/test_2_segments.cpp +++ b/Shape_regularization/test/Shape_regularization/test_2_segments.cpp @@ -38,7 +38,9 @@ void test_2_segments() { // saver.export_segments(segments, "2_input", 100); const FT max_angle_2 = FT(5); - NQ neighbor_query(segments, smap); + NQ neighbor_query( + segments, CGAL::parameters:: + segment_map(smap)); AR angle_regularization( segments, CGAL::parameters:: maximum_angle(max_angle_2). @@ -46,7 +48,7 @@ void test_2_segments() { QP qp_angles; QP_AR qp_ar( - segments, neighbor_query, angle_regularization, qp_angles, Traits()); + segments, neighbor_query, angle_regularization, qp_angles); qp_ar.regularize(); std::vector parallel_groups; @@ -87,7 +89,7 @@ void test_2_segments() { QP qp_offsets; QP_OR qp_or( - segments, neighbor_query, offset_regularization, qp_offsets, Traits()); + segments, neighbor_query, offset_regularization, qp_offsets); qp_or.regularize(); std::vector collinear_groups; diff --git a/Shape_regularization/test/Shape_regularization/test_3_segments.cpp b/Shape_regularization/test/Shape_regularization/test_3_segments.cpp index 47d6790b7e3..59fd9100dba 100644 --- a/Shape_regularization/test/Shape_regularization/test_3_segments.cpp +++ b/Shape_regularization/test/Shape_regularization/test_3_segments.cpp @@ -37,7 +37,7 @@ void test_3_segments() { segments, CGAL::parameters::maximum_angle(max_angle_2)); SR::Segments::regularize_segments( - segments, neighbor_query, angle_regularization, Traits()); + segments, neighbor_query, angle_regularization); std::vector parallel_groups; angle_regularization.parallel_groups( @@ -75,7 +75,7 @@ void test_3_segments() { } SR::Segments::regularize_segments( - segments, neighbor_query, offset_regularization, Traits()); + segments, neighbor_query, offset_regularization); std::vector collinear_groups; offset_regularization.collinear_groups( diff --git a/Shape_regularization/test/Shape_regularization/test_4_segments.cpp b/Shape_regularization/test/Shape_regularization/test_4_segments.cpp index 944b62c431b..57a2c1673e4 100644 --- a/Shape_regularization/test/Shape_regularization/test_4_segments.cpp +++ b/Shape_regularization/test/Shape_regularization/test_4_segments.cpp @@ -40,7 +40,7 @@ void test_4_segments() { QP qp_angles; SR::Segments::regularize_segments( - segments, neighbor_query, angle_regularization, qp_angles, Traits()); + segments, neighbor_query, angle_regularization, qp_angles); std::vector parallel_groups; angle_regularization.parallel_groups( @@ -80,7 +80,7 @@ void test_4_segments() { QP qp_offsets; SR::Segments::regularize_segments( - segments, neighbor_query, offset_regularization, qp_offsets, Traits()); + segments, neighbor_query, offset_regularization, qp_offsets); std::vector collinear_groups; offset_regularization.collinear_groups( diff --git a/Shape_regularization/test/Shape_regularization/test_equal_contours.cpp b/Shape_regularization/test/Shape_regularization/test_equal_contours.cpp index 8923cb013c5..4bc72116efe 100644 --- a/Shape_regularization/test/Shape_regularization/test_equal_contours.cpp +++ b/Shape_regularization/test/Shape_regularization/test_equal_contours.cpp @@ -32,8 +32,8 @@ void test_equal_contours() { // saver.export_open_contour(contour, "op_input", 100); const bool is_closed = true; - CD closed_directions(contour, is_closed, pmap); - OD open_directions(contour, !is_closed, pmap); + CD closed_directions(contour, is_closed, CGAL::parameters::point_map(pmap)); + OD open_directions(contour, !is_closed, CGAL::parameters::point_map(pmap)); std::vector closed_contour; SR::Contours::regularize_closed_contour( diff --git a/Shape_regularization/test/Shape_regularization/test_neighbor_query.cpp b/Shape_regularization/test/Shape_regularization/test_neighbor_query.cpp index 9c083703079..335e1f41e37 100644 --- a/Shape_regularization/test/Shape_regularization/test_neighbor_query.cpp +++ b/Shape_regularization/test/Shape_regularization/test_neighbor_query.cpp @@ -37,7 +37,8 @@ void test_neighbor_query() { groups[1] = {4, 5, 6, 7}; // internal square Indices neighbors; - NQ neighbor_query(segments); + NQ neighbor_query( + segments, CGAL::parameters::all_default()); // Check unique group. Segments edges; diff --git a/Shape_regularization/test/Shape_regularization/test_overloads.cpp b/Shape_regularization/test/Shape_regularization/test_overloads.cpp index 8213b527494..95f2f9b6d35 100644 --- a/Shape_regularization/test/Shape_regularization/test_overloads.cpp +++ b/Shape_regularization/test/Shape_regularization/test_overloads.cpp @@ -4,6 +4,7 @@ #include #include #include +#include namespace SR = CGAL::Shape_regularization; @@ -13,20 +14,33 @@ void test_overloads() { using FT = typename Traits::FT; using Point_2 = typename Traits::Point_2; using Segment_2 = typename Traits::Segment_2; - using Segments = std::vector; + + using Points = std::vector; + using Segments = std::vector; + using Indices = std::vector; using NQ = SR::Segments::Delaunay_neighbor_query_2; using AR = SR::Segments::Angle_regularization_2; using OR = SR::Segments::Offset_regularization_2; using QP = CGAL::OSQP_quadratic_program_traits; + using CD = SR::Contours::Longest_direction_2; + + Points points = { + Point_2(0, 0), Point_2(1, 0), + Point_2(0, 1), Point_2(1, 1), + }; + assert(points.size() == 4); - Traits traits; Segments segments = { Segment_2(Point_2(0, 0), Point_2(1, 0)), Segment_2(Point_2(0, 1), Point_2(1, 1)), }; assert(segments.size() == 2); + std::vector indices; + std::vector unique; + std::vector contour; + // saver.export_segments(segments, "ol_input", 100); NQ neighbor_query(segments); @@ -34,26 +48,56 @@ void test_overloads() { OR offset_regularization(segments); QP quadratic_program; + CD cdirections(points, true); + CD odirections(points, false); + SR::Segments::regularize_segments( - segments, neighbor_query, angle_regularization, quadratic_program, traits); + segments, neighbor_query, angle_regularization, quadratic_program, CGAL::parameters::all_default()); SR::Segments::regularize_segments( - segments, neighbor_query, angle_regularization, traits); + segments, neighbor_query, angle_regularization, quadratic_program); SR::Segments::regularize_segments( segments, neighbor_query, angle_regularization); - SR::Segments::regularize_segments( - segments, traits); SR::Segments::regularize_segments( segments); SR::Segments::regularize_angles( - segments, traits); - SR::Segments::regularize_angles( + segments); + SR::Segments::regularize_offsets( segments); - SR::Segments::regularize_offsets( - segments, traits); - SR::Segments::regularize_offsets( - segments); + SR::Segments::parallel_groups( + segments, std::back_inserter(indices), CGAL::parameters::all_default()); + SR::Segments::parallel_groups( + segments, std::back_inserter(indices)); + + SR::Segments::collinear_groups( + segments, std::back_inserter(indices), CGAL::parameters::all_default()); + SR::Segments::collinear_groups( + segments, std::back_inserter(indices)); + + SR::Segments::orthogonal_groups( + segments, std::back_inserter(indices), CGAL::parameters::all_default()); + SR::Segments::orthogonal_groups( + segments, std::back_inserter(indices)); + + SR::Segments::unique_segments( + segments, std::back_inserter(unique), CGAL::parameters::all_default()); + SR::Segments::unique_segments( + segments, std::back_inserter(unique)); + + SR::Contours::regularize_closed_contour( + points, cdirections, std::back_inserter(contour), CGAL::parameters::all_default()); + SR::Contours::regularize_closed_contour( + points, cdirections, std::back_inserter(contour)); + SR::Contours::regularize_closed_contour( + points, std::back_inserter(contour)); + + SR::Contours::regularize_open_contour( + points, odirections, std::back_inserter(contour), CGAL::parameters::all_default()); + SR::Contours::regularize_open_contour( + points, odirections, std::back_inserter(contour)); + SR::Contours::regularize_open_contour( + points, std::back_inserter(contour)); } int main() { diff --git a/Shape_regularization/test/Shape_regularization/test_plane_regularization.cpp b/Shape_regularization/test/Shape_regularization/test_plane_regularization.cpp index c4144258c03..0e1e3ed6dd2 100644 --- a/Shape_regularization/test/Shape_regularization/test_plane_regularization.cpp +++ b/Shape_regularization/test/Shape_regularization/test_plane_regularization.cpp @@ -186,10 +186,11 @@ int main() { CGAL::Shape_regularization::Planes::regularize_planes( planes, - CGAL::Shape_detection::Plane_map(), points, - Point_map(), - CGAL::parameters::plane_index_map( + CGAL::parameters:: + plane_map(CGAL::Shape_detection::Plane_map()). + point_map(Point_map()). + plane_index_map( CGAL::Shape_detection::Point_to_shape_index_map(points, planes)). regularize_parallelism(true). regularize_orthogonality(false). @@ -292,10 +293,11 @@ int main() { CGAL::Shape_regularization::Planes::regularize_planes( planes, - CGAL::Shape_detection::Plane_map(), points, - Point_map(), - CGAL::parameters::plane_index_map( + CGAL::parameters:: + point_map(Point_map()). + plane_map(CGAL::Shape_detection::Plane_map()). + plane_index_map( CGAL::Shape_detection::Point_to_shape_index_map(points, planes)). regularize_parallelism(true). regularize_orthogonality(false).