27 template <
class DataPo
int,
class _NFilter,
typename T =
void>
37 using Scalar =
typename DataPoint::Scalar;
60 PONCA_FITTING_APIDOC_SETWFUNC
63 PONCA_FITTING_APIDOC_INIT
64 PONCA_MULTIARCH
inline void init()
73 PONCA_MULTIARCH [[nodiscard]]
inline bool isReady()
const
86 PONCA_MULTIARCH [[nodiscard]]
inline int getNumNeighbors()
const {
return m_nbNeighbors; }
105 PONCA_FITTING_APIDOC_ADDNEIGHBOR
112 PONCA_FITTING_APIDOC_FINALIZE
116 if (m_sumW ==
Scalar(0.) || m_nbNeighbors < 1)
145 template <
class DataPo
int,
class _NFilter,
int Type,
typename T>
148 PONCA_FITTING_DECLARE_DEFAULT_TYPES
149 PONCA_FITTING_DECLARE_MATRIX_TYPE
153 Check = Base::PROVIDES_PRIMITIVE_BASE,
154 PROVIDES_PRIMITIVE_DERIVATIVE
158 static constexpr int NbDerivatives =
160 static constexpr int DerStorageOrder = (Type &
FitSpaceDer) ? Eigen::RowMajor : Eigen::ColMajor;
164 typedef Eigen::Matrix<Scalar, DataPoint::Dim, NbDerivatives, DerStorageOrder>
VectorArray;
178 PONCA_MULTIARCH
inline void init()
192 Base::addLocalNeighbor(w, localQ, attributes);
197 dw[0] = Base::getNeighborFilter().scaledw(attributes.pos(), attributes);
200 dw.template segment<int(DataPoint::Dim)>(spaceId) =
201 -Base::getNeighborFilter().spacedw(attributes.pos(), attributes).transpose();
214 PONCA_MULTIARCH [[nodiscard]]
static inline constexpr unsigned int derDimension() {
return NbDerivatives; }
bool isStable() const
Is the fitted primitive ready to use (finalize has been called and the result is stable)
typename DataPoint::Scalar Scalar
Inherited scalar type.
void startNewPass()
To be called when starting a new processing pass, ie.
@ PROVIDES_PRIMITIVE_BASE
Provides base API for primitives.
void setNeighborFilter(const NeighborFilter &_nFilter)
Init the WeightFunc, without changing the other internal states.
bool isReady() const
Is the primitive well fitted and ready to use (finalize has been called) ?
_NFilter NeighborFilter
Filter applied on each neighbor.
Scalar getWeightSum() const
Get the sum of the weights.
void init()
Set the evaluation position and reset the internal states.
int getNumNeighbors() const
Get number of points added in the neighborhood (with non negative weight)
FIT_RESULT finalize()
Finalize the procedure.
const NeighborFilter & getNeighborFilter() const
Read access to the NeighborFilter.
typename DataPoint::VectorType VectorType
Inherited vector type.
NeighborFilter m_nFilter
Neighborhood filter.
void addLocalNeighbor(Scalar w, const VectorType &, const DataPoint &)
Add a neighbor to perform the fit.
FIT_RESULT m_eCurrentState
Represent the current state of the fit (finalize function update the state)
FIT_RESULT getCurrentState() const
bool needAnotherPass() const
Is another pass required for fitting (finalize has been called and the result is NEED_OTHER_PASS)
Generic class performing the Fit derivation.
static constexpr bool isScaleDer()
State specified at compilation time to compute derivatives in scale.
Eigen::Matrix< Scalar, 1, NbDerivatives > ScalarArray
Static array of scalars with a size adapted to the differentiation type.
ScalarArray m_dSumW
Sum of weight derivatives.
static constexpr bool isSpaceDer()
State specified at compilation time to compute derivatives in space.
@ Check
Provides base API for primitives.
typename DataPoint::Scalar Scalar
Alias to scalar type.
typename Base::VectorType VectorType
Alias to vector type.
static constexpr unsigned int derDimension()
Number of dimensions used for the differentiation.
void addLocalNeighbor(Scalar w, const VectorType &localQ, const DataPoint &attributes, ScalarArray &dw)
Eigen::Matrix< Scalar, DataPoint::Dim, NbDerivatives, DerStorageOrder > VectorArray
Static array of scalars with a size adapted to the differentiation type.
This Source Code Form is subject to the terms of the Mozilla Public License, v.
@ FitSpaceDer
Flag indicating a space differentiation.
@ FitScaleDer
Flag indicating a scale differentiation.
FIT_RESULT
Enum corresponding to the state of a fitting method (and what the finalize function returns)
@ UNDEFINED
The fitting is undefined, you can't use it for valid results.
@ NEED_OTHER_PASS
The fitting procedure needs to analyse the neighborhood another time.
@ STABLE
The fitting is stable and ready to use.
@ UNSTABLE
The fitting is ready to use but it is considered as unstable (if the number of neighbors is low for e...