10#include "../defines.h"
25 template <
class DataPo
int,
class _NFilter,
typename T =
void>
29 using Scalar =
typename DataPoint::Scalar;
32 using NeighborFrame =
typename NeighborFilter::NeighborhoodFrame;
53 PONCA_FITTING_APIDOC_SETWFUNC
54 PONCA_MULTIARCH
inline bool setNeighborFilter(
const NeighborFilter& _nFilter)
60 PONCA_FITTING_APIDOC_INIT
61 PONCA_MULTIARCH
inline void init()
71 PONCA_MULTIARCH [[nodiscard]]
inline bool isReady()
const
84 PONCA_MULTIARCH [[nodiscard]]
inline int getNumNeighbors()
const {
return m_nbNeighbors; }
99 PONCA_MULTIARCH
inline NeighborFrame& getNeighborFrame() {
return m_nFilter.frame(); }
100 PONCA_MULTIARCH
inline const NeighborFrame& getNeighborFrame()
const {
return m_nFilter.frame(); }
106 PONCA_FITTING_APIDOC_ADDNEIGHBOR
113 PONCA_FITTING_APIDOC_FINALIZE
117 if (m_sumW ==
Scalar(0.) || m_nbNeighbors < 1)
144 template <
class DataPo
int,
class _NFilter,
int Type,
typename T>
148 PONCA_FITTING_DECLARE_DEFAULT_TYPES
149 PONCA_FITTING_DECLARE_MATRIX_TYPE
151 static constexpr int NbDerivatives =
153 static constexpr int DerStorageOrder = (Type &
FitSpaceDer) ? Eigen::RowMajor : Eigen::ColMajor;
157 using VectorArray = Eigen::Matrix<Scalar, DataPoint::Dim, NbDerivatives, DerStorageOrder>;
171 PONCA_MULTIARCH
inline void init()
185 Base::addLocalNeighbor(w, localQ, attributes);
190 dw[0] = Base::getNeighborFilter().scaledw(attributes.pos(), attributes);
193 dw.template segment<int(DataPoint::Dim)>(spaceId) =
194 -Base::getNeighborFilter().spacedw(attributes.pos(), attributes).transpose();
207 PONCA_MULTIARCH [[nodiscard]]
static inline constexpr unsigned int derDimension() {
return NbDerivatives; }
Base class of any computation unit of a BasketDiff.
Eigen::Matrix< Scalar, DataPoint::Dim, NbDerivatives, DerStorageOrder > VectorArray
Static array of scalars with a size adapted to the differentiation type.
void addLocalNeighbor(Scalar w, const VectorType &localQ, const DataPoint &attributes, ScalarArray &dw)
static constexpr bool isSpaceDer()
State specified at compilation time to compute derivatives in space.
static constexpr bool isScaleDer()
State specified at compilation time to compute derivatives in scale.
typename DataPoint::Scalar Scalar
Alias to scalar type.
typename Base::VectorType VectorType
Alias to vector type.
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 unsigned int derDimension()
Number of dimensions used for the differentiation.
Base class of any computation unit of a Basket.
Scalar getWeightSum() const
Get the sum of the weights.
int getNumNeighbors() const
Get number of points added in the neighborhood (with positive weight).
bool isStable() const
Is the fitted primitive ready to use (finalize has been called and the result is stable).
void addLocalNeighbor(Scalar w, const VectorType &, const DataPoint &)
Add a neighbor to perform the fit.
const NeighborFilter & getNeighborFilter() const
Read access to the NeighborFilter.
void init()
Set the evaluation position and reset the internal states.
bool needAnotherPass() const
Is another pass required for fitting (finalize has been called and the result is NEED_OTHER_PASS).
typename DataPoint::VectorType VectorType
Inherited vector type.
NeighborFilter m_nFilter
Neighborhood filter.
FIT_RESULT getCurrentState() const
void startNewPass()
To be called when starting a new processing pass, ie.
bool isReady() const
Is the primitive well-fitted and ready to use (finalize has been called) ?
typename DataPoint::Scalar Scalar
Inherited scalar type.
_NFilter NeighborFilter
Filter applied on each neighbor.
FIT_RESULT m_eCurrentState
Represent the current state of the fit (finalize function update the state).
This concept ensures that the default types and accessors in a Basket are well-formed.
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...