Ponca  2cfe00173bb12dda99e12b2b48a0e1f683bc5cdd
Point Cloud Analysis library
Loading...
Searching...
No Matches
Ponca::SphereFitImpl< DataPoint, _NFilter, T > Class Template Reference

Algebraic Sphere fitting procedure on point set without normals. More...

#include <sphereFit.h>

Inheritance diagram for Ponca::SphereFitImpl< DataPoint, _NFilter, T >:
Collaboration diagram for Ponca::SphereFitImpl< DataPoint, _NFilter, T >:

Public Types

using Scalar = typename DataPoint::Scalar
 Alias to scalar type.
using VectorType = typename Base::VectorType
 Alias to vector type.
using NeighborFilter = typename Base::NeighborFilter
 Alias to the filter applied on the neighbors.
using Solver = Eigen::EigenSolver<MatrixA>

Public Member Functions

SphereFitImpl< DataPoint, _NFilter, T > & sphereFit ()
 Explicit conversion to CLASSNAME, to access methods potentially hidden by heritage.
const SphereFitImpl< DataPoint, _NFilter, T > & sphereFit () const
 Explicit conversion to CLASSNAME, to access methods potentially hidden by heritage.
void init ()
 Set the evaluation position and reset the internal states.
void addLocalNeighbor (Scalar w, const VectorType &localQ, const DataPoint &attributes)
 Add a neighbor to perform the fit.
FIT_RESULT finalize ()
constexpr bool isSigned ()
 Is scalar field signed.
const Solver & solver () const

Protected Types

using Base = T
 Base class of the procedure.
using VectorA = Eigen::Matrix<Scalar, DataPoint::Dim + 2, 1>
using MatrixA = Eigen::Matrix<Scalar, DataPoint::Dim + 2, DataPoint::Dim + 2>

Protected Attributes

MatrixA m_matA {MatrixA::Zero()}
 Covariance matrix of [1, p, p^2].
Solver m_solver

Detailed Description

template<class DataPoint, class _NFilter, typename T>
requires ProvidesAlgebraicSphere<T>
class Ponca::SphereFitImpl< DataPoint, _NFilter, T >

Algebraic Sphere fitting procedure on point set without normals.

This method published in [9] minimizes

\[ \mathcal{L}(\mathbf{u}) = \frac{1}{2} \sum_i w_i f_{\mathbf{u}}(\mathbf{x}_i)^2 = \frac{1}{2} \mathbf{u}^T A \mathbf{u} \]

with \( A = \sum_i w_i \tilde{\mathbf{x}_i} \tilde{\mathbf{x}_i}^T\) and \( f_{\mathbf{u}} \) the algebraic sphere defined by

\[ f_{\mathbf{u}}(\mathbf{x}) = u_c + \mathbf{u}_l.\mathbf{x} + u_q \mathbf{x}.\mathbf{x} = \begin{bmatrix} 1 & \mathbf{x}^T & \mathbf{x}.\mathbf{x} \end{bmatrix} \begin{bmatrix} u_c \\ u_l \\ u_q \end{bmatrix} = \tilde{\mathbf{x}}^T \mathbf{u}, \]

under the constraint (unitary gradient onto the surface)

\[ \|\mathbf{u}_l\|^2 - 4 u_c u_q = \mathbf{u}^T C \mathbf{u} = 1 \]

where

\[ C = \begin{bmatrix} 0 & & & & -2 \\ & 1 & & & \\ & & \ddots & & \\ & & & 1 & \\ -2 & & & & 0 \end{bmatrix} \]

which amounts to solve the generalized eigenvalue problem \( A\mathbf{u} = \lambda C \mathbf{u} \).

See also
AlgebraicSphere

Definition at line 62 of file sphereFit.h.

Member Typedef Documentation

◆ Base

template<class DataPoint, class _NFilter, typename T>
using Ponca::SphereFitImpl< DataPoint, _NFilter, T >::Base = T
protected

Base class of the procedure.

Definition at line 64 of file sphereFit.h.

◆ MatrixA

template<class DataPoint, class _NFilter, typename T>
using Ponca::SphereFitImpl< DataPoint, _NFilter, T >::MatrixA = Eigen::Matrix<Scalar, DataPoint::Dim + 2, DataPoint::Dim + 2>
protected

