Add sizing.at function to the PMPSizingField and other sizing classes

This commit is contained in:
Ivan Pađen 2023-10-10 19:34:46 -06:00
parent dc36eb88a7
commit 904c10016a
5 changed files with 18 additions and 6 deletions

View File

@ -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);
/// @}
};

View File

@ -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);

View File

@ -68,7 +68,8 @@ public:
* the input mesh.
*/
Uniform_sizing_field<PolygonMesh, VPMap>(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<FT> 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;

View File

@ -60,6 +60,7 @@ public:
typedef typename K::FT FT;
public:
virtual FT at(const vertex_descriptor v) const;
virtual std::optional<FT> is_too_long(const vertex_descriptor va,
const vertex_descriptor vb) const = 0;
virtual std::optional<FT> is_too_short(const halfedge_descriptor h,

View File

@ -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));