Wildmeshing Toolkit
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
wmtk::components::topological_offset::EuclideanOffsetPotential< DIM > Class Template Reference

The Euclidean offset: Phi = d(p, input complex), level set d = delta. More...

#include <OffsetPotential.hpp>

Inheritance diagram for wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >:
wmtk::components::topological_offset::OffsetPotential< DIM >

Public Types

using VecD = typename OffsetPotential< DIM >::VecD
 
using MatD = typename OffsetPotential< DIM >::MatD
 
- Public Types inherited from wmtk::components::topological_offset::OffsetPotential< DIM >
using VecD = Eigen::Matrix< double, DIM, 1 >
 
using MatD = Eigen::Matrix< double, DIM, DIM >
 

Public Member Functions

bool is_euclidean () const override
 The Euclidean field: value() is the distance, so a distance residual is the plain one.
 
 EuclideanOffsetPotential (const std::shared_ptr< SampleEnvelope > &envelope, double delta)
 Build over an exact-kind envelope of the input complex. The 3D path.
 
 EuclideanOffsetPotential (const std::shared_ptr< SimplicialComplexBVH > &bvh, double delta)
 Build over the input-complex BVH. The 2D path, and 2D-only – checked at runtime, because a static_assert would fire under the explicit template instantiation.
 
double value (const VecD &p) const override
 
VecD gradient (const VecD &p) const override
 
MatD hessian (const VecD &p) const override
 
double residual_length (const VecD &p) const override
 
bool within_support (const VecD &p) const override
 Everywhere. d has no compact support.
 
bool is_inside_offset (const VecD &p) const override
 
std::string describe_active (const VecD &p) const override
 Diagnostic: what the field is made of at p, one contribution per line.
 
- Public Member Functions inherited from wmtk::components::topological_offset::OffsetPotential< DIM >
virtual ~OffsetPotential ()
 
double target_level () const
 The level value the offset boundary is placed on.
 
double delta () const
 The offset distance the field is calibrated to.
 
double dhat () const
 
double level_set_slope () const
 |d(field)/d(distance)| at the level set on a flat stretch of input.
 

Private Member Functions

void nearest_feature (const VecD &p, VecD &foot, int &dim, VecD &dir) const
 

Private Attributes

std::shared_ptr< SampleEnvelopem_envelope
 
std::shared_ptr< SimplicialComplexBVHm_bvh
 

Additional Inherited Members

- Protected Member Functions inherited from wmtk::components::topological_offset::OffsetPotential< DIM >
 OffsetPotential (const double delta, const double dhat)
 
- Protected Attributes inherited from wmtk::components::topological_offset::OffsetPotential< DIM >
double m_delta = 0.
 
double m_dhat = 0.
 
double m_c = 0.
 
double m_grad_ref = 1.
 

Detailed Description

template<int DIM>
class wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >

The Euclidean offset: Phi = d(p, input complex), level set d = delta.

The exact offset, in exchange for smoothness. Within each closest-feature region the distance to a piecewise-linear complex is smooth and its derivatives are exact and cheap; across a region boundary – the medial axis – the gradient is discontinuous, and at a reentrant feature the offset has a crease no refinement resolves. That is the trade, not a defect of this class.

Derivatives are transcribed from wmtk::optimization::ExactDistanceEnergy2D/3D rather than re-derived. That class gives the Hessian of d^2 by feature kind, this one needs the Hessian of d, and grad^2(d^2) = 2 (grad d grad d^T + d grad^2 d) relates them; with u = (p - n)/d:

feature            their grad^2(d^2) / 2      this class's grad^2 d
face interior      n n^T                      0                          (d is linear)
edge interior      I - t t^T                  (I - t t^T - u u^T) / d
vertex             I                          (I - u u^T) / d

with the 2D cases the same statement one dimension down (segment interior -> 0, corner -> (I - u u^T)/d). OffsetEnergy needs nothing else: it composes w (Phi - c)^2 from value, gradient and Hessian by the chain rule.

