Ponca  aa50bfdf187919869239c5b44b748842569114c1
Point Cloud Analysis library
Loading...
Searching...
No Matches
Ponca::DistWeightFunc< DataPoint, WeightKernel > Class Template Reference

Weighting function based on the euclidean distance between a query and a reference position. More...

#include <weightFunc.h>

+ Collaboration diagram for Ponca::DistWeightFunc< DataPoint, WeightKernel >:

Public Types

using Scalar = typename DataPoint::Scalar
 Scalar type from DataPoint.
 
using VectorType = typename DataPoint::VectorType
 Vector type from DataPoint.
 
using MatrixType = typename DataPoint::MatrixType
 Matrix type from DataPoint.
 
using WeightReturnType = std::pair< Scalar, VectorType >
 Return type of the method w()
 

Public Member Functions

 DistWeightFunc (const Scalar &_t=Scalar(1.))
 Constructor that defines the current evaluation scale.
 
void init (const VectorType &_evalPos)
 Initialization method, called by the fitting procedure.
 
const VectorTypebasisCenter () const
 Get access to basis center location in global coordinate system.
 
VectorType convertToGlobalBasis (const VectorType &_q) const
 Convert position from local to global coordinate system.
 
VectorType convertToLocalBasis (const VectorType &_q) const
 Convert query from global to local coordinate system (used internally(.
 
WeightReturnType w (const VectorType &_q, const DataPoint &) const
 Compute the weight of the given query with respect to its coordinates.
 
VectorType spacedw (const VectorType &_q, const DataPoint &) const
 First order derivative in space (for each spatial dimension \(\mathsf{x})\).
 
MatrixType spaced2w (const VectorType &_q, const DataPoint &) const
 Second order derivative in space (for each spatial dimension \(\mathsf{x})\).
 
Scalar scaledw (const VectorType &_q, const DataPoint &) const
 First order derivative in scale \(t\).
 
Scalar scaled2w (const VectorType &_q, const DataPoint &) const
 Second order derivative in scale \(t\).
 
VectorType scaleSpaced2w (const VectorType &_q, const DataPoint &) const
 Cross derivative in scale \(t\) and in space (for each spatial dimension \(\mathsf{x})\).
 
Scalar evalScale () const
 Access to the evaluation scale set during the initialization.
 
const VectorTypeevalPos () const
 Access to the evaluation position set during the initialization.
 

Protected Attributes

Scalar m_t
 Evaluation scale.
 
WeightKernel m_wk
 1D function applied to weight queries
 
VectorType m_p
 basis center
 

Detailed Description

template<class DataPoint, class WeightKernel>
class Ponca::DistWeightFunc< DataPoint, WeightKernel >

Weighting function based on the euclidean distance between a query and a reference position.

The evaluation position is set using the init method. All the queries are expressed in global system, and the weighting function convert them to local coordinates (ie. relatively to the evaluation position).

It can be specialized for any DataPoint and uses a generic 1D BaseWeightKernel.

Warning
it assumes that the evaluation scale t is strictly positive

Definition at line 28 of file weightFunc.h.

Member Typedef Documentation

◆ MatrixType

template<class DataPoint , class WeightKernel >
using Ponca::DistWeightFunc< DataPoint, WeightKernel >::MatrixType = typename DataPoint::MatrixType

Matrix type from DataPoint.

Definition at line 36 of file weightFunc.h.

◆ Scalar

template<class DataPoint , class WeightKernel >
using Ponca::DistWeightFunc< DataPoint, WeightKernel >::Scalar = typename DataPoint::Scalar

Scalar type from DataPoint.

Definition at line 32 of file weightFunc.h.

◆ VectorType

template<class DataPoint , class WeightKernel >
using Ponca::DistWeightFunc< DataPoint, WeightKernel >::VectorType = typename DataPoint::VectorType

Vector type from DataPoint.

Definition at line 34 of file weightFunc.h.

◆ WeightReturnType

template<class DataPoint , class WeightKernel >
using Ponca::DistWeightFunc< DataPoint, WeightKernel >::WeightReturnType = std:: pair <Scalar, VectorType>

Return type of the method w()

Definition at line 38 of file weightFunc.h.

Constructor & Destructor Documentation

◆ DistWeightFunc()

template<class DataPoint , class WeightKernel >
Ponca::DistWeightFunc< DataPoint, WeightKernel >::DistWeightFunc ( const Scalar _t = Scalar(1.))
inline

Constructor that defines the current evaluation scale.

Warning
t > 0

Definition at line 44 of file weightFunc.h.

Member Function Documentation

◆ basisCenter()

template<class DataPoint , class WeightKernel >
const VectorType & Ponca::DistWeightFunc< DataPoint, WeightKernel >::basisCenter ( ) const
inline

Get access to basis center location in global coordinate system.

Definition at line 62 of file weightFunc.h.

◆ convertToGlobalBasis()

template<class DataPoint , class WeightKernel >
DistWeightFunc< DataPoint, WeightKernel >::VectorType DistWeightFunc::convertToGlobalBasis ( const VectorType _q) const
inline

Convert position from local to global coordinate system.

Parameters
_qPosition in local coordinate
Returns
Position expressed independently of the local basis center

Definition at line 10 of file weightFunc.hpp.

◆ convertToLocalBasis()

template<class DataPoint , class WeightKernel >
DistWeightFunc< DataPoint, WeightKernel >::VectorType DistWeightFunc::convertToLocalBasis ( const VectorType _q) const
inline

Convert query from global to local coordinate system (used internally(.

Parameters
_qQuery in global coordinate
Returns
Query expressed relatively to the basis center

Definition at line 17 of file weightFunc.hpp.

◆ evalPos()

template<class DataPoint , class WeightKernel >
const VectorType & Ponca::DistWeightFunc< DataPoint, WeightKernel >::evalPos ( ) const
inline

Access to the evaluation position set during the initialization.

Definition at line 202 of file weightFunc.h.

◆ evalScale()

template<class DataPoint , class WeightKernel >
Scalar Ponca::DistWeightFunc< DataPoint, WeightKernel >::evalScale ( ) const
inline

Access to the evaluation scale set during the initialization.

Definition at line 199 of file weightFunc.h.

◆ init()

template<class DataPoint , class WeightKernel >
void Ponca::DistWeightFunc< DataPoint, WeightKernel >::init ( const VectorType _evalPos)
inline

Initialization method, called by the fitting procedure.

Parameters
_evalPosBasis center

Definition at line 56 of file weightFunc.h.

◆ scaled2w()

template<class DataPoint , class WeightKernel >
DistWeightFunc< DataPoint, WeightKernel >::Scalar DistWeightFunc::scaled2w ( const VectorType _q,
const DataPoint &   
) const
inline

Second order derivative in scale \(t\).

Parameters
_qQuery in global coordinate

\( \frac{\delta^2 \frac{\left|\mathbf{q}\right|}{t}}{\delta t^2} \nabla w(\frac{\left|\mathbf{q}\right|}{t}) + \left(\frac{\delta \frac{\left|\mathbf{q}\right|}{t}}{\delta t}\right)^2 \nabla^2 w(\frac{\left|\mathbf{q}\right|}{t}) = \frac{2\left|\mathbf{q}\right|}{t^3} \nabla{w(\frac{\left|\mathbf{q}\right|}{t})} + \frac{\left|\mathbf{q}\right|^2}{t^4} \nabla^2{w(\frac{\left|\mathbf{q}\right|}{t})} \)

where \( \left|\mathbf{q}\right| \) represents the norm of the query coordinates expressed in centered basis.

Warning
Requires \(\nabla^2 w(x)\) to be valid

Definition at line 76 of file weightFunc.hpp.

◆ scaledw()

template<class DataPoint , class WeightKernel >
DistWeightFunc< DataPoint, WeightKernel >::Scalar DistWeightFunc::scaledw ( const VectorType _q,
const DataPoint &   
) const
inline

First order derivative in scale \(t\).

Parameters
_qQuery in global coordinate

\( \frac{\delta \frac{\left|\mathbf{q}\right|}{t}}{\delta t} \nabla w(\frac{\left|\mathbf{q}\right|}{t}) = - \frac{\left|\mathbf{q}\right|}{t^2} \nabla{w(\frac{\left|\mathbf{q}\right|}{t})} \)

where \( \left|\mathbf{q}\right| \) represents the norm of the query coordinates expressed in centered basis.

Warning
Requires \(\nabla w(x)\) to be valid

Definition at line 66 of file weightFunc.hpp.

◆ scaleSpaced2w()

template<class DataPoint , class WeightKernel >
DistWeightFunc< DataPoint, WeightKernel >::VectorType DistWeightFunc::scaleSpaced2w ( const VectorType _q,
const DataPoint &   
) const
inline

Cross derivative in scale \(t\) and in space (for each spatial dimension \(\mathsf{x})\).

Parameters
_qQuery in global coordinate

\( \frac{\delta^2 \frac{\left|\mathbf{q}_\mathsf{x}\right|}{t}}{\delta t\ \delta \mathsf{x}} \nabla w(\frac{\left|\mathbf{q}_\mathsf{x}\right|}{t}) + \frac{\delta \frac{\left|\mathbf{q}_\mathsf{x}\right|}{t}}{\delta \mathsf{x}} \frac{\delta \frac{\left|\mathbf{q}_\mathsf{x}\right|}{t}}{\delta t} \nabla^2 w(\frac{\left|\mathbf{q}_\mathsf{x}\right|}{t}) = -\frac{\mathbf{q}_\mathsf{x}}{t^2} \left( \frac{1}{\left|\mathbf{q}_\mathsf{x}\right|}\nabla w(\frac{\left|\mathbf{q}_\mathsf{x}\right|}{t}) + \frac{1}{t}\nabla^2 w(\frac{\left|\mathbf{q}_\mathsf{x}\right|}{t}) \right)\)

where \( \left|\mathbf{q}_\mathsf{x}\right| \) represents the norm of the query coordinates expressed in centered basis.

Warning
Requires \(\nabla^2 w(x)\) to be valid

Definition at line 88 of file weightFunc.hpp.

◆ spaced2w()

template<class DataPoint , class WeightKernel >
DistWeightFunc< DataPoint, WeightKernel >::MatrixType DistWeightFunc::spaced2w ( const VectorType _q,
const DataPoint &   
) const
inline

Second order derivative in space (for each spatial dimension \(\mathsf{x})\).

Parameters
_qQuery in global coordinate

\( \frac{\delta^2 \frac{\left|\mathbf{q}_\mathsf{x}\right|}{t}}{\delta \mathsf{x}^2} \nabla w(\frac{\left|\mathbf{q}_\mathsf{x}\right|}{t}) + \left(\frac{\delta \frac{\left|\mathbf{q}_\mathsf{x}\right|}{t}}{\delta \mathsf{x}}\right)^2 \nabla^2 w(\frac{\left|\mathbf{q}_\mathsf{x}\right|}{t}) = \frac{1}{t\left|\mathbf{q}_\mathsf{x}\right|} \left( I_d - \frac{\mathbf{q}_\mathsf{x}\mathbf{q}_\mathsf{x}^T}{\left|\mathbf{q}_\mathsf{x}\right|^2}\right) \nabla w(\frac{\left|\mathbf{q}_\mathsf{x}\right|}{t}) + \frac{\mathbf{q}_\mathsf{x}\mathbf{q}_\mathsf{x}^T}{t^2\left|\mathbf{q}_\mathsf{x}\right|^2} \nabla^2 w(\frac{\left|\mathbf{q}_\mathsf{x}\right|}{t}) \)

where \( \left|\mathbf{q}_\mathsf{x}\right| \) represents the norm of the query coordinates expressed in centered basis, for each spatial dimensions \( \mathsf{x}\).

Warning
Requires \(\nabla^2 w(x)\) to be valid

Definition at line 47 of file weightFunc.hpp.

◆ spacedw()

template<class DataPoint , class WeightKernel >
DistWeightFunc< DataPoint, WeightKernel >::VectorType DistWeightFunc::spacedw ( const VectorType _q,
const DataPoint &   
) const
inline

First order derivative in space (for each spatial dimension \(\mathsf{x})\).

Parameters
_qQuery in global coordinate

\( \frac{\delta \frac{\left|\mathbf{q}_\mathsf{x}\right|}{t}}{\delta \mathsf{x}} \nabla w(\frac{\left|\mathbf{q}_\mathsf{x}\right|}{t}) = \frac{\mathbf{q}}{t\left|q\right|} \nabla{w(\frac{\left|\mathbf{q}_\mathsf{x}\right|}{t})} \)

where \( \left|\mathbf{q}_\mathsf{x}\right| \) represents the norm of the query coordinates expressed in centered basis, for each spatial dimensions \( \mathsf{x}\).

Warning
Requires \(\nabla w(x)\) to be valid

Definition at line 34 of file weightFunc.hpp.

◆ w()

template<class DataPoint , class WeightKernel >
DistWeightFunc< DataPoint, WeightKernel >::WeightReturnType DistWeightFunc::w ( const VectorType _q,
const DataPoint &   
) const
inline

Compute the weight of the given query with respect to its coordinates.

Parameters
_qQuery in global coordinate

As the query \(\mathbf{q}\) is expressed in global coordinate, it is first converted to the centered basis. Then, the WeightKernel is directly applied to the norm of its coordinates with respect to the current scale \( t \) :

\( w(\frac{\left|\mathbf{q}_\mathsf{x}\right|}{t}) \)

See also
convertToLocalBasis
Returns
The computed weight + the point expressed in local basis

Definition at line 24 of file weightFunc.hpp.

Member Data Documentation

◆ m_p

template<class DataPoint , class WeightKernel >
VectorType Ponca::DistWeightFunc< DataPoint, WeightKernel >::m_p
protected

basis center

Definition at line 207 of file weightFunc.h.

◆ m_t

template<class DataPoint , class WeightKernel >
Scalar Ponca::DistWeightFunc< DataPoint, WeightKernel >::m_t
protected

Evaluation scale.

Definition at line 205 of file weightFunc.h.

◆ m_wk

template<class DataPoint , class WeightKernel >
WeightKernel Ponca::DistWeightFunc< DataPoint, WeightKernel >::m_wk
protected

1D function applied to weight queries

Definition at line 206 of file weightFunc.h.