From 116c0ec5d99a8361c123bc5780aabdfa8891ae75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 10 Dec 2024 15:18:24 +0100 Subject: [PATCH] only use one container for the next loop --> make the output of the function idempotent --- .../Polygon_mesh_processing/repair_degeneracies.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h index 2371d2e8e6e..a4bf4e5720a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h @@ -751,7 +751,6 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, return true; std::unordered_set next_edges_to_collapse; - std::unordered_set next_edges_to_flip; // Treat needles =============================================================================== #ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA @@ -771,7 +770,7 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, if(needle_h == null_h) { #ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA - std::cout << "\t Needle criterion no longer verified" << std::endl; + std::cout << "\t Needle criterion not verified" << std::endl; #endif halfedge_descriptor cap_h = internal::is_it_a_cap(face(h, tmesh), tmesh, vpm, vcm, ecm, gt, cap_threshold, flip_triangle_height_threshold_squared); @@ -1010,9 +1009,7 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, for(halfedge_descriptor hh : CGAL::halfedges_around_face(h, tmesh)) { - // Remove from 'next_edges_to_flip' because it might have been re-added from a flip edges_to_flip.erase(hh); - next_edges_to_flip.erase(hh); next_edges_to_collapse.erase(hh); } @@ -1033,7 +1030,7 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, #ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA std::cout << "\t Flipping prevented: not the best diagonal" << std::endl; #endif - next_edges_to_flip.insert(h); + next_edges_to_collapse.insert(h); continue; } @@ -1042,7 +1039,7 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, #ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA std::cout << "\t Flipping prevented: rejected by user functor" << std::endl; #endif - next_edges_to_flip.insert(h); + next_edges_to_collapse.insert(h); continue; } @@ -1068,7 +1065,7 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, std::cout << "\t Unflippable edge!" << std::endl; #endif CGAL_assertion(!is_border(h, tmesh)); - next_edges_to_flip.insert(h); + next_edges_to_collapse.insert(h); } #ifdef CGAL_PMP_DEBUG_REMOVE_DEGENERACIES_EXTRA @@ -1085,7 +1082,6 @@ bool remove_almost_degenerate_faces(const FaceRange& face_range, return false; std::swap(edges_to_collapse, next_edges_to_collapse); - std::swap(edges_to_flip, next_edges_to_flip); } return false;