rename do_snap to apply_iterative_snap_rounding, remove trailing whitespace

This commit is contained in:
Léo Valque 2025-02-17 18:09:04 +01:00
parent ac7bf3c45f
commit 9b84d4c73c
5 changed files with 16 additions and 16 deletions

View File

@ -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 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 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 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, When set to `true`, it ensures the coordinates are rounded to fit in `double` with potential additional subdivisions,
preventing any self-intersections from occurring. 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 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 */ } /* namespace CGAL */

View File

@ -1,5 +1,5 @@
#define PMP_ROUNDING_VERTICES_IN_POLYGON_SOUP_VERBOSE #define PMP_ROUNDING_VERTICES_IN_POLYGON_SOUP_VERBOSE
#define CGAL_PMP_AUTOREFINE_USE_DEFAULT_VERBOSE // #define CGAL_PMP_AUTOREFINE_USE_DEFAULT_VERBOSE
#include <CGAL/Cartesian.h> #include <CGAL/Cartesian.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h> #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
@ -41,10 +41,10 @@ int main(int argc, char** argv)
CGAL::Real_timer t; CGAL::Real_timer t;
t.start(); 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(); t.stop();
std::cout << "#points = " << input_points.size() << " and #triangles = " << input_triangles.size() << " in " << t.time() << " sec." << std::endl; std::cout << "#points = " << input_points.size() << " and #triangles = " << input_triangles.size() << " in " << t.time() << " sec." << std::endl;
std::vector<Cartesian::Point_3> output_points; std::vector<Cartesian::Point_3> output_points;
std::cout << "Does self-intersect: " << PMP::does_triangle_soup_self_intersect(input_points, input_triangles) << std::endl; std::cout << "Does self-intersect: " << PMP::does_triangle_soup_self_intersect(input_points, input_triangles) << std::endl;
for(auto &p: input_points) for(auto &p: input_points)

View File

@ -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. * `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 * 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 * 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, * 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. * 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. * 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`} * \cgalParamDefault{`Autorefinement::Default_visitor`}
* \cgalParamExtra{The visitor will be copied.} * \cgalParamExtra{The visitor will be copied.}
* \cgalParamNEnd * \cgalParamNEnd
* \cgalParamNBegin{do_snap} * \cgalParamNBegin{apply_iterative_snap_rounding}
* \cgalParamDescription{Enable the rounding of the coordinates so that they fit in doubles.} * \cgalParamDescription{Enable the rounding of the coordinates so that they fit in doubles.}
* \cgalParamType{boolean} * \cgalParamType{boolean}
* \cgalParamDefault{false} * \cgalParamDefault{false}
* \cgalParamNEnd * \cgalParamNEnd
* \cgalParamNBegin{snap_grid_size} * \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} * \cgalParamType{unsigned int}
* \cgalParamDefault{23} * \cgalParamDefault{23}
* \cgalParamExtra{Must be lower than 52.} * \cgalParamExtra{Must be lower than 52.}
* \cgalParamNEnd * \cgalParamNEnd
* \cgalParamNBegin{numbers_of_iteration} * \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} * \cgalParamType{unsigned int}
* \cgalParamDefault{15} * \cgalParamDefault{15}
* \cgalParamNEnd * \cgalParamNEnd
@ -1081,8 +1081,8 @@ bool autorefine_triangle_soup(PointRange& soup_points,
> ::type Visitor; > ::type Visitor;
Visitor visitor(choose_parameter<Visitor>(get_parameter(np, internal_np::visitor))); Visitor visitor(choose_parameter<Visitor>(get_parameter(np, internal_np::visitor)));
//TODO just modify do_snap instead of getting np one by one //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::do_snap), false); 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 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 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); const bool ead = choose_parameter(get_parameter(np, internal_np::erase_all_duplicates), false);

View File

@ -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 * 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 * 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. * performed by the algorithm.
@ -118,7 +118,7 @@ double ceil(NT x){
* \cgalParamNEnd * \cgalParamNEnd
* \cgalNamedParamsEnd * \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. * able to provide such a triangle soup within the number of iterations.
*/ */
template <typename PointRange, typename PolygonRange, class NamedParameters> template <typename PointRange, typename PolygonRange, class NamedParameters>

View File

@ -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(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(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(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) CGAL_add_named_parameter(snap_grid_size_t, snap_grid_size, snap_grid_size)
// List of named parameters used in Surface_mesh_approximation package // List of named parameters used in Surface_mesh_approximation package