Ponca  aa50bfdf187919869239c5b44b748842569114c1
Point Cloud Analysis library
Loading...
Searching...
No Matches
weightFunc.hpp
1/*
2 This Source Code Form is subject to the terms of the Mozilla Public
3 License, v. 2.0. If a copy of the MPL was not distributed with this
4 file, You can obtain one at http://mozilla.org/MPL/2.0/.
5*/
6
7
8template <class DataPoint, class WeightKernel>
9typename DistWeightFunc<DataPoint, WeightKernel>::VectorType
11{
12 return _q + m_p;
13}
14
15template <class DataPoint, class WeightKernel>
18{
19 return _q - m_p;
20}
21
22template <class DataPoint, class WeightKernel>
25 const DataPoint&) const
26{
27 VectorType q = convertToLocalBasis(_q);
28 Scalar d = q.norm();
29 return { (d <= m_t) ? m_wk.f(d/m_t) : Scalar(0.), q };
30}
31
32template <class DataPoint, class WeightKernel>
35 const DataPoint&) const
36{
37 static_assert(WeightKernel::isDValid, "First order derivatives are required");
38 VectorType result = VectorType::Zero();
39 VectorType q = convertToLocalBasis(_q);
40 Scalar d = q.norm();
41 if (d <= m_t && d != Scalar(0.)) result = (q / (d * m_t)) * m_wk.df(d/m_t);
42 return result;
43}
44
45template <class DataPoint, class WeightKernel>
48 const DataPoint&) const
49{
50 static_assert(WeightKernel::isDDValid, "Second order derivatives are required");
51 MatrixType result = MatrixType::Zero();
52 VectorType q = convertToLocalBasis(_q);
53 Scalar d = q.norm();
54 if (d <= m_t && d != Scalar(0.))
55 {
56 Scalar der = m_wk.df(d/m_t);
57 result = q*q.transpose()/d*(m_wk.ddf(d/m_t)/m_t - der/d);
58 result.diagonal().array() += der;
59 result *= Scalar(1.)/(m_t*d);
60 }
61 return result;
62}
63
64template <class DataPoint, class WeightKernel>
67 const DataPoint&) const
68{
69 static_assert(WeightKernel::isDValid, "First order derivatives are required");
70 Scalar d = convertToLocalBasis(_q).norm();
71 return (d <= m_t) ? Scalar( - d*m_wk.df(d/m_t)/(m_t*m_t) ) : Scalar(0.);
72}
73
74template <class DataPoint, class WeightKernel>
77 const DataPoint&) const
78{
79 static_assert(WeightKernel::isDDValid, "Second order derivatives are required");
80 Scalar d = convertToLocalBasis(_q).norm();
81 return (d <= m_t) ? Scalar(Scalar(2.)*d/(m_t*m_t*m_t)*m_wk.df(d/m_t) +
82 d*d/(m_t*m_t*m_t*m_t)*m_wk.ddf(d/m_t)) :
83 Scalar(0.);
84}
85
86template <class DataPoint, class WeightKernel>
89 const DataPoint&) const
90{
91 static_assert(WeightKernel::isDDValid, "Second order derivatives are required");
92 VectorType result = VectorType::Zero();
93 VectorType q = convertToLocalBasis(_q);
94 Scalar d = q.norm();
95 if (d <= m_t && d != Scalar(0.))
96 result = -q/(m_t*m_t)*(m_wk.df(d/m_t)/d + m_wk.ddf(d/m_t)/m_t);
97 return result;
98}
99
100
Weighting function based on the euclidean distance between a query and a reference position.
Definition: weightFunc.h:29
typename DataPoint::MatrixType MatrixType
Matrix type from DataPoint.
Definition: weightFunc.h:36
std::pair< Scalar, VectorType > WeightReturnType
Return type of the method w()
Definition: weightFunc.h:38
typename DataPoint::Scalar Scalar
Scalar type from DataPoint.
Definition: weightFunc.h:32
typename DataPoint::VectorType VectorType
Vector type from DataPoint.
Definition: weightFunc.h:34