mirror of https://github.com/CGAL/cgal
Add sizing.at function to the PMPSizingField and other sizing classes
This commit is contained in:
parent
dc36eb88a7
commit
904c10016a
|
|
@ -31,6 +31,9 @@ typedef unspecified_type FT;
|
||||||
/// @name Functions
|
/// @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,
|
/// a function controlling edge split and edge collapse,
|
||||||
/// returning the ratio of the current edge length and the local target edge length between
|
/// 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.
|
/// 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;
|
const PolygonMesh& pmesh) const;
|
||||||
|
|
||||||
/// a function that updates the sizing field value at the vertex `v`.
|
/// 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);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FT get_sizing(const vertex_descriptor v) const
|
FT at(const vertex_descriptor v) const
|
||||||
{
|
{
|
||||||
CGAL_assertion(get(m_vertex_sizing_map, v));
|
CGAL_assertion(get(m_vertex_sizing_map, v));
|
||||||
return get(m_vertex_sizing_map, v);
|
return get(m_vertex_sizing_map, v);
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,8 @@ public:
|
||||||
* the input mesh.
|
* the input mesh.
|
||||||
*/
|
*/
|
||||||
Uniform_sizing_field<PolygonMesh, VPMap>(const FT size, const VPMap& vpmap)
|
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_sq_long( CGAL::square(4./3. * size))
|
||||||
, m_vpmap(vpmap)
|
, m_vpmap(vpmap)
|
||||||
{}
|
{}
|
||||||
|
|
@ -100,6 +101,11 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
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
|
std::optional<FT> is_too_long(const vertex_descriptor va, const vertex_descriptor vb) const
|
||||||
{
|
{
|
||||||
const FT sqlen = sqlength(va, vb);
|
const FT sqlen = sqlength(va, vb);
|
||||||
|
|
@ -130,6 +136,7 @@ public:
|
||||||
{}
|
{}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
const FT m_size;
|
||||||
const FT m_sq_short;
|
const FT m_sq_short;
|
||||||
const FT m_sq_long;
|
const FT m_sq_long;
|
||||||
const VPMap m_vpmap;
|
const VPMap m_vpmap;
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ public:
|
||||||
typedef typename K::FT FT;
|
typedef typename K::FT FT;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
virtual FT at(const vertex_descriptor v) const;
|
||||||
virtual std::optional<FT> is_too_long(const vertex_descriptor va,
|
virtual std::optional<FT> is_too_long(const vertex_descriptor va,
|
||||||
const vertex_descriptor vb) const = 0;
|
const vertex_descriptor vb) const = 0;
|
||||||
virtual std::optional<FT> is_too_short(const halfedge_descriptor h,
|
virtual std::optional<FT> is_too_short(const halfedge_descriptor 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 tri_area = gt_area(get(vpm, v), get(vpm, v1), get(vpm, v2));
|
||||||
const double face_weight = tri_area
|
const double face_weight = tri_area
|
||||||
/ (1. / 3. * (sizing.get_sizing(v)
|
/ (1. / 3. * (sizing.at(v)
|
||||||
+ sizing.get_sizing(v1)
|
+ sizing.at(v1)
|
||||||
+ sizing.get_sizing(v2)));
|
+ sizing.at(v2)));
|
||||||
weight += face_weight;
|
weight += face_weight;
|
||||||
|
|
||||||
const Point_3 centroid = gt_centroid(get(vpm, v), get(vpm, v1), get(vpm, v2));
|
const Point_3 centroid = gt_centroid(get(vpm, v), get(vpm, v1), get(vpm, v2));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue