Ponca  6f9f1b59d7c8c4654a710cfcef7342f4f5c79ba1
Point Cloud Analysis library
Loading...
Searching...
No Matches
frame.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
9namespace Ponca
10{
26 template <class DataPoint>
28 {
29 public:
31 using Scalar = typename DataPoint::Scalar;
33 using VectorType = typename DataPoint::VectorType;
34
36 static constexpr bool hasLocalFrame = true;
37
38 PONCA_MULTIARCH inline explicit CenteredNeighborhoodFrame(const VectorType& _evalPos = VectorType::Zero())
39 : m_p(_evalPos)
40 {
41 }
42
43 PONCA_MULTIARCH inline explicit CenteredNeighborhoodFrame(const DataPoint& _evalPoint) : m_p(_evalPoint.pos())
44 {
45 }
46
47 PONCA_MULTIARCH inline VectorType center() { return m_p; }
48 PONCA_MULTIARCH inline VectorType center() const { return m_p; }
49
53 PONCA_MULTIARCH inline void changeNeighborhoodFrame(const VectorType& _newEvalPos) { m_p = _newEvalPos; };
54
65 PONCA_MULTIARCH [[nodiscard]] inline VectorType convertToGlobalBasis(const VectorType& _q,
66 bool _isPositionVector = true) const
67 {
68 return (_isPositionVector ? (_q + m_p) : _q);
69 }
70
82 PONCA_MULTIARCH [[nodiscard]] inline VectorType convertToLocalBasis(const VectorType& _q,
83 bool _isPositionVector = true) const
84 {
85 return (_isPositionVector ? (_q - m_p) : _q);
86 }
87
88 private:
89 VectorType m_p;
90 };
104 template <class DataPoint>
106 {
107 public:
109 using Scalar = typename DataPoint::Scalar;
111 using VectorType = typename DataPoint::VectorType;
112
114 static constexpr bool hasLocalFrame = false;
115
116 PONCA_MULTIARCH inline explicit GlobalNeighborhoodFrame(const VectorType& /*_evalPos*/ = VectorType::Zero()) {}
117
121 PONCA_MULTIARCH inline void changeNeighborhoodFrame(const VectorType& /*_newEvalPos*/) {};
122
123 PONCA_MULTIARCH inline VectorType center() { return VectorType::Zero(); }
124 PONCA_MULTIARCH inline VectorType center() const { return VectorType::Zero(); }
132 PONCA_MULTIARCH [[nodiscard]] inline const VectorType& convertToGlobalBasis(
133 const VectorType& _q, bool /*_isPositionVector*/ = true) const
134 {
135 return _q;
136 }
137
145 PONCA_MULTIARCH [[nodiscard]] inline const VectorType& convertToLocalBasis(
146 const VectorType& _q, bool /*_isPositionVector*/ = true) const
147 {
148 return _q;
149 }
150 };
151}; // namespace Ponca
Aggregator class used to declare specialized structures using CRTP.
Definition basket.h:260
NeighborhoodFrame that express 3d points relatively to a prescribed center.
Definition frame.h:28
VectorType convertToLocalBasis(const VectorType &_q, bool _isPositionVector=true) const
Convert query from global to local coordinate system, such as .
Definition frame.h:82
VectorType convertToGlobalBasis(const VectorType &_q, bool _isPositionVector=true) const
Convert query from local to global coordinate system, such as .
Definition frame.h:65
typename DataPoint::VectorType VectorType
Vector type from DataPoint.
Definition frame.h:33
typename DataPoint::Scalar Scalar
Scalar type from DataPoint.
Definition frame.h:31
void changeNeighborhoodFrame(const VectorType &_newEvalPos)
Change neighborhood frame (move basis center)
Definition frame.h:53
static constexpr bool hasLocalFrame
Flag indicating that this class modifies the coordinates when passing from global to local.
Definition frame.h:36
NeighborhoodFrame that keep points in the global frame without applying any transformation This class...
Definition frame.h:106
static constexpr bool hasLocalFrame
Flag indicating that this class does not modify the coordinates when passing from global to local.
Definition frame.h:114
typename DataPoint::Scalar Scalar
Scalar type from DataPoint.
Definition frame.h:109
void changeNeighborhoodFrame(const VectorType &)
Change neighborhood frame (has no effect for global basis)
Definition frame.h:121
typename DataPoint::VectorType VectorType
Vector type from DataPoint.
Definition frame.h:111
const VectorType & convertToGlobalBasis(const VectorType &_q, bool=true) const
Convert position from local to global coordinate system : does nothing as this is global frame.
Definition frame.h:132
const VectorType & convertToLocalBasis(const VectorType &_q, bool=true) const
Convert query from global to local coordinate system : does nothing as this is global frame.
Definition frame.h:145
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition concepts.h:11