Definition at line 67 of file sphereFit.h.

◆ NeighborFilter

template<class DataPoint, class _NFilter, typename T>
using Ponca::SphereFitImpl< DataPoint, _NFilter, T >::NeighborFilter = typename Base::NeighborFilter

Alias to the filter applied on the neighbors.

Definition at line 64 of file sphereFit.h.

◆ Scalar

template<class DataPoint, class _NFilter, typename T>
using Ponca::SphereFitImpl< DataPoint, _NFilter, T >::Scalar = typename DataPoint::Scalar

Alias to scalar type.

Definition at line 64 of file sphereFit.h.

◆ Solver

template<class DataPoint, class _NFilter, typename T>
using Ponca::SphereFitImpl< DataPoint, _NFilter, T >::Solver = Eigen::EigenSolver<MatrixA>

Definition at line 70 of file sphereFit.h.

◆ VectorA

template<class DataPoint, class _NFilter, typename T>
using Ponca::SphereFitImpl< DataPoint, _NFilter, T >::VectorA = Eigen::Matrix<Scalar, DataPoint::Dim + 2, 1>
protected

Definition at line 66 of file sphereFit.h.

◆ VectorType

template<class DataPoint, class _NFilter, typename T>
using Ponca::SphereFitImpl< DataPoint, _NFilter, T >::VectorType = typename Base::VectorType

Alias to vector type.

Definition at line 64 of file sphereFit.h.

Member Function Documentation

◆ addLocalNeighbor()

template<class DataPoint, class _NFilter, typename T>
requires ProvidesAlgebraicSphere<T>
void SphereFitImpl::addLocalNeighbor ( Scalar w,
const VectorType & localQ,
const DataPoint & attributes )
inline

Add a neighbor to perform the fit.

Definition at line 18 of file sphereFit.h.

◆ finalize()

template<class DataPoint, class _NFilter, typename T>
requires ProvidesAlgebraicSphere<T>
FIT_RESULT SphereFitImpl::finalize ( )
inline

Definition at line 35 of file sphereFit.h.

◆ init()

template<class DataPoint, class _NFilter, typename T>
requires ProvidesAlgebraicSphere<T>
void SphereFitImpl::init ( )
inline

Set the evaluation position and reset the internal states.

Warning
Must be called be for any computation (but * after #setNeighborFilter)

Definition at line 10 of file sphereFit.h.

◆ isSigned()

template<class DataPoint, class _NFilter, typename T>
bool Ponca::SphereFitImpl< DataPoint, _NFilter, T >::isSigned ( )
inlineconstexpr

Is scalar field signed.

If not, the method the sign of potential() must be ignored

Definition at line 81 of file sphereFit.h.

◆ solver()

template<class DataPoint, class _NFilter, typename T>
const Solver & Ponca::SphereFitImpl< DataPoint, _NFilter, T >::solver ( ) const
inline

Definition at line 83 of file sphereFit.h.

◆ sphereFit() [1/2]

template<class DataPoint, class _NFilter, typename T>
SphereFitImpl< DataPoint, _NFilter, T > & Ponca::SphereFitImpl< DataPoint, _NFilter, T >::sphereFit ( )
inline

Explicit conversion to CLASSNAME, to access methods potentially hidden by heritage.

Definition at line 79 of file sphereFit.h.

◆ sphereFit() [2/2]

template<class DataPoint, class _NFilter, typename T>
const SphereFitImpl< DataPoint, _NFilter, T > & Ponca::SphereFitImpl< DataPoint, _NFilter, T >::sphereFit ( ) const
inline

Explicit conversion to CLASSNAME, to access methods potentially hidden by heritage.

Definition at line 79 of file sphereFit.h.

Member Data Documentation

◆ m_matA

template<class DataPoint, class _NFilter, typename T>
MatrixA Ponca::SphereFitImpl< DataPoint, _NFilter, T >::m_matA {MatrixA::Zero()}
protected

Covariance matrix of [1, p, p^2].

Definition at line 74 of file sphereFit.h.

◆ m_solver

template<class DataPoint, class _NFilter, typename T>
Solver Ponca::SphereFitImpl< DataPoint, _NFilter, T >::m_solver
protected

Definition at line 76 of file sphereFit.h.