use a set in triangle_soup_snap_rounding instead of vector, sort and unique

This commit is contained in:
Léo Valque 2025-04-29 16:02:13 +02:00
parent b08f7f2a5c
commit 8f7c8819f6
1 changed files with 3 additions and 8 deletions

View File

@ -483,24 +483,19 @@ bool polygon_soup_snap_rounding_impl(PointRange &points,
// Get all the snap version of the points of the vertices of the intersecting triangles
// Note: points will not be modified here, they will be modified in the next for loop
std::vector<Point_3> snap_points;
snap_points.reserve(pairs_of_intersecting_triangles.size() * 3);
std::set<Point_3> snap_points;
for (auto &pair : pairs_of_intersecting_triangles)
{
for (size_t pi : triangles[pair.first])
snap_points.emplace_back(snap_p(points[pi]));
snap_points.emplace(snap_p(points[pi]));
for (size_t pi : triangles[pair.second])
snap_points.emplace_back(snap_p(points[pi]));
snap_points.emplace(snap_p(points[pi]));
}
#ifdef PMP_ROUNDING_VERTICES_IN_POLYGON_SOUP_VERBOSE
std::cout << "Snap the coordinates of the vertices close-by the previous ones" << std::endl;
#endif
std::sort(snap_points.begin(), snap_points.end());
snap_points.erase(std::unique(snap_points.begin(), snap_points.end()), snap_points.end());
// If the snapped version of a point correspond to one of the previous point, we snap it
#ifdef CGAL_LINKED_WITH_TBB
if constexpr(parallel_execution)