From 80fd8759dd59299f0237fea1ed2110f957c0a096 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 14 Mar 2024 16:40:28 +0100 Subject: [PATCH] avoid insertion of points inside protecting balls, during initialization step --- Mesh_3/include/CGAL/make_mesh_3.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Mesh_3/include/CGAL/make_mesh_3.h b/Mesh_3/include/CGAL/make_mesh_3.h index 79277f1643f..840daf29d07 100644 --- a/Mesh_3/include/CGAL/make_mesh_3.h +++ b/Mesh_3/include/CGAL/make_mesh_3.h @@ -45,9 +45,11 @@ init_c3t3(C3T3& c3t3, const MeshDomain& domain, const MeshCriteria&, { typedef typename MeshDomain::Point_3 Point_3; typedef typename MeshDomain::Index Index; - typedef std::vector > Initial_points_vector; + typedef typename std::pair PI; + typedef std::vector Initial_points_vector; typedef typename Initial_points_vector::iterator Ipv_iterator; typedef typename C3T3::Vertex_handle Vertex_handle; + typedef CGAL::Mesh_3::Triangulation_helpers Th; // Mesh initialization : get some points and add them to the mesh Initial_points_vector initial_points; @@ -61,17 +63,19 @@ init_c3t3(C3T3& c3t3, const MeshDomain& domain, const MeshCriteria&, c3t3.triangulation().geom_traits().construct_weighted_point_3_object(); // Insert points and set their index and dimension - for ( Ipv_iterator it = initial_points.begin() ; - it != initial_points.end() ; - ++it ) + const Vertex_handle vhint = c3t3.triangulation().finite_vertices_begin(); + for (const PI& pi : initial_points) { - Vertex_handle v = c3t3.triangulation().insert(cwp(it->first)); + if(Th().inside_protecting_balls(c3t3.triangulation(), vhint, pi.first)) + continue; + + Vertex_handle v = c3t3.triangulation().insert(cwp(pi.first)); // v could be null if point is hidden if ( v != Vertex_handle() ) { c3t3.set_dimension(v,2); // by construction, points are on surface - c3t3.set_index(v,it->second); + c3t3.set_index(v, pi.second); } } }