Ponca  4a9354998d048bf882a3ee9bac8105216fa08d13
Point Cloud Analysis library
Loading...
Searching...
No Matches
basket.hpp
1namespace Ponca
2{
3 /*
4 Keep the following functions in a separate file. In order for functions to
5 be precompiled by Ponca, we need them not to be inline.
6 In particular, their body can not be inside the class definitions.
7 */
8
9// Shortcut for functions needing this type
10#define DiffArray typename internal::BasketDiffAggregate<BasketType, Type, Ext0, Exts...>::type::ScalarArray
11
12 template <typename BasketType, int Type, template <class, class, int, typename> class Ext0,
13 template <class, class, int, typename> class... Exts>
15 {
16 Base::init();
17 }
18
19 template <typename BasketType, int Type, template <class, class, int, typename> class Ext0,
20 template <class, class, int, typename> class... Exts>
22 {
23 Base::startNewPass();
24 }
25
26 template <typename BasketType, int Type, template <class, class, int, typename> class Ext0,
27 template <class, class, int, typename> class... Exts>
29 {
30 Base::finalize();
31 }
32
33 template <typename BasketType, int Type, template <class, class, int, typename> class Ext0,
34 template <class, class, int, typename> class... Exts>
36 {
37 // compute weight
38 auto neiFilterOutput = Base::getNeighborFilter()(_nei);
39 typename Base::ScalarArray dw;
40
41 if (neiFilterOutput.first > Scalar(0.))
42 {
43 Base::addLocalNeighbor(neiFilterOutput.first, neiFilterOutput.second, _nei, dw);
44 return true;
45 }
46 return false;
47 }
48
49 template <typename BasketType, int Type, template <class, class, int, typename> class Ext0,
50 template <class, class, int, typename> class... Exts>
52 const BSKP& _nei, DiffArray& _dw)
53 {
54 Base::addLocalNeighbor(_w, _localQ, _nei, _dw);
55 }
56
57 template <class P, class NF, template <class, class, typename> class Ext0,
58 template <class, class, typename> class... Exts>
59 requires IsPoint<P>
61 {
62 Base::init();
63 }
64
65 template <class P, class NF, template <class, class, typename> class Ext0,
66 template <class, class, typename> class... Exts>
67 requires IsPoint<P>
69 {
70 Base::startNewPass();
71 }
72
73 template <class P, class NF, template <class, class, typename> class Ext0,
74 template <class, class, typename> class... Exts>
75 requires IsPoint<P>
77 {
78 return Base::finalize();
79 }
80
81 template <class P, class NF, template <class, class, typename> class Ext0,
82 template <class, class, typename> class... Exts>
83 requires IsPoint<P>
85 {
86 // compute weight
87 auto neiFilterOutput = Base::getNeighborFilter()(_nei);
88
89 if (neiFilterOutput.first > Scalar(0.))
90 {
91 Base::addLocalNeighbor(neiFilterOutput.first, neiFilterOutput.second, _nei);
92 return true;
93 }
94 return false;
95 }
96
97 template <class P, class NF, template <class, class, typename> class Ext0,
98 template <class, class, typename> class... Exts>
99 requires IsPoint<P>
100 PONCA_MULTIARCH void Basket<P, NF, Ext0, Exts...>::addLocalNeighbor(typename P::Scalar _w,
101 const typename P::VectorType& _localQ,
102 const P& _nei)
103 {
104 Base::addLocalNeighbor(_w, _localQ, _nei);
105 }
106
107#undef DiffArray
108} // namespace Ponca
void init()
Initialize the fit.
Definition basket.hpp:14
bool addNeighbor(const DataPoint &_nei)
Add a neighbor to perform the fit.
Definition basket.hpp:35
typename BasketType::Scalar Scalar
Scalar type used for computation, as defined from Basket.
Definition basket.h:241
void addLocalNeighbor(Scalar _w, const VectorType &_localQ, const DataPoint &_nei, typename Base::ScalarArray &_dw)
Add a local neighbor to perform the fit.
Definition basket.hpp:51
void startNewPass()
Start a new iteration over neighbor.
Definition basket.hpp:21
void finalize()
Finalize the fitting procedure.
Definition basket.hpp:28
Aggregator class used to declare specialized structures using CRTP.
Definition basket.h:294
void addLocalNeighbor(typename P::Scalar _w, const typename P::VectorType &_localQ, const P &_nei)
Add a local neighbor to perform the fit.
Definition basket.hpp:100
void startNewPass()
Start a new iteration over neighbor.
Definition basket.hpp:68
bool addNeighbor(const DataPoint &_nei)
Add a neighbor to perform the fit.
Definition basket.hpp:84
typename P::Scalar Scalar
Scalar type used for computation, as defined from template parameter P
Definition basket.h:302
FIT_RESULT finalize()
Finalize the fitting procedure.
Definition basket.hpp:76
void init()
Initialize the fit.
Definition basket.hpp:60
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition concepts.h:11
FIT_RESULT
Enum corresponding to the state of a fitting method (and what the finalize function returns)
Definition enums.h:15