17#define BSKNF typename BasketType::NeighborFilter
18#define BSKP typename BasketType::DataPoint
20#ifndef PARSED_WITH_DOXYGEN
33 template <
class P,
class NF,
typename Aggregate,
template <
class,
class,
typename>
class Ext,
34 template <
class,
class,
typename>
class... Exts>
35 struct BasketAggregateImpl
37 using type =
typename BasketAggregateImpl<P, NF, Ext<P, NF, Aggregate>, Exts...>::type;
48 template <
class P,
class NF,
typename Aggregate,
template <
class,
class,
typename>
class Ext>
49 struct BasketAggregateImpl<P, NF, Aggregate, Ext>
51 using type = Ext<P, NF, Aggregate>;
62 template <
class P,
class NF,
template <
class,
class,
typename>
class... Exts>
63 struct BasketAggregate : BasketAggregateImpl<P, NF, PrimitiveBase<P, NF>, Exts...>
76 template <
int Type,
typename BasketType,
template <
class,
class,
int,
typename>
class Ext,
77 template <
class,
class,
int,
typename>
class... Exts>
78 struct BasketDiffAggregateImpl
80 using type =
typename BasketDiffAggregateImpl<Type, Ext<BSKP, BSKNF, Type, BasketType>, Exts...>::type;
90 template <
int Type,
typename BasketType,
template <
class,
class,
int,
typename>
class Ext>
91 struct BasketDiffAggregateImpl<Type, BasketType, Ext>
93 using type = Ext<BSKP, BSKNF, Type, BasketType>;
104 template <
typename BasketType,
int Type,
template <
class,
class,
int,
typename>
class... Exts>
105 struct BasketDiffAggregate : BasketDiffAggregateImpl<Type, BasketType, PrimitiveDer, Exts...>
132 template <
typename _Derived,
typename _Base>
152 template <
typename IteratorBegin,
typename IteratorEnd>
161 for (
auto it = begin;
it != end; ++
it)
165 res = Base::finalize();
178 template <
typename IndexRange,
typename Po
intContainer>
187 for (
const auto&
i :
ids)
191 res = Base::finalize();
205 template <
typename Func>
209 auto lastPos = Base::getNeighborFilter().evalPos();
213 Base::m_nFilter.changeNeighborhoodFrame(
lastPos);
216 if (Base::isStable())
236 template <
typename Po
intContainer>
238 const Scalar epsilon = Eigen::NumTraits<Scalar>::dummy_precision())
248 template <
typename IndexRange,
typename Po
intContainer>
251 const Scalar epsilon = Eigen::NumTraits<Scalar>::dummy_precision())
257#define WRITE_COMPUTE_FUNCTIONS \
258 using BasketComputeObject<Self, Base>::compute; \
259 using BasketComputeObject<Self, Base>::computeWithIds; \
260 using BasketComputeObject<Self, Base>::computeMLS; \
261 using BasketComputeObject<Self, Base>::computeWithIdsMLS;
271 template <
typename BasketType,
int Type,
template <
class,
class,
int,
typename>
class Ext0,
272 template <
class,
class,
int,
typename>
class... Exts>
275 typename internal::BasketDiffAggregate<BasketType, Type, Ext0, Exts...>::type>
287 using Scalar =
typename BasketType::Scalar;
288 WRITE_COMPUTE_FUNCTIONS
295 typename Base::ScalarArray
dw;
314 template <
class P,
class NF,
template <
class,
class,
typename>
class Ext0,
315 template <
class,
class,
typename>
class... Exts>
317 typename internal::BasketAggregate<P, NF, Ext0, Exts...>::type>
327 using VectorType =
typename P::VectorType;
333 WRITE_COMPUTE_FUNCTIONS
363 PONCA_MULTIARCH_STD_MATH(
min)
366 const VectorType
lq = Base::getNeighborFilter().convertToLocalBasis(
_q);
369 VectorType
dir = Base::primitiveGradientLocal(
lq);
378 grad = Base::primitiveGradientLocal(
proj);
383 return Base::getNeighborFilter().convertToGlobalBasis(
proj);
387#undef WRITE_COMPUTE_FUNCTIONS
Aggregator class used to declare specialized structures with derivatives computations,...
typename BasketType::DataPoint DataPoint
Point type used for computation.
bool addNeighbor(const DataPoint &_nei)
Add a neighbor to perform the fit.
typename BasketType::NeighborFilter NeighborFilter
Neighbor Filter.
typename BasketType::Scalar Scalar
Scalar type used for computation, as defined from Basket.
Aggregator class used to declare specialized structures using CRTP.
typename internal::BasketAggregate< P, NF, Ext0, Exts... >::type Base
Base type, which aggregates all the computational objects using the CRTP.
VectorType projectDescent(const VectorType &_q, int nbIter=16) const
Project a point on the primitive using Gradient Descent This projection is realized by following the ...
typename P::Scalar Scalar
Scalar type used for computation, as defined from template parameter P
bool addNeighbor(const DataPoint &_nei)
Add a neighbor to perform the fit.
This Source Code Form is subject to the terms of the Mozilla Public License, v.
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.
Base ComputeObject for the Basket classes.
FIT_RESULT computeWithIds(IndexRange ids, const PointContainer &points)
Convenience function to iterate over a subset of samples in a PointContainer Add neighbors stored in ...
FIT_RESULT computeMLS(const PointContainer &points, const int mlsIter=5, const Scalar epsilon=Eigen::NumTraits< Scalar >::dummy_precision())
Computes the fit using the MLS iteration process.
FIT_RESULT computeMLSImpl(Func &&computeFunc, const int mlsIter, const Scalar epsilon)
Computes the fit using the MLS iteration process.
FIT_RESULT compute(const IteratorBegin &begin, const IteratorEnd &end)
Convenience function for STL-like iterators Add neighbors stored in a container using STL-like iterat...
FIT_RESULT computeWithIdsMLS(const IndexRange &ids, const PointContainer &points, const int mlsIter=5, const Scalar epsilon=Eigen::NumTraits< Scalar >::dummy_precision())
Computes the fit using the MLS iteration process.
typename Base::Scalar Scalar
Alias to the Derived type.
ComputeObject is a virtual object that represents an algorithm which can be used with the compute fun...
_Derived & derived()
Retrieve the top layer object Returns a reference to the derived class so that we can use its overwri...