[Go back to Fitting user manual] [Go back to concept manual] [Go back to user manual]
Ponca Fitting Module is structured around the following concepts:
WeightKernelConcept
: defines how neighbor samples should be weighted
ComputationalObjectConcept
and ComputationalDerivativesConcept
: define API of the computational objects used in Basket and BasketDiff respectively.
API of Computational Objects
Computations will always follow the same pattern:
typedef Basket<MyPointStructure,MyWeightingFunction,MyFittingProcedure...> Fit;
MyWeightingFunction w ( some_parameters );
Fit fit;
fit.init( referencePosition );
fit.setWeightFunc( w );
foreach neighbors of referencePosition
fit.addNeighbor(neighbor);
fit.finalize();
if(fit.isStable())
{
}
Note that in the above example, the type Fit
can be either a Basket or a BasketDiff, without affecting the rest of the code.
Objects used in Basket
Objects used in Basket should respect the following API:
template < class DataPoint, class _WFunctor, typename T = void >
class ComputationalObjectConcept
{
protected:
enum {
Check = PROVIDES_CAPABILITY_1 && PROVIDES_CAPABILITY_2
PROVIDES_CAPABILITY,
};
public:
using Scalar = typename DataPoint::Scalar;
using VectorType = typename DataPoint::VectorType;
using WFunctor = _WFunctor;
public:
PONCA_MULTIARCH inline void setWeightFunc (const WFunctor& _w);
PONCA_MULTIARCH inline void init(const VectorType& _basisCenter = VectorType::Zero());
PONCA_MULTIARCH inline bool addLocalNeighbor(Scalar, const VectorType &, const DataPoint &);
PONCA_MULTIARCH inline FIT_RESULT finalize();
};
Objects used in BasketDiff
Objects used in BasketDiff should respect the following API:
template < class DataPoint, class _WFunctor, int Type, typename T>
class ComputationalDerivativesConcept
{
protected:
enum {
Check = PROVIDES_CAPABILITY_1 && PROVIDES_CAPABILITY_2
PROVIDES_CAPABILITY,
};
public:
using Scalar = typename DataPoint::Scalar;
using VectorType = typename DataPoint::VectorType;
using WFunctor = _WFunctor;
using VectorArray = typename Base::VectorArray;
using ScalarArray = typename Base::ScalarArray;
public:
PONCA_MULTIARCH inline void setWeightFunc (const WFunctor& _w);
PONCA_MULTIARCH inline void init(const VectorType& _basisCenter = VectorType::Zero());
PONCA_MULTIARCH inline bool addLocalNeighbor(Scalar w,
const VectorType &localQ,
const DataPoint &attributes,
ScalarArray &dw);
PONCA_MULTIARCH inline FIT_RESULT finalize();
};
- Note
- PrimitiveDer defines the default entry point to most classes used in BasketDiff.
Concepts related to weighting functions
Weighting functions are critical components of the library. They are represented by DistWeightFunc, which is defined from the euclidean distance field centered at the evaluation position (see DistWeightFunc::init()). Given a distance to this evaluation position, the weight is computed (see DistWeightFunc::w()) by applying a 1d weighting function defined as follows:
template <typename _Scalar>
class WeightKernelConcept{
public:
typedef _Scalar Scalar;
PONCA_MULTIARCH inline Scalar f (const Scalar& x) const {}
PONCA_MULTIARCH inline Scalar df (const Scalar& x) const {}
PONCA_MULTIARCH inline Scalar ddf(const Scalar& x) const {}
};
DistWeightFunc also provides computation of the first and second order derivatives of the weight, both in scale (DistWeightFunc::scaledw(), DistWeightFunc::scaled2w()) and space (DistWeightFunc::spacedw(), DistWeightFunc::spaced2w()), and their cross derivatives (DistWeightFunc::scaleSpaced2w()). Theses methods check if the weight kernels provides the appropriate derivatives
[Go back to Fitting user manual] [Go back to concept manual] [Go back to user manual]