From 63076fa8b3bdc541e0311586c04415a7bbd04711 Mon Sep 17 00:00:00 2001 From: Dimitris Papavasiliou Date: Fri, 19 Aug 2022 18:18:36 +0300 Subject: [PATCH] Add `set_fixed_vertices()` to `Mean_curvature_flow_skeletonization` This allows manually fixing a range of vertices, preventing them from moving during contraction. Its main use is in cases where one is interested in the meso-skeleton and needs to keep part of it fixed. --- .../Mean_curvature_flow_skeletonization.h | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h b/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h index 13bbb522bc5..9c7ed064a3e 100644 --- a/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h +++ b/Surface_mesh_skeletonization/include/CGAL/Mean_curvature_flow_skeletonization.h @@ -513,6 +513,28 @@ public: m_omega_P = value; } + /// \cgalAdvancedFunction + /// \cgalAdvancedBegin + /// Fixes a range of vertices. Fixed vertices will not be moved + /// during contraction and this will therefore prevent convergence + /// towards the skeleton if `contract_until_convergence()` is used. + /// It is only useful if the object is to retrieve the meso-skeleton + /// after a number of `contract_geometry()`, keeping the specified + /// vertices fixed in place. + /// \cgalAdvancedEnd + template + void set_fixed_vertices(InputIterator begin, InputIterator end) + { + std::unordered_set set(begin, end); + + for(vertex_descriptor vd : vertices(m_tmesh)) + { + if (set.find(vd->vertices[0]) != set.end()) { + vd->is_fixed = true; + } + } + } + /// \cond SKIP_FROM_MANUAL void set_zero_TH(double value) {