Wildmeshing Toolkit
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Attributes | List of all members
wmtk::components::topological_offset::AlignEnergy2D Class Reference

First-order offset term: each front edge at the vertex against the field. More...

#include <OffsetPotential.hpp>

Inheritance diagram for wmtk::components::topological_offset::AlignEnergy2D:

Classes

struct  Edge
 

Public Member Functions

 AlignEnergy2D (const std::shared_ptr< const OffsetPotential2D > &potential, std::vector< Edge > edges, double outward_sign, double weight)
 
void residual (const Eigen::Vector2d &x, const Edge &e, double &r, Eigen::Vector2d &J) const
 r_e and its derivative for one edge; r = 0 with J = 0 where grad Phi vanishes.
 
double value (const TVector &x) override
 
void gradient (const TVector &x, TVector &gradv) override
 
void hessian (const TVector &x, THessian &hessian) override
 
void hessian (const TVector &x, MatrixXd &hessian) override
 
void solution_changed (const TVector &new_x) override
 

Private Attributes

std::shared_ptr< const OffsetPotential2Dm_potential
 
std::vector< Edgem_edges
 
double m_sign
 
double m_weight
 

Detailed Description

First-order offset term: each front edge at the vertex against the field.

E(x) = w * sum over the vertex's incident front edges e of (1 - n_e(x) . g(m_e(x)))^2

n_e(x) = sigma_e R90 (q_e - x) / |q_e - x| is the edge's outward unit normal (q_e the other endpoint, fixed; sigma_e = +-1 chosen at construction so the normal points away from the band), g(m) = s grad Phi(m) / |grad Phi(m)| the field's outward unit direction at the edge midpoint m_e = (x + q_e) / 2 (s = -1 for the smooth potential, larger inside; +1 for the Euclidean distance). It is the orientation criterion's quantity as an energy: zero when the edge lies along the level set, 4 w per edge when it points the wrong way.

Both dependences on x are differentiated: the edge's rotation (d n_e / dx, exact) and the field's turning (d g / dx through the potential's Hessian). Do not re-add a vertex normal frozen for the visit; measured worse – see git history of this file. The term's own Hessian would need the third derivative of Phi, so its block is the Gauss-Newton 2 w sum J_e J_e^T, the same choice OffsetEnergy makes.


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