An isolated input point is a degenerate segment, not a special primitive: SimplicialComplexBVH and the envelope both carry it as the pseudo-edge (i, i), so a query near one comes back as an edge-interior hit with an undefined direction and must be demoted to the vertex case.

No support limit: d is defined and informative everywhere, so within_support() is always true and dhat() is reported as infinity rather than as a large finite number.

Constructor & Destructor Documentation

◆ EuclideanOffsetPotential() [1/2]

template<int DIM>
wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >::EuclideanOffsetPotential ( const std::shared_ptr< SampleEnvelope > &  envelope,
double  delta 
)

Build over an exact-kind envelope of the input complex. The 3D path.

The envelope is the query engine here, not a tolerance: nearest_point_feature() supplies the foot point and the feature kind the derivatives are cased on, and only the exact kind answers it. Its eps is irrelevant and no containment test is run against it.

◆ EuclideanOffsetPotential() [2/2]

template<int DIM>
wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >::EuclideanOffsetPotential ( const std::shared_ptr< SimplicialComplexBVH > &  bvh,
double  delta 
)

Build over the input-complex BVH. The 2D path, and 2D-only – checked at runtime, because a static_assert would fire under the explicit template instantiation.

value() and nearest_feature() both go through the BVH's feature query, i.e. the distance to the complex's curve (its edge set), which for a solid complex is its boundary and never the solid's own zero interior. Containment of the input complex is not this object's business; the per-tag region envelopes hold it.

Member Function Documentation

◆ describe_active()

template<int DIM>
std::string wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >::describe_active ( const VecD &  p) const
overridevirtual

Diagnostic: what the field is made of at p, one contribution per line.

Implements wmtk::components::topological_offset::OffsetPotential< DIM >.

◆ gradient()

template<int DIM>
EuclideanOffsetPotential< DIM >::VecD wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >::gradient ( const VecD &  p) const
overridevirtual

◆ hessian()

template<int DIM>
EuclideanOffsetPotential< DIM >::MatD wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >::hessian ( const VecD &  p) const
overridevirtual

◆ is_euclidean()

template<int DIM>
bool wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >::is_euclidean ( ) const
inlineoverridevirtual

The Euclidean field: value() is the distance, so a distance residual is the plain one.

Reimplemented from wmtk::components::topological_offset::OffsetPotential< DIM >.

◆ is_inside_offset()

template<int DIM>
bool wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >::is_inside_offset ( const VecD &  p) const
inlineoverridevirtual

d increases with distance, so the offset region is where it is still below the level – the opposite sense to the smooth potential. See the base class.

Implements wmtk::components::topological_offset::OffsetPotential< DIM >.

◆ nearest_feature()

template<int DIM>
void wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >::nearest_feature ( const VecD &  p,
VecD &  foot,
int &  dim,
VecD &  dir 
) const
private

The foot point, feature kind and direction at p, with the degenerate-segment demotion already applied. dim is 2 (face interior), 1 (edge interior) or 0 (vertex).

◆ residual_length()

template<int DIM>
double wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >::residual_length ( const VecD &  p) const
inlineoverridevirtual

Exact, not first-order: the level set is d = delta, so the distance to it is |d - delta|. value() is d / delta (see the constructors), so dividing by the slope returns length units.

Implements wmtk::components::topological_offset::OffsetPotential< DIM >.

◆ value()

template<int DIM>
double wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >::value ( const VecD &  p) const
overridevirtual

◆ within_support()

template<int DIM>
bool wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >::within_support ( const VecD &  p) const
inlineoverridevirtual

Everywhere. d has no compact support.

Implements wmtk::components::topological_offset::OffsetPotential< DIM >.

Member Data Documentation

◆ m_envelope

template<int DIM>
std::shared_ptr<SampleEnvelope> wmtk::components::topological_offset::EuclideanOffsetPotential< DIM >::m_envelope
private

Exactly one of these is set, by whichever constructor ran: the envelope by the 3D path, the BVH by the 2D path. Every query branches on m_bvh.


The documentation for this class was generated from the following files: