|
Wildmeshing Toolkit
|
The Euclidean offset: Phi = d(p, input complex), level set d = delta. More...
#include <OffsetPotential.hpp>
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< SampleEnvelope > | m_envelope |
| std::shared_ptr< SimplicialComplexBVH > | m_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. |
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.
| 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.
| 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.
|
overridevirtual |
Diagnostic: what the field is made of at p, one contribution per line.
Implements wmtk::components::topological_offset::OffsetPotential< DIM >.
|
overridevirtual |
|
overridevirtual |
|
inlineoverridevirtual |
The Euclidean field: value() is the distance, so a distance residual is the plain one.
Reimplemented from wmtk::components::topological_offset::OffsetPotential< DIM >.
|
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 >.
|
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).
|
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 >.
|
overridevirtual |
|
inlineoverridevirtual |
Everywhere. d has no compact support.
Implements wmtk::components::topological_offset::OffsetPotential< DIM >.
|
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.