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

A quadric error metric (QEM), represented as a 4x4 matrix built from weighted plane samples. Adapted from https://github.com/wildmeshing/topological-offsets/blob/main/components/topological_offsets/wmtk/components/topological_offsets/internal/utils/Quadrics.hpp, stripped down to the plain linear-algebra core: sampling quadrics from a BVH and mesh attributes is left to the caller (see Smooth.cpp) instead of being built into this class. More...

#include <Quadrics.hpp>

Public Member Functions

 Quadrics (const double a, const double b, const double c, const double d)
 construct a quadric from the plane equation ax+by+cz+d=0
 
 Quadrics (const Vector3d &p0, const Vector3d &n)
 construct a quadric from a point on the plane and its normal
 
 Quadrics (const Eigen::Ref< const Matrix4d > &matrix)
 
 Quadrics (const Quadrics &other)=default
 
Quadricsoperator+= (const Quadrics &other)
 
Quadrics operator+ (const Quadrics &other) const
 
Quadrics operator* (const double scalar) const
 
Quadricsoperator*= (const double scalar)
 
Vector3d solve (const Eigen::Ref< const Vector3d > &p, double svd_threshold=1e-2) const
 solve for the position minimizing the quadric error, regularized toward p along directions the quadric leaves unconstrained (relevant for quadrics built from a single plane, whose A matrix is singular)
 
double squared_distance_to_optimum (const Eigen::Ref< const Vector3d > &p, double svd_threshold=1e-2) const
 

Private Attributes

Matrix4d m_matrix = Matrix4d::Zero()
 

Detailed Description

A quadric error metric (QEM), represented as a 4x4 matrix built from weighted plane samples. Adapted from https://github.com/wildmeshing/topological-offsets/blob/main/components/topological_offsets/wmtk/components/topological_offsets/internal/utils/Quadrics.hpp, stripped down to the plain linear-algebra core: sampling quadrics from a BVH and mesh attributes is left to the caller (see Smooth.cpp) instead of being built into this class.

Member Function Documentation

◆ solve()

Vector3d wmtk::components::topological_offset::Quadrics::solve ( const Eigen::Ref< const Vector3d > &  p,
double  svd_threshold = 1e-2 
) const

solve for the position minimizing the quadric error, regularized toward p along directions the quadric leaves unconstrained (relevant for quadrics built from a single plane, whose A matrix is singular)

Parameters
svd_thresholdsingular values of A below this (relative to the largest) are treated as zero, i.e. left unconstrained/regularized toward p. Controls sensitivity to feature edges: lower means less sensitive (more singular values are kept, pulling the result more strongly toward sharp features); see Eigen::JacobiSVD::setThreshold().

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