From 7449372bd2b91a102df126b0497bce721088683f Mon Sep 17 00:00:00 2001 From: Dhruv-Sharma01 <121188299+Dhruv-Sharma01@users.noreply.github.com> Date: Mon, 3 Mar 2025 18:38:19 +0530 Subject: [PATCH] Update orient_polygon_soup.h --- .../CGAL/Polygon_mesh_processing/orient_polygon_soup.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orient_polygon_soup.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orient_polygon_soup.h index de2bcab9c1c9..582be8a1f984 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orient_polygon_soup.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/orient_polygon_soup.h @@ -388,20 +388,24 @@ struct Polygon_soup_orienter vertices_to_duplicate.back().second.push_back(other_p_id); } while(next!=neighbors[0]); - if (next==v_id){ - /// turn the otherway round + /// turn the other way round next = neighbors[0]; + V_ID last_next = next; // store the initial value do{ P_ID other_p_id; std::tie(next, other_p_id) = next_ccw_vertex_around_target(next, v_id, polygons, edges, marked_edges); if (next==v_id) break; + // If the new 'next' is the same as the previous one, break to avoid an infinite loop. + if (next == last_next) break; + last_next = next; visited_polygons.insert(other_p_id); if(nb_link_ccs != 1) vertices_to_duplicate.back().second.push_back(other_p_id); } while(true); } + if (nb_link_ccs != 1) visitor.link_connected_polygons(v_id, vertices_to_duplicate.back().second); }