diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt index 1240d8107fa..43915c02013 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt @@ -889,7 +889,7 @@ would then also includes overlaps of duplicated points. The function `CGAL::Polygon_mesh_processing::autorefine_triangle_soup()` provides a way to refine a triangle soup using the intersections of the triangles from the soup. In particular, if some points are duplicated they will be merged. Note that if a kernel with exact predicates but inexact constructions is used, some new self-intersections -might be introduced due to rounding issues of points coordinates. The `do_snap` option can be used to resolve this issue. +might be introduced due to rounding issues of points coordinates. The `apply_iterative_snap_rounding` option can be used to resolve this issue. When set to `true`, it ensures the coordinates are rounded to fit in `double` with potential additional subdivisions, preventing any self-intersections from occurring. @@ -1441,7 +1441,7 @@ used as a reference during the project. The curvature-based sizing field version of isotropic remeshing was added by Ivan Pađen during GSoC 2023, under the supervision of Sébastien Loriot and Jane Tournois. -The `do_snap` option for autorefinement were implemented during 2025. This was implemented by Léo Valque and Sylvain Lazard. The implementation is based on \cgalCite{lazard:hal-04907149}. +The `apply_iterative_snap_rounding` option for autorefinement were implemented during 2025. This was implemented by Léo Valque and Sylvain Lazard. The implementation is based on \cgalCite{lazard:hal-04907149}. */ } /* namespace CGAL */ diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/snap_polygon_soup.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/snap_polygon_soup.cpp index e577ee4f79e..8a3cde8036b 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/snap_polygon_soup.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/snap_polygon_soup.cpp @@ -1,5 +1,5 @@ -#define PMP_ROUNDING_VERTICES_IN_POLYGON_SOUP_VERBOSE -#define CGAL_PMP_AUTOREFINE_USE_DEFAULT_VERBOSE +#define PMP_ROUNDING_VERTICES_IN_POLYGON_SOUP_VERBOSE +// #define CGAL_PMP_AUTOREFINE_USE_DEFAULT_VERBOSE #include #include @@ -41,10 +41,10 @@ int main(int argc, char** argv) CGAL::Real_timer t; t.start(); - PMP::autorefine_triangle_soup(input_points, input_triangles, CGAL::parameters::do_snap(true).erase_all_duplicates(true).concurrency_tag(CGAL::Parallel_if_available_tag()).snap_grid_size(grid_size)); + PMP::autorefine_triangle_soup(input_points, input_triangles, CGAL::parameters::apply_iterative_snap_rounding(true).erase_all_duplicates(true).concurrency_tag(CGAL::Parallel_if_available_tag()).snap_grid_size(grid_size)); t.stop(); std::cout << "#points = " << input_points.size() << " and #triangles = " << input_triangles.size() << " in " << t.time() << " sec." << std::endl; - + std::vector output_points; std::cout << "Does self-intersect: " << PMP::does_triangle_soup_self_intersect(input_points, input_triangles) << std::endl; for(auto &p: input_points) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h index e13fe7aafca..e770806feea 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/autorefinement.h @@ -994,7 +994,7 @@ bool snap_polygon_soup(PointRange &points, * `soup_triangles` will be updated to contain both the input triangles and the new subdivided triangles. Degenerate triangles will be removed. * Also triangles in `soup_triangles` will be triangles without intersection first, followed by triangles coming from a subdivision induced * by an intersection. The named parameter `visitor()` can be used to track -* If the do_snap parameter is set to true, the coordinates of the vertices are rounded to fit within the precision of a double-precision floating point, +* If the `apply_iterative_snap_rounding` parameter is set to true, the coordinates of the vertices are rounded to fit within the precision of a double-precision floating point, * while preserving the model free of intersections. Note that this option does not guarantee an intersection-free output; however, * the returned boolean will be true if the output is free of self-intersections. The snap_grid_size parameter limits the drift of the snapped vertices. * A smaller value is more likely to output an intersection free output and perform more vertex collapses, but it may increase the Hausdorff distance from the input. @@ -1033,19 +1033,19 @@ bool snap_polygon_soup(PointRange &points, * \cgalParamDefault{`Autorefinement::Default_visitor`} * \cgalParamExtra{The visitor will be copied.} * \cgalParamNEnd -* \cgalParamNBegin{do_snap} +* \cgalParamNBegin{apply_iterative_snap_rounding} * \cgalParamDescription{Enable the rounding of the coordinates so that they fit in doubles.} * \cgalParamType{boolean} * \cgalParamDefault{false} * \cgalParamNEnd * \cgalParamNBegin{snap_grid_size} -* \cgalParamDescription{Scale the points to [-2^gs, 2^gs] where gs is the snap_grid_size before to round them on integer. Use only if do_snap is true.} +* \cgalParamDescription{Scale the points to [-2^gs, 2^gs] where gs is the snap_grid_size before to round them on integer. Use only if `apply_iterative_snap_rounding` is true.} * \cgalParamType{unsigned int} * \cgalParamDefault{23} * \cgalParamExtra{Must be lower than 52.} * \cgalParamNEnd * \cgalParamNBegin{numbers_of_iteration} -* \cgalParamDescription{Maximum number of iteration performed by the snap algorithm. Use only if do_snap is true.} +* \cgalParamDescription{Maximum number of iteration performed by the snap algorithm. Use only if `apply_iterative_snap_rounding` is true.} * \cgalParamType{unsigned int} * \cgalParamDefault{15} * \cgalParamNEnd @@ -1081,8 +1081,8 @@ bool autorefine_triangle_soup(PointRange& soup_points, > ::type Visitor; Visitor visitor(choose_parameter(get_parameter(np, internal_np::visitor))); - //TODO just modify do_snap instead of getting np one by one - const bool do_snap = choose_parameter(get_parameter(np, internal_np::do_snap), false); + //TODO just modify apply_iterative_snap_rounding instead of getting np one by one + const bool do_snap = choose_parameter(get_parameter(np, internal_np::apply_iterative_snap_rounding), false); const int grid_size = choose_parameter(get_parameter(np, internal_np::snap_grid_size), 23); const unsigned int nb_of_iteration = choose_parameter(get_parameter(np, internal_np::number_of_iterations), 15); const bool ead = choose_parameter(get_parameter(np, internal_np::erase_all_duplicates), false); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/snap_polygon_soup.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/snap_polygon_soup.h index a744ff86ae4..6080a367a1e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/snap_polygon_soup.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/snap_polygon_soup.h @@ -70,9 +70,9 @@ double ceil(NT x){ }; /** -* * -* Rounds the coordinates of the points so that they fit in doubles while making and keeping the model intersection free by potentially subdividing the triangles. +* +* Rounds the coordinates of the points so that they fit in doubles while making and keeping the model intersection free by potentially subdividing the triangles. * The input can be any triangle soup and the output is an intersection-free triangle soup with Hausdorff distance * between the input and the output bounded by M*2^-gs*k where M is the maximum absolute coordinate in the model, gs the snap_grid_size (see below) and k the number of iteration * performed by the algorithm. @@ -118,7 +118,7 @@ double ceil(NT x){ * \cgalParamNEnd * \cgalNamedParamsEnd * -* \return `true` if the modified triangle soup is free from self-intersection, and `false` if the algorithm was not +* \return `true` if the modified triangle soup is free from self-intersection, and `false` if the algorithm was not * able to provide such a triangle soup within the number of iterations. */ template diff --git a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h index 211a749b103..de0b8774b99 100644 --- a/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h +++ b/STL_Extension/include/CGAL/STL_Extension/internal/parameters_interface.h @@ -220,7 +220,7 @@ CGAL_add_named_parameter(scan_angle_t, scan_angle_map, scan_angle_map) CGAL_add_named_parameter(scanline_id_t, scanline_id_map, scanline_id_map) CGAL_add_named_parameter(min_points_per_cell_t, min_points_per_cell, min_points_per_cell) CGAL_add_named_parameter(scalar_t, scalar_map, scalar_map) -CGAL_add_named_parameter(do_snap_t, do_snap, do_snap) +CGAL_add_named_parameter(apply_iterative_snap_rounding_t, apply_iterative_snap_rounding, apply_iterative_snap_rounding) CGAL_add_named_parameter(snap_grid_size_t, snap_grid_size, snap_grid_size) // List of named parameters used in Surface_mesh_approximation package