Ponca  93eea5457c48839cb5d16642765afa89fc7cfe66
Point Cloud Analysis library
Loading...
Searching...
No Matches
pointTypes.h
1/*
2This 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
16namespace Ponca {
17 // [PointPositionNormal]
19 template<typename _Scalar, int _Dim>
21 {
22 public:
23 enum {Dim = _Dim};
24 typedef _Scalar Scalar;
25 typedef Eigen::Matrix<Scalar, Dim, 1> VectorType;
26 typedef Eigen::Matrix<Scalar, Dim, Dim> MatrixType;
27
28 PONCA_MULTIARCH inline PointPositionNormal(
29 const VectorType &pos = VectorType::Zero(),
30 const VectorType& normal = VectorType::Zero()
31 ) : m_pos(pos), m_normal(normal) {}
32
34 PONCA_MULTIARCH [[nodiscard]] inline const VectorType& pos() const { return m_pos; }
36 PONCA_MULTIARCH [[nodiscard]] inline const VectorType& normal() const { return m_normal; }
38 PONCA_MULTIARCH [[nodiscard]] inline VectorType& pos() { return m_pos; }
40 PONCA_MULTIARCH [[nodiscard]] inline VectorType& normal() { return m_normal; }
41
42 private:
43 VectorType m_pos, m_normal;
44 };
45 // [PointPositionNormal]
46
47 // [PointPosition]
49 template<typename _Scalar, int _Dim>
51 {
52 public:
53 enum {Dim = _Dim};
54 typedef _Scalar Scalar;
55 typedef Eigen::Matrix<Scalar, Dim, 1> VectorType;
56 typedef Eigen::Matrix<Scalar, Dim, Dim> MatrixType;
57
58 PONCA_MULTIARCH inline PointPosition(
59 const VectorType &pos = VectorType::Zero()
60 ) : m_pos(pos) {}
61
63 PONCA_MULTIARCH [[nodiscard]] inline const VectorType& pos() const { return m_pos; }
65 PONCA_MULTIARCH [[nodiscard]] inline VectorType& pos() { return m_pos; }
66
67 private:
68 VectorType m_pos;
69 };
70 // [PointPosition]
71
72
73 // [PointPositionNormalBinding]
83 template<typename _Scalar, int _Dim>
85 {
86 public:
87 enum {Dim = _Dim};
88 typedef _Scalar Scalar;
89 typedef Eigen::Matrix<Scalar, Dim, 1> VectorType;
90 typedef Eigen::Matrix<Scalar, Dim, Dim> MatrixType;
91
92 PONCA_MULTIARCH inline PointPositionNormalBinding(
93 const Scalar* _interlacedArray, const int _pId
94 ) : m_pos (Eigen::Map< const VectorType >(_interlacedArray + Dim*2*_pId )),
95 m_normal(Eigen::Map< const VectorType >(_interlacedArray + Dim*2*_pId+Dim))
96 {}
97
99 PONCA_MULTIARCH [[nodiscard]] inline const Eigen::Map< const VectorType >& pos() const { return m_pos; }
101 PONCA_MULTIARCH [[nodiscard]] inline const Eigen::Map< const VectorType >& normal() const { return m_normal; }
102
103 private:
104 const Eigen::Map< const VectorType > m_pos, m_normal;
105 };
106 // [PointPositionNormalBinding]
107
108 // [PointPositionNormalLazyBinding]
119 template<typename _Scalar, int _Dim>
121 {
122 public:
123 enum {Dim = _Dim};
124 typedef _Scalar Scalar;
125 typedef Eigen::Matrix<Scalar, Dim, 1> VectorType;
126 typedef Eigen::Matrix<Scalar, Dim, Dim> MatrixType;
127
128 PONCA_MULTIARCH inline PointPositionNormalLazyBinding(Scalar* _interlacedArray, const int _pId)
129 : m_interlacedArray (_interlacedArray),
130 m_id(_pId)
131 {}
132
134 PONCA_MULTIARCH inline void bind(Scalar* _interlacedArray) {
135 m_interlacedArray = _interlacedArray;
136 }
137
139 PONCA_MULTIARCH [[nodiscard]] inline Eigen::Map< const VectorType > pos() const { return Eigen::Map< const VectorType >(m_interlacedArray + Dim*2*m_id); }
141 PONCA_MULTIARCH [[nodiscard]] inline Eigen::Map< const VectorType > normal() const { return Eigen::Map< const VectorType >(m_interlacedArray + Dim*2*m_id+Dim); }
142
143 private:
144 Scalar * m_interlacedArray;
145 const int m_id;
146 };
147 // [PointPositionNormalLazyBinding]
148}
Variant of the PointPositionNormal data type that uses external raw data.
Definition pointTypes.h:85
const Eigen::Map< const VectorType > & normal() const
Get the point normal.
Definition pointTypes.h:101
const Eigen::Map< const VectorType > & pos() const
Get the point position.
Definition pointTypes.h:99
Variant of the PointPositionNormal data type that uses external raw data.
Definition pointTypes.h:121
Eigen::Map< const VectorType > pos() const
Get the point position.
Definition pointTypes.h:139
void bind(Scalar *_interlacedArray)
Allows change of reference.
Definition pointTypes.h:134
Eigen::Map< const VectorType > normal() const
Get the point normal.
Definition pointTypes.h:141
Point data type containing the position and normal vectors.
Definition pointTypes.h:21
VectorType & normal()
Get the point normal.
Definition pointTypes.h:40
const VectorType & pos() const
Get the point position.
Definition pointTypes.h:34
const VectorType & normal() const
Get the point normal.
Definition pointTypes.h:36
VectorType & pos()
Get the point position.
Definition pointTypes.h:38
Point data type containing only containing the position vector.
Definition pointTypes.h:51
const VectorType & pos() const
Get the point position.
Definition pointTypes.h:63
VectorType & pos()
Get the point position.
Definition pointTypes.h:65
This Source Code Form is subject to the terms of the Mozilla Public License, v.