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