diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPSizingField.h b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPSizingField.h index 5b90dddfbc9..d672f19bb06 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPSizingField.h +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPSizingField.h @@ -31,6 +31,9 @@ typedef unspecified_type FT; /// @name Functions /// @{ +/// a function that returns the sizing value at `v`. +FT at(const vertex_descriptor v) const; + /// a function controlling edge split and edge collapse, /// returning the ratio of the current edge length and the local target edge length between /// the points of `va` and `vb` in case the current edge is too long, and `std::nullopt` otherwise. @@ -47,7 +50,8 @@ Point_3 split_placement(const halfedge_descriptor h, const PolygonMesh& pmesh) const; /// a function that updates the sizing field value at the vertex `v`. -void update(const vertex_descriptor v, const PolygonMesh& pmesh); +void update(const vertex_descriptor v, + const PolygonMesh& pmesh); /// @} }; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/Adaptive_sizing_field.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/Adaptive_sizing_field.h index 91e04160d11..cf46db6d919 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/Adaptive_sizing_field.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/Adaptive_sizing_field.h @@ -214,7 +214,7 @@ private: } public: - FT get_sizing(const vertex_descriptor v) const + FT at(const vertex_descriptor v) const { CGAL_assertion(get(m_vertex_sizing_map, v)); return get(m_vertex_sizing_map, v); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/Uniform_sizing_field.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/Uniform_sizing_field.h index d73b318f8c1..00ea4a39dcb 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/Uniform_sizing_field.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/Uniform_sizing_field.h @@ -68,7 +68,8 @@ public: * the input mesh. */ Uniform_sizing_field(const FT size, const VPMap& vpmap) - : m_sq_short( CGAL::square(4./5. * size)) + : m_size(size) + , m_sq_short( CGAL::square(4./5. * size)) , m_sq_long( CGAL::square(4./3. * size)) , m_vpmap(vpmap) {} @@ -100,6 +101,11 @@ private: } public: + FT at(const vertex_descriptor /* v */) const + { + return m_size; + } + std::optional is_too_long(const vertex_descriptor va, const vertex_descriptor vb) const { const FT sqlen = sqlength(va, vb); @@ -130,6 +136,7 @@ public: {} private: + const FT m_size; const FT m_sq_short; const FT m_sq_long; const VPMap m_vpmap; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Sizing_field_base.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Sizing_field_base.h index 3835f180358..1f70c251aca 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Sizing_field_base.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Sizing_field_base.h @@ -60,6 +60,7 @@ public: typedef typename K::FT FT; public: + virtual FT at(const vertex_descriptor v) const; virtual std::optional is_too_long(const vertex_descriptor va, const vertex_descriptor vb) const = 0; virtual std::optional is_too_short(const halfedge_descriptor h, diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/tangential_relaxation.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/tangential_relaxation.h index 83fdd5ff37f..6693524324a 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/tangential_relaxation.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/tangential_relaxation.h @@ -288,9 +288,9 @@ void tangential_relaxation(const VertexRange& vertices, const double tri_area = gt_area(get(vpm, v), get(vpm, v1), get(vpm, v2)); const double face_weight = tri_area - / (1. / 3. * (sizing.get_sizing(v) - + sizing.get_sizing(v1) - + sizing.get_sizing(v2))); + / (1. / 3. * (sizing.at(v) + + sizing.at(v1) + + sizing.at(v2))); weight += face_weight; const Point_3 centroid = gt_centroid(get(vpm, v), get(vpm, v1), get(vpm, v2));