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 9cdb76ac76b0..a31aacd52d97 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 @@ -1025,15 +1025,7 @@ namespace internal { // property map of constrained vertices for relaxation auto vertex_constraint = [&](const vertex_descriptor v) { - for (halfedge_descriptor h : halfedges_around_target(v, mesh_)) - { - Halfedge_status s = status(h); - if ( s == PATCH - || s == PATCH_BORDER - || status(opposite(h, mesh_)) == PATCH_BORDER) - return false; - } - return true; + return !is_move_allowed(v, relax_constraints); }; auto constrained_vertices_pmap = boost::make_function_property_map(vertex_constraint); @@ -1364,6 +1356,23 @@ namespace internal { return true; } + bool is_move_allowed(const vertex_descriptor v, const bool relax_constraints) const + { + if (is_constrained(v)) + return false; + + for (halfedge_descriptor h : halfedges_around_target(v, mesh_)) + { + if (is_on_patch(h)) + continue; + else if (is_on_patch_border(h) && relax_constraints) + continue; + else + return false; + } + return true; + } + halfedge_descriptor next_on_patch_border(const halfedge_descriptor& h) const { CGAL_precondition(is_on_patch_border(h));