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 fea3be49dc8..7708f147f66 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,18 +1025,7 @@ namespace internal { // property map of constrained vertices for relaxation auto vertex_constraint = [&](const vertex_descriptor v) { - if (is_constrained(v)) - return true; - - 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); @@ -1367,6 +1356,24 @@ private: return true; } + bool is_move_allowed(const vertex_descriptor v, const bool relax_constraints) const + { + if (is_constrained(v)) + return false; + + std::vector border_halfedges; + 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));