Ponca  aa50bfdf187919869239c5b44b748842569114c1
Point Cloud Analysis library
Loading...
Searching...
No Matches
Ponca::MeanPositionDer< DataPoint, _WFunctor, DiffType, T > Class Template Reference
+ Inheritance diagram for Ponca::MeanPositionDer< DataPoint, _WFunctor, DiffType, T >:
+ Collaboration diagram for Ponca::MeanPositionDer< DataPoint, _WFunctor, DiffType, 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 ScalarArray = typename Base::ScalarArray
 Alias to scalar derivatives array.
 
using VectorArray = typename Base::VectorArray
 Alias to vector derivatives array.
 

Public Member Functions

MeanPositionDer< DataPoint, _WFunctor, DiffType, T > & meanPositionDer ()
 Explicit conversion to MeanPositionDer , to access methods potentially hidden by heritage.
 
const MeanPositionDer< DataPoint, _WFunctor, DiffType, T > & meanPositionDer () const
 Explicit conversion to MeanPositionDer , 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, ScalarArray &dw)
 Add a neighbor to perform the fit.
 
VectorArray barycenterDerivatives () const
 Compute derivatives of the barycenter (in local frame).
 

Protected Types

enum  { Check , PROVIDES_MEAN_POSITION_DERIVATIVE }
 
using Base = T
 Base class of the procedure.
 

Protected Attributes

VectorArray m_dSumP {VectorArray::Zero()}
 Derivatives of the input points vectors.
 

Detailed Description

template<class DataPoint, class _WFunctor, int DiffType, typename T>
class Ponca::MeanPositionDer< DataPoint, _WFunctor, DiffType, T >

Definition at line 102 of file mean.h.

Member Typedef Documentation

◆ Base

template<class DataPoint , class _WFunctor , int DiffType, typename T >
using Ponca::MeanPositionDer< DataPoint, _WFunctor, DiffType, T >::Base = T
protected

Base class of the procedure.

Definition at line 103 of file mean.h.

◆ Scalar

template<class DataPoint , class _WFunctor , int DiffType, typename T >
using Ponca::MeanPositionDer< DataPoint, _WFunctor, DiffType, T >::Scalar = typename DataPoint::Scalar

Alias to scalar type.

Definition at line 103 of file mean.h.

◆ ScalarArray

template<class DataPoint , class _WFunctor , int DiffType, typename T >
using Ponca::MeanPositionDer< DataPoint, _WFunctor, DiffType, T >::ScalarArray = typename Base::ScalarArray

Alias to scalar derivatives array.

Definition at line 104 of file mean.h.

◆ VectorArray

template<class DataPoint , class _WFunctor , int DiffType, typename T >
using Ponca::MeanPositionDer< DataPoint, _WFunctor, DiffType, T >::VectorArray = typename Base::VectorArray

Alias to vector derivatives array.

Definition at line 104 of file mean.h.

◆ VectorType

template<class DataPoint , class _WFunctor , int DiffType, typename T >
using Ponca::MeanPositionDer< DataPoint, _WFunctor, DiffType, T >::VectorType = typename Base::VectorType

Alias to vector type.

Definition at line 103 of file mean.h.

◆ WFunctor

template<class DataPoint , class _WFunctor , int DiffType, typename T >
using Ponca::MeanPositionDer< DataPoint, _WFunctor, DiffType, T >::WFunctor = typename Base::WFunctor

Alias to weight function.

Definition at line 103 of file mean.h.

Member Enumeration Documentation

◆ anonymous enum

template<class DataPoint , class _WFunctor , int DiffType, typename T >
anonymous enum
protected
Enumerator
PROVIDES_MEAN_POSITION_DERIVATIVE 

Provides derivative of the mean position.

Definition at line 107 of file mean.h.

Member Function Documentation

◆ addLocalNeighbor()

template<class DataPoint , class _WFunctor , int DiffType, typename T >
bool MeanPositionDer::addLocalNeighbor ( Scalar  w,
const VectorType localQ,
const DataPoint &  attributes,
ScalarArray dw 
)
inline

