From ec1d43afbe2675b304c76c4e93fe8293d875bbf2 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 8 Nov 2024 16:11:11 +0100 Subject: [PATCH 1/4] add constrained vertices to pmap --- .../internal/Isotropic_remeshing/remesh_impl.h | 3 +++ 1 file changed, 3 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 9cdb76ac76b0..fea3be49dc86 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,6 +1025,9 @@ 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); From b8165f62de5d295d7da9fe613b40bf236afbec41 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 8 Nov 2024 16:57:42 +0100 Subject: [PATCH 2/4] add is_move_allowed(v) and use it in tangential_relaxation_impl() --- .../Isotropic_remeshing/remesh_impl.h | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 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 fea3be49dc86..7708f147f66f 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 @@ namespace internal { 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)); From 7462b70beceb4e4cd3d82b0c3a7a84060225c8fc Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 12 Nov 2024 14:01:30 +0100 Subject: [PATCH 3/4] remove unused --- .../internal/Isotropic_remeshing/remesh_impl.h | 1 - 1 file changed, 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 7708f147f66f..e66633b27163 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 @@ -1361,7 +1361,6 @@ namespace internal { if (is_constrained(v)) return false; - std::vector border_halfedges; for (halfedge_descriptor h : halfedges_around_target(v, mesh_)) { if (is_on_patch(h)) From 21e1ff113abef143cf33e37e7da26a8f46ae0ee8 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 18 Nov 2024 16:17:19 +0100 Subject: [PATCH 4/4] vertex is constrained if NOT allowed to move --- .../internal/Isotropic_remeshing/remesh_impl.h | 2 +- 1 file changed, 1 insertion(+), 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 e66633b27163..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,7 +1025,7 @@ namespace internal { // property map of constrained vertices for relaxation auto vertex_constraint = [&](const vertex_descriptor v) { - return is_move_allowed(v, relax_constraints); + return !is_move_allowed(v, relax_constraints); }; auto constrained_vertices_pmap = boost::make_function_property_map(vertex_constraint);