Ponca  aa50bfdf187919869239c5b44b748842569114c1
Point Cloud Analysis library
Loading...
Searching...
No Matches
weightFunc.h
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#pragma once
8
9#include "./defines.h"
10#include PONCA_MULTIARCH_INCLUDE_CU_STD(utility)
11
12namespace Ponca
13{
27template <class DataPoint, class WeightKernel>
29{
30public:
32 using Scalar = typename DataPoint::Scalar;
34 using VectorType = typename DataPoint::VectorType;
36 using MatrixType = typename DataPoint::MatrixType;
38 using WeightReturnType = PONCA_MULTIARCH_CU_STD_NAMESPACE(pair)<Scalar, VectorType>;
39
44 PONCA_MULTIARCH inline DistWeightFunc(const Scalar& _t = Scalar(1.))
45 : m_p(VectorType::Zero())
46 {
47 //\todo manage that assrt on __host__ and __device__
48 //assert(_t > Scalar(0));
49 m_t = _t;
50 }
51
56 PONCA_MULTIARCH inline void init( const VectorType& _evalPos )
57 {
58 m_p = _evalPos;
59 }
60
62 PONCA_MULTIARCH inline const VectorType& basisCenter() const { return m_p; }
63
69 PONCA_MULTIARCH inline VectorType convertToGlobalBasis(const VectorType& _q) const;
70
76 PONCA_MULTIARCH inline VectorType convertToLocalBasis(const VectorType& _q) const;
77
92 PONCA_MULTIARCH inline WeightReturnType w(const VectorType& _q,
93 const DataPoint& /*attributes*/) const;
94
95
111 PONCA_MULTIARCH inline VectorType spacedw(const VectorType& _q,
112 const DataPoint& /*attributes*/) const;
113
114
135 PONCA_MULTIARCH inline MatrixType spaced2w(const VectorType& _q,
136 const DataPoint& /*attributes*/) const;
137
152 PONCA_MULTIARCH inline Scalar scaledw(const VectorType& _q,
153 const DataPoint& /*attributes*/) const;
154
173 PONCA_MULTIARCH inline Scalar scaled2w(const VectorType& _q,
174 const DataPoint& /*attributes*/) const;
175
195 PONCA_MULTIARCH inline VectorType scaleSpaced2w(const VectorType& _q,
196 const DataPoint& /*attributes*/) const;
197
199 PONCA_MULTIARCH inline Scalar evalScale() const { return m_t; }
200
202 PONCA_MULTIARCH inline const VectorType & evalPos() const { return m_p; }
203
204protected:
206 WeightKernel m_wk;
209};// class DistWeightFunc
210
211#include "weightFunc.hpp"
212
213}// namespace Ponca
Weighting function based on the euclidean distance between a query and a reference position.
Definition: weightFunc.h:29
VectorType convertToLocalBasis(const VectorType &_q) const
Convert query from global to local coordinate system (used internally(.
Definition: weightFunc.hpp:17
DistWeightFunc(const Scalar &_t=Scalar(1.))
Constructor that defines the current evaluation scale.
Definition: weightFunc.h:44
Scalar scaledw(const VectorType &_q, const DataPoint &) const
First order derivative in scale .
Definition: weightFunc.hpp:66
Scalar scaled2w(const VectorType &_q, const DataPoint &) const
Second order derivative in scale .
Definition: weightFunc.hpp:76
VectorType scaleSpaced2w(const VectorType &_q, const DataPoint &) const
Cross derivative in scale and in space (for each spatial dimension .
Definition: weightFunc.hpp:88
MatrixType spaced2w(const VectorType &_q, const DataPoint &) const
Second order derivative in space (for each spatial dimension .
Definition: weightFunc.hpp:47
typename DataPoint::MatrixType MatrixType
Matrix type from DataPoint.
Definition: weightFunc.h:36
Scalar evalScale() const
Access to the evaluation scale set during the initialization.
Definition: weightFunc.h:199
WeightReturnType w(const VectorType &_q, const DataPoint &) const
Compute the weight of the given query with respect to its coordinates.
Definition: weightFunc.hpp:24
VectorType convertToGlobalBasis(const VectorType &_q) const
Convert position from local to global coordinate system.
Definition: weightFunc.hpp:10
VectorType spacedw(const VectorType &_q, const DataPoint &) const
First order derivative in space (for each spatial dimension .
Definition: weightFunc.hpp:34
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
const VectorType & basisCenter() const
Get access to basis center location in global coordinate system.
Definition: weightFunc.h:62
WeightKernel m_wk
1D function applied to weight queries
Definition: weightFunc.h:206
Scalar m_t
Evaluation scale.
Definition: weightFunc.h:205
typename DataPoint::VectorType VectorType
Vector type from DataPoint.
Definition: weightFunc.h:34
const VectorType & evalPos() const
Access to the evaluation position set during the initialization.
Definition: weightFunc.h:202
VectorType m_p
basis center
Definition: weightFunc.h:207
void init(const VectorType &_evalPos)
Initialization method, called by the fitting procedure.
Definition: weightFunc.h:56
This Source Code Form is subject to the terms of the Mozilla Public License, v.