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

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

#include <sphereFit.h>

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

Public Types

using Scalar = typename DataPoint::Scalar
 Alias to scalar type.
 
using VectorType = typename Base::VectorType
 Alias to vector type.
 
using WFunctor = typename Base::WFunctor
 Alias to weight function.
 
using Solver = Eigen::EigenSolver< MatrixA >
 

Public Member Functions

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

Protected Types

enum  { Check = Base::PROVIDES_ALGEBRAIC_SPHERE }
 
using Base = T
 Base class of the procedure.
 
typedef Eigen::Matrix< Scalar, DataPoint::Dim+2, 1 > VectorA
 
typedef Eigen::Matrix< Scalar, DataPoint::Dim+2, DataPoint::Dim+2 > MatrixA
 

Protected Attributes

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

Detailed Description

template<class DataPoint, class _WFunctor, typename T>
class Ponca::SphereFitImpl< DataPoint, _WFunctor, T >

Algebraic Sphere fitting procedure on point set without normals.

This method published in [6] 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 56 of file sphereFit.h.

Member Typedef Documentation

◆ Base

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

Base class of the procedure.

Definition at line 58 of file sphereFit.h.

◆ MatrixA

template<class DataPoint , class _WFunctor , typename T >
typedef Eigen::Matrix<Scalar, DataPoint::Dim+2, DataPoint::Dim+2> Ponca::SphereFitImpl< DataPoint, _WFunctor, T >::MatrixA
protected

Definition at line 67 of file sphereFit.h.

◆ Scalar

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

Alias to scalar type.

Definition at line 58 of file sphereFit.h.

◆ Solver

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

Definition at line 70 of file sphereFit.h.

◆ VectorA

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

Definition at line 66 of file sphereFit.h.

◆ VectorType

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

Alias to vector type.

Definition at line 58 of file sphereFit.h.

◆ WFunctor

template<class DataPoint , class _WFunctor , typename T >
using Ponca::SphereFitImpl< DataPoint, _WFunctor, T >::WFunctor = typename Base::WFunctor

Alias to weight function.

Definition at line 58 of file sphereFit.h.

Member Enumeration Documentation

◆ anonymous enum

template<class DataPoint , class _WFunctor , typename T >
anonymous enum
protected

Definition at line 61 of file sphereFit.h.

Member Function Documentation

◆ addLocalNeighbor()

template<class DataPoint , class _WFunctor , typename T >
bool SphereFitImpl::addLocalNeighbor ( Scalar  w,
const VectorType localQ,
const DataPoint &  attributes 
)
inline

Add a neighbor to perform the fit.

Returns
false if param nei is not a valid neighbour (weight = 0)

Definition at line 18 of file sphereFit.hpp.

◆ finalize()

template<class DataPoint , class _WFunctor , typename T >
FIT_RESULT SphereFitImpl::finalize ( )
inline

Finalize the procedure.

Returns
Fitting Status
Warning
Must be called be for any use of the fitting output

Definition at line 41 of file sphereFit.hpp.

◆ init()

template<class DataPoint , class _WFunctor , typename T >
void SphereFitImpl::init ( const VectorType _evalPos)
inline

Set the evaluation position and reset the internal states.

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

Definition at line 10 of file sphereFit.hpp.

◆ isSigned()

template<class DataPoint , class _WFunctor , typename T >
constexpr bool Ponca::SphereFitImpl< DataPoint, _WFunctor, 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 _WFunctor , typename T >
const Solver & Ponca::SphereFitImpl< DataPoint, _WFunctor, T >::solver ( ) const
inline

Definition at line 83 of file sphereFit.h.

◆ sphereFit() [1/2]

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

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

Definition at line 79 of file sphereFit.h.

◆ sphereFit() [2/2]

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

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

Definition at line 79 of file sphereFit.h.

Member Data Documentation

◆ m_matA

template<class DataPoint , class _WFunctor , typename T >
MatrixA Ponca::SphereFitImpl< DataPoint, _WFunctor, 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 _WFunctor , typename T >
Solver Ponca::SphereFitImpl< DataPoint, _WFunctor, T >::m_solver
protected

Definition at line 76 of file sphereFit.h.