From d61cf58f2fc382c972f9f43ca60723218127d89a Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 13 Apr 2021 15:19:53 +0200 Subject: [PATCH] add ISOLATED_CONSTRAINT halfedge status this type is needed for edges that are part of the input constrained edges property map, and are incident to a face to be remeshed only by a vertex. These edges contribute to creating corner vertices (incident to >= 3 constrained edges), but should still not be considered as patch borders without dealing with these "isolated constraints", the corner vertices that are incident to 2 patch borders and 1 of these edges was not considered as a corner but as a simple patch border vertex, hence it could be moved/deleted by a collapse or relaxation steps --- .../Isotropic_remeshing/remesh_impl.h | 41 +++++++++++++++++-- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index 423d07ecb0a..a14b697ebd8 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -77,7 +77,8 @@ namespace internal { PATCH, //h and hopp belong to the patch to be remeshed PATCH_BORDER,//h belongs to the patch, hopp is MESH MESH, //h and hopp belong to the mesh, not the patch - MESH_BORDER //h belongs to the mesh, face(hopp, pmesh) == null_face() + MESH_BORDER, //h belongs to the mesh, face(hopp, pmesh) == null_face() + ISOLATED_CONSTRAINT //h is constrained, and incident to faces that do not belong to a patch }; // A property map @@ -1472,7 +1473,8 @@ private: { halfedge_descriptor hopp = opposite(h, mesh_); if ( is_on_border(h) || is_on_patch_border(h) - || is_on_border(hopp) || is_on_patch_border(hopp)) + || is_on_border(hopp) || is_on_patch_border(hopp) + || is_an_isolated_constraint(h)) ++nb_incident_features; if (nb_incident_features > 2) return true; @@ -1538,19 +1540,43 @@ private: { //deal with h and hopp for borders that are sharp edges to be preserved halfedge_descriptor h = halfedge(e, mesh_); - if (status(h) == PATCH){ + Halfedge_status hs = status(h); + if (hs == PATCH) { set_status(h, PATCH_BORDER); + hs = PATCH_BORDER; has_border_ = true; } halfedge_descriptor hopp = opposite(h, mesh_); - if (status(hopp) == PATCH){ + Halfedge_status hsopp = status(hopp); + if (hsopp == PATCH) { set_status(hopp, PATCH_BORDER); + hsopp = PATCH_BORDER; has_border_ = true; } + + if (hs != PATCH_BORDER && hsopp != PATCH_BORDER) + { + set_status(h, ISOLATED_CONSTRAINT); + set_status(hopp, ISOLATED_CONSTRAINT); + } } } } + + std::ofstream ofs("dump_isolated.polylines.txt"); + for (edge_descriptor e : edges(mesh_)) + { + halfedge_descriptor h = halfedge(e, mesh_); + if (status(h) == ISOLATED_CONSTRAINT) + { + CGAL_assertion(status(opposite(h, mesh_)) == ISOLATED_CONSTRAINT); + ofs << "2 " << get(vpmap_, target(h, mesh_)) + << " " << get(vpmap_, source(h, mesh_)) << std::endl; + } + } + ofs.close(); + } Halfedge_status status(const halfedge_descriptor& h) const @@ -1821,6 +1847,13 @@ public: return status(h) == MESH; } + bool is_an_isolated_constraint(const halfedge_descriptor& h) const + { + bool res = (status(h) == ISOLATED_CONSTRAINT); + CGAL_assertion(!res || status(opposite(h, mesh_)) == ISOLATED_CONSTRAINT); + return res; + } + private: void halfedge_added(const halfedge_descriptor& h, const Halfedge_status& s)