Add a neighbor to perform the fit.

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

Definition at line 60 of file mean.hpp.

◆ barycenterDerivatives()

template<class DataPoint , class _WFunctor , int DiffType, typename T >
VectorArray Ponca::MeanPositionDer< DataPoint, _WFunctor, DiffType, T >::barycenterDerivatives ( ) const
inline

Compute derivatives of the barycenter (in local frame).

See also
MeanPosition::barycenterLocal()

Step-by-step derivation from the barycenter definition

Given the definition of the barycenter \( b(\mathbf{x}) = \frac{\sum_i w_\mathbf{x}(\mathbf{p_i}) \mathbf{p_i}}{\sum_i w_\mathbf{x}(\mathbf{p_i})} \), where \(\left[\mathbf{p_i} \in \text{neighborhood}(\mathbf{x})\right]\) are all the point samples in \(\mathbf{x}\)'s neighborhood.

We denote \( t(\mathbf{x}) = \sum_i w_\mathbf{x}(\mathbf{p_i}) \mathbf{p_i} \) and \( s(\mathbf{x}) = \sum_i w_\mathbf{x}(\mathbf{p_i})\), such that \( b(\mathbf{x}) = \frac{t(\mathbf{x})}{s(\mathbf{x})}\).

By definition, \( b'(\mathbf{x}) = \frac{s(\mathbf{x})t'(\mathbf{x}) - t(\mathbf{x})s'(\mathbf{x})}{s(\mathbf{x})^2}\). We have \( s'(\mathbf{x}) = \sum_i w'_\mathbf{x}(\mathbf{p_i}) \).

We rewrite \( t(\mathbf{x}) = \sum u(\mathbf{x})v(\mathbf{x}) \), with \( u(\mathbf{x}) = w_\mathbf{x}(\mathbf{p_i}) \) and \( v(\mathbf{x}) = \mathbf{p_i} \).

As the point cloud coordinates are constants, \(v(\mathbf{x})\) is constant, its derivative is null, and so \( t'(\mathbf{x}) = \sum_i u'(\mathbf{x}) v(\mathbf{x}) = \sum_i w'_\mathbf{x}(\mathbf{p_i}) \mathbf{p_i} \).

Which leads to \( b'(\mathbf{x}) = \frac{\sum_i w'_\mathbf{x}(\mathbf{p_i}) \mathbf{p_i} - b(\mathbf{x})\sum w'(\mathbf{x})}{\sum_i w_\mathbf{x}(\mathbf{p_i})} \)

Note
This code is not directly tested, but rather indirectly by testing CovariancePlaneDer::dNormal()

Definition at line 141 of file mean.h.

◆ init()

template<class DataPoint , class _WFunctor , int DiffType, typename T >
void MeanPositionDer::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 52 of file mean.hpp.

◆ meanPositionDer() [1/2]

template<class DataPoint , class _WFunctor , int DiffType, typename T >
MeanPositionDer< DataPoint, _WFunctor, DiffType, T > & Ponca::MeanPositionDer< DataPoint, _WFunctor, DiffType, T >::meanPositionDer ( )
inline

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

Definition at line 117 of file mean.h.

◆ meanPositionDer() [2/2]

template<class DataPoint , class _WFunctor , int DiffType, typename T >
const MeanPositionDer< DataPoint, _WFunctor, DiffType, T > & Ponca::MeanPositionDer< DataPoint, _WFunctor, DiffType, T >::meanPositionDer ( ) const
inline

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

Definition at line 117 of file mean.h.

Member Data Documentation

◆ m_dSumP

template<class DataPoint , class _WFunctor , int DiffType, typename T >
VectorArray Ponca::MeanPositionDer< DataPoint, _WFunctor, DiffType, T >::m_dSumP {VectorArray::Zero()}
protected

Derivatives of the input points vectors.

Definition at line 114 of file mean.h.