From 70c9b5e0a5d146236292a03b3d1a82713a5ffbbd Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 5 May 2017 17:37:49 +0200 Subject: [PATCH 1/2] constrain corners vertices that are at the "corner" of the face range to be remeshed, i.e. on the border of the face range, and also on the border of the mesh, incident to both the selected and unselected faces, should be constrained, to avoid making a "axe blow" in the border --- .../Isotropic_remeshing/remesh_impl.h | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) 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 ce6d22ab46a..369e4ae9978 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 @@ -303,6 +303,8 @@ namespace internal { { tag_halfedges_status(face_range); //called first + constrain_patch_corners(face_range); + BOOST_FOREACH(face_descriptor f, face_range) { input_triangles_.push_back(triangle(f)); @@ -1372,6 +1374,43 @@ private: return PMP::compute_face_normal(f, mesh_); } + template + void constrain_patch_corners(const FaceRange& face_range) + { + std::set visited; + + BOOST_FOREACH(face_descriptor f, face_range) + { + BOOST_FOREACH(halfedge_descriptor h, + halfedges_around_face(halfedge(f, mesh_), mesh_)) + { + vertex_descriptor vt = target(h, mesh_); + //treat target(h, mesh_) + if (visited.find(vt) != visited.end()) + continue;//already treated + + if (status(h) == PATCH)//h not on patch boundary + continue; //so neither is target(h, mesh_) + + //count incident MESH_BORDER edges + unsigned int nb_incident_borders = 0; + BOOST_FOREACH(halfedge_descriptor hv, + halfedges_around_target(h, mesh_)) + { + CGAL_assertion(vt == target(hv, mesh_)); + if ( (status(hv) == PATCH_BORDER && status(opposite(hv, mesh_)) == MESH_BORDER) + || (status(hv) == MESH_BORDER && status(opposite(hv, mesh_)) == PATCH_BORDER)) + nb_incident_borders++; + } + + if (nb_incident_borders == 1) //this is a special corner + set_constrained(vt, true); + + visited.insert(vt); + } + } + } + template void tag_halfedges_status(const FaceRange& face_range) { From ce51fef0d55af56042de2b5e21f0bf6d404a56c0 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 9 May 2017 12:23:17 +0200 Subject: [PATCH 2/2] replace std::set with boost::container::flat_set for efficiency reasons --- .../internal/Isotropic_remeshing/remesh_impl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 369e4ae9978..705ba2adc58 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 @@ -48,6 +48,7 @@ #include #include #include +#include #include #include @@ -1377,7 +1378,7 @@ private: template void constrain_patch_corners(const FaceRange& face_range) { - std::set visited; + boost::container::flat_set visited; BOOST_FOREACH(face_descriptor f, face_range) {