Point Cloud Library (PCL)  1.14.0-dev
point_types.hpp
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010, Willow Garage, Inc.
6  * Copyright (c) 2012-, Open Perception, Inc.
7  *
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * * Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  * * Redistributions in binary form must reproduce the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer in the documentation and/or other materials provided
19  * with the distribution.
20  * * Neither the name of the copyright holder(s) nor the names of its
21  * contributors may be used to endorse or promote products derived
22  * from this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  * POSSIBILITY OF SUCH DAMAGE.
36  *
37  */
38 
39 #pragma once
40 
41 #include <pcl/memory.h> // for PCL_MAKE_ALIGNED_OPERATOR_NEW
42 #include <pcl/pcl_macros.h> // for PCL_EXPORTS
43 #include <pcl/PCLPointField.h> // for PCLPointField
44 #include <pcl/point_types.h> // implementee
45 #include <pcl/register_point_struct.h> // for POINT_CLOUD_REGISTER_POINT_STRUCT, POINT_CLOUD_REGISTER_POINT_WRAPPER
46 
47 #include <boost/mpl/and.hpp> // for boost::mpl::and_
48 #include <boost/mpl/bool.hpp> // for boost::mpl::bool_
49 #include <boost/mpl/contains.hpp> // for boost::mpl::contains
50 #include <boost/mpl/fold.hpp> // for boost::mpl::fold
51 #include <boost/mpl/or.hpp> // for boost::mpl::or_
52 #include <boost/mpl/placeholders.hpp> // for boost::mpl::_1, boost::mpl::_2
53 #include <boost/mpl/vector.hpp> // for boost::mpl::vector
54 
55 #include <Eigen/Core> // for MatrixMap
56 
57 #include <algorithm> // for copy_n, fill_n
58 #include <cstdint> // for uint8_t, uint32_t
59 #include <ostream> // for ostream, operator<<
60 #include <type_traits> // for enable_if_t
61 
62 // Define all PCL point types
63 #define PCL_POINT_TYPES \
64  (pcl::PointXYZ) \
65  (pcl::PointXYZI) \
66  (pcl::PointXYZL) \
67  (pcl::Label) \
68  (pcl::PointXYZRGBA) \
69  (pcl::PointXYZRGB) \
70  (pcl::PointXYZRGBL) \
71  (pcl::PointXYZLAB) \
72  (pcl::PointXYZHSV) \
73  (pcl::PointXY) \
74  (pcl::InterestPoint) \
75  (pcl::Axis) \
76  (pcl::Normal) \
77  (pcl::PointNormal) \
78  (pcl::PointXYZRGBNormal) \
79  (pcl::PointXYZINormal) \
80  (pcl::PointXYZLNormal) \
81  (pcl::PointWithRange) \
82  (pcl::PointWithViewpoint) \
83  (pcl::MomentInvariants) \
84  (pcl::PrincipalRadiiRSD) \
85  (pcl::Boundary) \
86  (pcl::PrincipalCurvatures) \
87  (pcl::PFHSignature125) \
88  (pcl::PFHRGBSignature250) \
89  (pcl::PPFSignature) \
90  (pcl::CPPFSignature) \
91  (pcl::PPFRGBSignature) \
92  (pcl::NormalBasedSignature12) \
93  (pcl::FPFHSignature33) \
94  (pcl::VFHSignature308) \
95  (pcl::GASDSignature512) \
96  (pcl::GASDSignature984) \
97  (pcl::GASDSignature7992) \
98  (pcl::GRSDSignature21) \
99  (pcl::ESFSignature640) \
100  (pcl::BRISKSignature512) \
101  (pcl::Narf36) \
102  (pcl::IntensityGradient) \
103  (pcl::PointWithScale) \
104  (pcl::PointSurfel) \
105  (pcl::ShapeContext1980) \
106  (pcl::UniqueShapeContext1960) \
107  (pcl::SHOT352) \
108  (pcl::SHOT1344) \
109  (pcl::PointUV) \
110  (pcl::ReferenceFrame) \
111  (pcl::PointDEM)
112 
113 // Define all point types that include RGB data
114 #define PCL_RGB_POINT_TYPES \
115  (pcl::PointXYZRGBA) \
116  (pcl::PointXYZRGB) \
117  (pcl::PointXYZRGBL) \
118  (pcl::PointXYZRGBNormal) \
119  (pcl::PointSurfel) \
120 
121 // Define all point types that include XYZ data
122 #define PCL_XYZ_POINT_TYPES \
123  (pcl::PointXYZ) \
124  (pcl::PointXYZI) \
125  (pcl::PointXYZL) \
126  (pcl::PointXYZRGBA) \
127  (pcl::PointXYZRGB) \
128  (pcl::PointXYZRGBL) \
129  (pcl::PointXYZLAB) \
130  (pcl::PointXYZHSV) \
131  (pcl::InterestPoint) \
132  (pcl::PointNormal) \
133  (pcl::PointXYZRGBNormal) \
134  (pcl::PointXYZINormal) \
135  (pcl::PointXYZLNormal) \
136  (pcl::PointWithRange) \
137  (pcl::PointWithViewpoint) \
138  (pcl::PointWithScale) \
139  (pcl::PointSurfel) \
140  (pcl::PointDEM)
141 
142 // Define all point types with XYZ and label
143 #define PCL_XYZL_POINT_TYPES \
144  (pcl::PointXYZL) \
145  (pcl::PointXYZRGBL) \
146  (pcl::PointXYZLNormal)
147 
148 // Define all point types that include normal[3] data
149 #define PCL_NORMAL_POINT_TYPES \
150  (pcl::Normal) \
151  (pcl::PointNormal) \
152  (pcl::PointXYZRGBNormal) \
153  (pcl::PointXYZINormal) \
154  (pcl::PointXYZLNormal) \
155  (pcl::PointSurfel)
156 
157 // Define all point types that represent features
158 #define PCL_FEATURE_POINT_TYPES \
159  (pcl::PFHSignature125) \
160  (pcl::PFHRGBSignature250) \
161  (pcl::PPFSignature) \
162  (pcl::CPPFSignature) \
163  (pcl::PPFRGBSignature) \
164  (pcl::NormalBasedSignature12) \
165  (pcl::FPFHSignature33) \
166  (pcl::VFHSignature308) \
167  (pcl::GASDSignature512) \
168  (pcl::GASDSignature984) \
169  (pcl::GASDSignature7992) \
170  (pcl::GRSDSignature21) \
171  (pcl::ESFSignature640) \
172  (pcl::BRISKSignature512) \
173  (pcl::Narf36)
174 
175 // Define all point types that have descriptorSize() member function
176 #define PCL_DESCRIPTOR_FEATURE_POINT_TYPES \
177  (pcl::PFHSignature125) \
178  (pcl::PFHRGBSignature250) \
179  (pcl::FPFHSignature33) \
180  (pcl::VFHSignature308) \
181  (pcl::GASDSignature512) \
182  (pcl::GASDSignature984) \
183  (pcl::GASDSignature7992) \
184  (pcl::GRSDSignature21) \
185  (pcl::ESFSignature640) \
186  (pcl::BRISKSignature512) \
187  (pcl::Narf36)
188 
189 
190 namespace pcl
191 {
192  namespace detail
193  {
194  namespace traits
195  {
196  template<typename FeaturePointT> struct descriptorSize {};
197 
198  template<> struct descriptorSize<PFHSignature125> { static constexpr const int value = 125; };
199  template<> struct descriptorSize<PFHRGBSignature250> { static constexpr const int value = 250; };
200  template<> struct descriptorSize<ShapeContext1980> { static constexpr const int value = 1980; };
201  template<> struct descriptorSize<UniqueShapeContext1960> { static constexpr const int value = 1960; };
202  template<> struct descriptorSize<SHOT352> { static constexpr const int value = 352; };
203  template<> struct descriptorSize<SHOT1344> { static constexpr const int value = 1344; };
204  template<> struct descriptorSize<FPFHSignature33> { static constexpr const int value = 33; };
205  template<> struct descriptorSize<VFHSignature308> { static constexpr const int value = 308; };
206  template<> struct descriptorSize<GRSDSignature21> { static constexpr const int value = 21; };
207  template<> struct descriptorSize<BRISKSignature512> { static constexpr const int value = 512; };
208  template<> struct descriptorSize<ESFSignature640> { static constexpr const int value = 640; };
209  template<> struct descriptorSize<GASDSignature512> { static constexpr const int value = 512; };
210  template<> struct descriptorSize<GASDSignature984> { static constexpr const int value = 984; };
211  template<> struct descriptorSize<GASDSignature7992> { static constexpr const int value = 7992; };
212  template<> struct descriptorSize<GFPFHSignature16> { static constexpr const int value = 16; };
213  template<> struct descriptorSize<Narf36> { static constexpr const int value = 36; };
214  template<int N> struct descriptorSize<Histogram<N>> { static constexpr const int value = N; };
215 
216 
217  template<typename FeaturePointT>
219  }
220  }
221 
222  using Vector2fMap = Eigen::Map<Eigen::Vector2f>;
223  using Vector2fMapConst = const Eigen::Map<const Eigen::Vector2f>;
224  using Array3fMap = Eigen::Map<Eigen::Array3f>;
225  using Array3fMapConst = const Eigen::Map<const Eigen::Array3f>;
226  using Array4fMap = Eigen::Map<Eigen::Array4f, Eigen::Aligned>;
227  using Array4fMapConst = const Eigen::Map<const Eigen::Array4f, Eigen::Aligned>;
228  using Vector3fMap = Eigen::Map<Eigen::Vector3f>;
229  using Vector3fMapConst = const Eigen::Map<const Eigen::Vector3f>;
230  using Vector4fMap = Eigen::Map<Eigen::Vector4f, Eigen::Aligned>;
231  using Vector4fMapConst = const Eigen::Map<const Eigen::Vector4f, Eigen::Aligned>;
232 
233  using Vector3c = Eigen::Matrix<std::uint8_t, 3, 1>;
234  using Vector3cMap = Eigen::Map<Vector3c>;
235  using Vector3cMapConst = const Eigen::Map<const Vector3c>;
236  using Vector4c = Eigen::Matrix<std::uint8_t, 4, 1>;
237  using Vector4cMap = Eigen::Map<Vector4c, Eigen::Aligned>;
238  using Vector4cMapConst = const Eigen::Map<const Vector4c, Eigen::Aligned>;
239 
240 #define PCL_ADD_UNION_POINT4D \
241  union EIGEN_ALIGN16 { \
242  float data[4]; \
243  struct { \
244  float x; \
245  float y; \
246  float z; \
247  }; \
248  };
249 
250 #define PCL_ADD_EIGEN_MAPS_POINT4D \
251  inline pcl::Vector2fMap getVector2fMap () { return (pcl::Vector2fMap (data)); } \
252  inline pcl::Vector2fMapConst getVector2fMap () const { return (pcl::Vector2fMapConst (data)); } \
253  inline pcl::Vector3fMap getVector3fMap () { return (pcl::Vector3fMap (data)); } \
254  inline pcl::Vector3fMapConst getVector3fMap () const { return (pcl::Vector3fMapConst (data)); } \
255  inline pcl::Vector4fMap getVector4fMap () { return (pcl::Vector4fMap (data)); } \
256  inline pcl::Vector4fMapConst getVector4fMap () const { return (pcl::Vector4fMapConst (data)); } \
257  inline pcl::Array3fMap getArray3fMap () { return (pcl::Array3fMap (data)); } \
258  inline pcl::Array3fMapConst getArray3fMap () const { return (pcl::Array3fMapConst (data)); } \
259  inline pcl::Array4fMap getArray4fMap () { return (pcl::Array4fMap (data)); } \
260  inline pcl::Array4fMapConst getArray4fMap () const { return (pcl::Array4fMapConst (data)); }
261 
262 #define PCL_ADD_POINT4D \
263  PCL_ADD_UNION_POINT4D \
264  PCL_ADD_EIGEN_MAPS_POINT4D
265 
266 #define PCL_ADD_UNION_NORMAL4D \
267  union EIGEN_ALIGN16 { \
268  float data_n[4]; \
269  float normal[3]; \
270  struct { \
271  float normal_x; \
272  float normal_y; \
273  float normal_z; \
274  }; \
275  };
276 
277 #define PCL_ADD_EIGEN_MAPS_NORMAL4D \
278  inline pcl::Vector3fMap getNormalVector3fMap () { return (pcl::Vector3fMap (data_n)); } \
279  inline pcl::Vector3fMapConst getNormalVector3fMap () const { return (pcl::Vector3fMapConst (data_n)); } \
280  inline pcl::Vector4fMap getNormalVector4fMap () { return (pcl::Vector4fMap (data_n)); } \
281  inline pcl::Vector4fMapConst getNormalVector4fMap () const { return (pcl::Vector4fMapConst (data_n)); }
282 
283 #define PCL_ADD_NORMAL4D \
284  PCL_ADD_UNION_NORMAL4D \
285  PCL_ADD_EIGEN_MAPS_NORMAL4D
286 
287 #define PCL_ADD_UNION_RGB \
288  union \
289  { \
290  union \
291  { \
292  struct \
293  { \
294  std::uint8_t b; \
295  std::uint8_t g; \
296  std::uint8_t r; \
297  std::uint8_t a; \
298  }; \
299  float rgb; \
300  }; \
301  std::uint32_t rgba; \
302  };
303 
304 #define PCL_ADD_EIGEN_MAPS_RGB \
305  inline Eigen::Vector3i getRGBVector3i () { return (Eigen::Vector3i (r, g, b)); } \
306  inline const Eigen::Vector3i getRGBVector3i () const { return (Eigen::Vector3i (r, g, b)); } \
307  inline Eigen::Vector4i getRGBVector4i () { return (Eigen::Vector4i (r, g, b, a)); } \
308  inline const Eigen::Vector4i getRGBVector4i () const { return (Eigen::Vector4i (r, g, b, a)); } \
309  inline Eigen::Vector4i getRGBAVector4i () { return (Eigen::Vector4i (r, g, b, a)); } \
310  inline const Eigen::Vector4i getRGBAVector4i () const { return (Eigen::Vector4i (r, g, b, a)); } \
311  inline pcl::Vector3cMap getBGRVector3cMap () { return (pcl::Vector3cMap (reinterpret_cast<std::uint8_t*> (&rgba))); } \
312  inline pcl::Vector3cMapConst getBGRVector3cMap () const { return (pcl::Vector3cMapConst (reinterpret_cast<const std::uint8_t*> (&rgba))); } \
313  inline pcl::Vector4cMap getBGRAVector4cMap () { return (pcl::Vector4cMap (reinterpret_cast<std::uint8_t*> (&rgba))); } \
314  inline pcl::Vector4cMapConst getBGRAVector4cMap () const { return (pcl::Vector4cMapConst (reinterpret_cast<const std::uint8_t*> (&rgba))); }
315 
316 #define PCL_ADD_RGB \
317  PCL_ADD_UNION_RGB \
318  PCL_ADD_EIGEN_MAPS_RGB
319 
320 #define PCL_ADD_INTENSITY \
321  struct \
322  { \
323  float intensity; \
324  }; \
325 
326 #define PCL_ADD_INTENSITY_8U \
327  struct \
328  { \
329  std::uint8_t intensity; \
330  }; \
331 
332 #define PCL_ADD_INTENSITY_32U \
333  struct \
334  { \
335  std::uint32_t intensity; \
336  }; \
337 
338 
339  struct _PointXYZ
340  {
341  PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
342 
344  };
345 
346  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZ& p);
347  /** \brief A point structure representing Euclidean xyz coordinates. (SSE friendly)
348  * \ingroup common
349  */
350  struct EIGEN_ALIGN16 PointXYZ : public _PointXYZ
351  {
352  inline constexpr PointXYZ (const _PointXYZ &p): PointXYZ(p.x, p.y, p.z) {}
353 
354  inline constexpr PointXYZ (): PointXYZ(0.f, 0.f, 0.f) {}
355 
356  inline constexpr PointXYZ (float _x, float _y, float _z) : _PointXYZ{{{_x, _y, _z, 1.f}}} {}
357 
358  friend std::ostream& operator << (std::ostream& os, const PointXYZ& p);
360  };
361 
362 
363 #ifdef RGB
364 #undef RGB
365 #endif
366  struct _RGB
367  {
368  PCL_ADD_RGB
369  };
370 
371  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const RGB& p);
372  /** \brief A structure representing RGB color information.
373  *
374  * The RGBA information is available either as separate r, g, b, or as a
375  * packed std::uint32_t rgba value. To pack it, use:
376  *
377  * \code
378  * int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b);
379  * \endcode
380  *
381  * To unpack it use:
382  *
383  * \code
384  * int rgb = ...;
385  * std::uint8_t r = (rgb >> 16) & 0x0000ff;
386  * std::uint8_t g = (rgb >> 8) & 0x0000ff;
387  * std::uint8_t b = (rgb) & 0x0000ff;
388  * \endcode
389  *
390  */
391  struct RGB: public _RGB
392  {
393  inline constexpr RGB (const _RGB &p) : RGB{p.r, p.g, p.b, p.a} {}
394 
395  inline constexpr RGB (): RGB(0, 0, 0) {}
396 
397  inline constexpr RGB (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a = 255) : _RGB{{{{_b, _g, _r, _a}}}} {}
398 
399  friend std::ostream& operator << (std::ostream& os, const RGB& p);
400  };
401 
402  struct _Intensity
403  {
404  PCL_ADD_INTENSITY
405  };
406 
407  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Intensity& p);
408  /** \brief A point structure representing the grayscale intensity in single-channel images.
409  * Intensity is represented as a float value.
410  * \ingroup common
411  */
412  struct Intensity: public _Intensity
413  {
414  inline constexpr Intensity (const _Intensity &p) : Intensity{p.intensity} {}
415 
416  inline constexpr Intensity (float _intensity = 0.f) : _Intensity{_intensity} {}
417 
418  friend std::ostream& operator << (std::ostream& os, const Intensity& p);
419  };
420 
421 
423  {
425  };
426 
427  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Intensity8u& p);
428  /** \brief A point structure representing the grayscale intensity in single-channel images.
429  * Intensity is represented as a std::uint8_t value.
430  * \ingroup common
431  */
432  struct Intensity8u: public _Intensity8u
433  {
434  inline constexpr Intensity8u (const _Intensity8u &p) : Intensity8u{p.intensity} {}
435 
436  inline constexpr Intensity8u (std::uint8_t _intensity = 0) : _Intensity8u{_intensity} {}
437 
438 #if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 1101
439  inline constexpr operator unsigned char() const
440  {
441  return intensity;
442  }
443 #endif
444 
445  friend std::ostream& operator << (std::ostream& os, const Intensity8u& p);
446  };
447 
449  {
451  };
452 
453  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Intensity32u& p);
454  /** \brief A point structure representing the grayscale intensity in single-channel images.
455  * Intensity is represented as a std::uint32_t value.
456  * \ingroup common
457  */
459  {
460  inline constexpr Intensity32u (const _Intensity32u &p) : Intensity32u{p.intensity} {}
461 
462  inline constexpr Intensity32u (std::uint32_t _intensity = 0) : _Intensity32u{_intensity} {}
463 
464  friend std::ostream& operator << (std::ostream& os, const Intensity32u& p);
465  };
466 
467  /** \brief A point structure representing Euclidean xyz coordinates, and the intensity value.
468  * \ingroup common
469  */
470  struct EIGEN_ALIGN16 _PointXYZI
471  {
472  PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
473  union
474  {
475  struct
476  {
477  float intensity;
478  };
479  float data_c[4];
480  };
482  };
483 
484  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZI& p);
485  struct PointXYZI : public _PointXYZI
486  {
487  inline constexpr PointXYZI (const _PointXYZI &p) : PointXYZI{p.x, p.y, p.z, p.intensity} {}
488 
489  inline constexpr PointXYZI (float _intensity = 0.f) : PointXYZI(0.f, 0.f, 0.f, _intensity) {}
490 
491  inline constexpr PointXYZI (float _x, float _y, float _z, float _intensity = 0.f) : _PointXYZI{{{_x, _y, _z, 1.0f}}, {{_intensity}}} {}
492 
493  friend std::ostream& operator << (std::ostream& os, const PointXYZI& p);
494  };
495 
496 
497  struct EIGEN_ALIGN16 _PointXYZL
498  {
499  PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
500  std::uint32_t label;
502  };
503 
504  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZL& p);
505  struct PointXYZL : public _PointXYZL
506  {
507  inline constexpr PointXYZL (const _PointXYZL &p) : PointXYZL{p.x, p.y, p.z, p.label} {}
508 
509  inline constexpr PointXYZL (std::uint32_t _label = 0) : PointXYZL(0.f, 0.f, 0.f, _label) {}
510 
511  inline constexpr PointXYZL (float _x, float _y, float _z, std::uint32_t _label = 0) : _PointXYZL{{{_x, _y, _z, 1.0f}}, _label} {}
512 
513  friend std::ostream& operator << (std::ostream& os, const PointXYZL& p);
514  };
515 
516 
517  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Label& p);
518  struct Label
519  {
520  std::uint32_t label = 0;
521 
522  inline constexpr Label (std::uint32_t _label = 0): label(_label) {}
523 
524  friend std::ostream& operator << (std::ostream& os, const Label& p);
525  };
526 
527 
528  struct EIGEN_ALIGN16 _PointXYZRGBA
529  {
530  PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
531  PCL_ADD_RGB
533  };
534 
535  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBA& p);
536  /** \brief A point structure representing Euclidean xyz coordinates, and the RGBA color.
537  *
538  * The RGBA information is available either as separate r, g, b, or as a
539  * packed std::uint32_t rgba value. To pack it, use:
540  *
541  * \code
542  * int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b);
543  * \endcode
544  *
545  * To unpack it use:
546  *
547  * \code
548  * int rgb = ...;
549  * std::uint8_t r = (rgb >> 16) & 0x0000ff;
550  * std::uint8_t g = (rgb >> 8) & 0x0000ff;
551  * std::uint8_t b = (rgb) & 0x0000ff;
552  * \endcode
553  *
554  * \ingroup common
555  */
556  struct EIGEN_ALIGN16 PointXYZRGBA : public _PointXYZRGBA
557  {
558  inline constexpr PointXYZRGBA (const _PointXYZRGBA &p) : PointXYZRGBA{p.x, p.y, p.z, p.r, p.g, p.b, p.a} {}
559 
560  inline constexpr PointXYZRGBA (): PointXYZRGBA (0, 0, 0, 255) {}
561 
562  inline constexpr PointXYZRGBA (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a):
563  PointXYZRGBA (0.f, 0.f, 0.f, _r, _g, _b, _a) {}
564 
565  inline constexpr PointXYZRGBA (float _x, float _y, float _z):
566  PointXYZRGBA (_x, _y, _z, 0, 0, 0, 255) {}
567 
568  inline constexpr PointXYZRGBA (float _x, float _y, float _z, std::uint8_t _r,
569  std::uint8_t _g, std::uint8_t _b, std::uint8_t _a) : _PointXYZRGBA{{{_x, _y, _z, 1.0f}}, {{{_b, _g, _r, _a}}}} {}
570 
571  friend std::ostream& operator << (std::ostream& os, const PointXYZRGBA& p);
572  };
573 
574 
575  struct EIGEN_ALIGN16 _PointXYZRGB
576  {
577  PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
578  PCL_ADD_RGB
580  };
581 
582  struct EIGEN_ALIGN16 _PointXYZRGBL
583  {
584  PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
585  PCL_ADD_RGB
586  std::uint32_t label;
588  };
589 
590  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGB& p);
591  /** \brief A point structure representing Euclidean xyz coordinates, and the RGB color.
592  *
593  * Due to historical reasons (PCL was first developed as a ROS package), the
594  * RGB information is packed into an integer and casted to a float. This is
595  * something we wish to remove in the near future, but in the meantime, the
596  * following code snippet should help you pack and unpack RGB colors in your
597  * PointXYZRGB structure:
598  *
599  * \code
600  * // pack r/g/b into rgb
601  * std::uint8_t r = 255, g = 0, b = 0; // Example: Red color
602  * std::uint32_t rgb = ((std::uint32_t)r << 16 | (std::uint32_t)g << 8 | (std::uint32_t)b);
603  * p.rgb = *reinterpret_cast<float*>(&rgb);
604  * \endcode
605  *
606  * To unpack the data into separate values, use:
607  *
608  * \code
609  * PointXYZRGB p;
610  * // unpack rgb into r/g/b
611  * std::uint32_t rgb = *reinterpret_cast<int*>(&p.rgb);
612  * std::uint8_t r = (rgb >> 16) & 0x0000ff;
613  * std::uint8_t g = (rgb >> 8) & 0x0000ff;
614  * std::uint8_t b = (rgb) & 0x0000ff;
615  * \endcode
616  *
617  *
618  * Alternatively, from 1.1.0 onwards, you can use p.r, p.g, and p.b directly.
619  *
620  * \ingroup common
621  */
622  struct EIGEN_ALIGN16 PointXYZRGB : public _PointXYZRGB
623  {
624  inline constexpr PointXYZRGB (const _PointXYZRGB &p) : PointXYZRGB{p.x, p.y, p.z, p.r, p.g, p.b} {}
625 
626  inline constexpr PointXYZRGB (): PointXYZRGB (0.f, 0.f, 0.f) {}
627 
628  inline constexpr PointXYZRGB (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
629  PointXYZRGB (0.f, 0.f, 0.f, _r, _g, _b) {}
630 
631  inline constexpr PointXYZRGB (float _x, float _y, float _z):
632  PointXYZRGB (_x, _y, _z, 0, 0, 0) {}
633 
634  inline constexpr PointXYZRGB (float _x, float _y, float _z,
635  std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
636  _PointXYZRGB{{{_x, _y, _z, 1.0f}}, {{{_b, _g, _r, 255}}}} {}
637 
638  friend std::ostream& operator << (std::ostream& os, const PointXYZRGB& p);
640  };
641 
642 
643  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBL& p);
644  struct EIGEN_ALIGN16 PointXYZRGBL : public _PointXYZRGBL
645  {
646  inline constexpr PointXYZRGBL (const _PointXYZRGBL &p) : PointXYZRGBL{p.x, p.y, p.z, p.r, p.g, p.b, p.label, p.a} {}
647 
648  inline constexpr PointXYZRGBL (std::uint32_t _label = 0):
649  PointXYZRGBL (0.f, 0.f, 0.f, 0, 0, 0, _label) {}
650 
651  inline constexpr PointXYZRGBL (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
652  PointXYZRGBL (0.f, 0.f, 0.f, _r, _g, _b) {}
653 
654  inline constexpr PointXYZRGBL (float _x, float _y, float _z):
655  PointXYZRGBL (_x, _y, _z, 0, 0, 0) {}
656 
657  inline constexpr PointXYZRGBL (float _x, float _y, float _z,
658  std::uint8_t _r, std::uint8_t _g, std::uint8_t _b,
659  std::uint32_t _label = 0, std::uint8_t _a = 255) :
660  _PointXYZRGBL{{{_x, _y, _z, 1.0f}}, {{{_b, _g, _r, _a}}}, _label} {}
661 
662  friend std::ostream& operator << (std::ostream& os, const PointXYZRGBL& p);
664  };
665 
666 
667  struct EIGEN_ALIGN16 _PointXYZLAB
668  {
669  PCL_ADD_POINT4D // this adds the members x,y,z
670  union
671  {
672  struct
673  {
674  float L;
675  float a;
676  float b;
677  };
678  float data_lab[4];
679  };
681  };
682 
683  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZLAB& p);
684  /** \brief A point structure representing Euclidean xyz coordinates, and the CIELAB color.
685  * \ingroup common
686  */
687  struct PointXYZLAB : public _PointXYZLAB
688  {
689  inline constexpr PointXYZLAB (const _PointXYZLAB &p) : PointXYZLAB{p.x, p.y, p.z, p.L, p.a, p.b} {}
690 
691  inline constexpr PointXYZLAB() : PointXYZLAB{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f} {}
692 
693  inline constexpr PointXYZLAB (float _x, float _y, float _z,
694  float _l, float _a, float _b) :
695  _PointXYZLAB{ {{_x, _y, _z, 1.0f}}, {{_l, _a, _b}} } {}
696 
697  friend std::ostream& operator << (std::ostream& os, const PointXYZLAB& p);
699  };
700 
701 
702  struct EIGEN_ALIGN16 _PointXYZHSV
703  {
704  PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
705  union
706  {
707  struct
708  {
709  float h;
710  float s;
711  float v;
712  };
713  float data_c[4];
714  };
716  };
717 
718  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZHSV& p);
719  struct EIGEN_ALIGN16 PointXYZHSV : public _PointXYZHSV
720  {
721  inline constexpr PointXYZHSV (const _PointXYZHSV &p) :
722  PointXYZHSV{p.x, p.y, p.z, p.h, p.s, p.v} {}
723 
724  inline constexpr PointXYZHSV (): PointXYZHSV (0.f, 0.f, 0.f) {}
725 
726  // @TODO: Use strong types??
727  // This is a dangerous type, doesn't behave like others
728  inline constexpr PointXYZHSV (float _h, float _s, float _v):
729  PointXYZHSV (0.f, 0.f, 0.f, _h, _s, _v) {}
730 
731  inline constexpr PointXYZHSV (float _x, float _y, float _z,
732  float _h, float _s, float _v) :
733  _PointXYZHSV{{{_x, _y, _z, 1.0f}}, {{_h, _s, _v}}} {}
734 
735  friend std::ostream& operator << (std::ostream& os, const PointXYZHSV& p);
737  };
738 
739  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXY& p);
740  /** \brief A 2D point structure representing Euclidean xy coordinates.
741  * \ingroup common
742  */
743  // NOLINTBEGIN(modernize-use-default-member-init)
744  struct PointXY
745  {
746  union
747  {
748  float data[2];
749  struct
750  {
751  float x;
752  float y;
753  };
754  };
755 
756  inline constexpr PointXY(float _x, float _y): x(_x), y(_y) {}
757  inline constexpr PointXY(): x(0.0f), y(0.0f) {}
758 
759  inline pcl::Vector2fMap getVector2fMap () { return (pcl::Vector2fMap (data)); }
760  inline pcl::Vector2fMapConst getVector2fMap () const { return (pcl::Vector2fMapConst (data)); }
761 
762  friend std::ostream& operator << (std::ostream& os, const PointXY& p);
763  };
764  // NOLINTEND(modernize-use-default-member-init)
765 
766  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointUV& p);
767  /** \brief A 2D point structure representing pixel image coordinates.
768  * \note We use float to be able to represent subpixels.
769  * \ingroup common
770  */
771  struct PointUV
772  {
773  float u = 0.f;
774  float v = 0.f;
775 
776  inline constexpr PointUV() = default;
777 
778  inline constexpr PointUV(float _u, float _v): u(_u), v(_v) {}
779 
780  friend std::ostream& operator << (std::ostream& os, const PointUV& p);
781  };
782 
783  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const InterestPoint& p);
784  /** \brief A point structure representing an interest point with Euclidean xyz coordinates, and an interest value.
785  * \ingroup common
786  */
787  // @TODO: inheritance trick like on other PointTypes
788  struct EIGEN_ALIGN16 InterestPoint
789  {
790  PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
791  union
792  {
793  struct
794  {
795  float strength;
796  };
797  float data_c[4];
798  };
800 
801  friend std::ostream& operator << (std::ostream& os, const InterestPoint& p);
802  };
803 
804  struct EIGEN_ALIGN16 _Normal
805  {
806  PCL_ADD_NORMAL4D // This adds the member normal[3] which can also be accessed using the point (which is float[4])
807  union
808  {
809  struct
810  {
811  float curvature;
812  };
813  float data_c[4];
814  };
816  };
817 
818  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Normal& p);
819  /** \brief A point structure representing normal coordinates and the surface curvature estimate. (SSE friendly)
820  * \ingroup common
821  */
822  struct Normal : public _Normal
823  {
824  inline constexpr Normal (const _Normal &p) : Normal {p.normal_x, p.normal_y, p.normal_z, p.curvature} {}
825 
826  inline constexpr Normal (float _curvature = 0.f): Normal (0.f, 0.f, 0.f, _curvature) {}
827 
828  inline constexpr Normal (float n_x, float n_y, float n_z, float _curvature = 0.f) :
829  _Normal{{{n_x, n_y, n_z, 0.0f}}, {{_curvature}}} {}
830 
831  friend std::ostream& operator << (std::ostream& os, const Normal& p);
833  };
834 
835 
836  struct EIGEN_ALIGN16 _Axis
837  {
838  PCL_ADD_NORMAL4D
840  };
841 
842  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Axis& p);
843  /** \brief A point structure representing an Axis using its normal coordinates. (SSE friendly)
844  * \ingroup common
845  */
846  struct EIGEN_ALIGN16 Axis : public _Axis
847  {
848  inline constexpr Axis (const _Axis &p) : Axis{p.normal_x, p.normal_y, p.normal_z} {}
849 
850  inline constexpr Axis (): Axis (0.f, 0.f, 0.f) {}
851 
852  inline constexpr Axis (float n_x, float n_y, float n_z) : _Axis{{{n_x, n_y, n_z, 0.0f}}} {}
853 
854  friend std::ostream& operator << (std::ostream& os, const Axis& p);
856  };
857 
858 
859  struct EIGEN_ALIGN16 _PointNormal
860  {
861  PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
862  PCL_ADD_NORMAL4D // This adds the member normal[3] which can also be accessed using the point (which is float[4])
863  union
864  {
865  struct
866  {
867  float curvature;
868  };
869  float data_c[4];
870  };
872  };
873 
874  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointNormal& p);
875  /** \brief A point structure representing Euclidean xyz coordinates, together with normal coordinates and the surface curvature estimate. (SSE friendly)
876  * \ingroup common
877  */
878  struct PointNormal : public _PointNormal
879  {
880  inline constexpr PointNormal (const _PointNormal &p) : PointNormal{p.x, p.y, p.z, p.normal_x, p.normal_y, p.normal_z, p.curvature} {}
881 
882  inline constexpr PointNormal (float _curvature = 0.f): PointNormal (0.f, 0.f, 0.f, 0.f, 0.f, 0.f, _curvature) {}
883 
884  inline constexpr PointNormal (float _x, float _y, float _z):
885  PointNormal (_x, _y, _z, 0.f, 0.f, 0.f, 0.f) {}
886 
887  inline constexpr PointNormal (float _x, float _y, float _z, float n_x, float n_y, float n_z, float _curvature = 0.f) :
888  _PointNormal{{{_x, _y, _z, 1.0f}}, {{n_x, n_y, n_z, 0.0f}}, {{_curvature}}} {}
889 
890  friend std::ostream& operator << (std::ostream& os, const PointNormal& p);
891  };
892 
893 
894  struct EIGEN_ALIGN16 _PointXYZRGBNormal
895  {
896  PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
897  PCL_ADD_NORMAL4D // This adds the member normal[3] which can also be accessed using the point (which is float[4])
898  union
899  {
900  struct
901  {
902  PCL_ADD_UNION_RGB
903  float curvature;
904  };
905  float data_c[4];
906  };
907  PCL_ADD_EIGEN_MAPS_RGB
909  };
910 
911  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBNormal& p);
912  /** \brief A point structure representing Euclidean xyz coordinates, and the RGB color, together with normal coordinates and the surface curvature estimate.
913  * Due to historical reasons (PCL was first developed as a ROS package), the
914  * RGB information is packed into an integer and casted to a float. This is
915  * something we wish to remove in the near future, but in the meantime, the
916  * following code snippet should help you pack and unpack RGB colors in your
917  * PointXYZRGB structure:
918  *
919  * \code
920  * // pack r/g/b into rgb
921  * std::uint8_t r = 255, g = 0, b = 0; // Example: Red color
922  * std::uint32_t rgb = ((std::uint32_t)r << 16 | (std::uint32_t)g << 8 | (std::uint32_t)b);
923  * p.rgb = *reinterpret_cast<float*>(&rgb);
924  * \endcode
925  *
926  * To unpack the data into separate values, use:
927  *
928  * \code
929  * PointXYZRGB p;
930  * // unpack rgb into r/g/b
931  * std::uint32_t rgb = *reinterpret_cast<int*>(&p.rgb);
932  * std::uint8_t r = (rgb >> 16) & 0x0000ff;
933  * std::uint8_t g = (rgb >> 8) & 0x0000ff;
934  * std::uint8_t b = (rgb) & 0x0000ff;
935  * \endcode
936  *
937  *
938  * Alternatively, from 1.1.0 onwards, you can use p.r, p.g, and p.b directly.
939  * \ingroup common
940  */
942  {
943  inline constexpr PointXYZRGBNormal (const _PointXYZRGBNormal &p) :
944  PointXYZRGBNormal {p.x, p.y, p.z, p.r, p.g, p.b, p.a, p.normal_x, p.normal_y, p.normal_z, p.curvature} {}
945 
946  inline constexpr PointXYZRGBNormal (float _curvature = 0.f):
947  PointXYZRGBNormal (0.f, 0.f, 0.f, 0, 0, 0, 0.f, 0.f, 0.f, _curvature) {}
948 
949  inline constexpr PointXYZRGBNormal (float _x, float _y, float _z):
950  PointXYZRGBNormal (_x, _y, _z, 0, 0, 0) {}
951 
952  inline constexpr PointXYZRGBNormal (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
953  PointXYZRGBNormal (0.f, 0.f, 0.f, _r, _g, _b) {}
954 
955  inline constexpr PointXYZRGBNormal (float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
956  PointXYZRGBNormal (_x, _y, _z, _r, _g, _b, 0.f, 0.f, 0.f) {}
957 
958  inline constexpr PointXYZRGBNormal (float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b,
959  float n_x, float n_y, float n_z, float _curvature = 0.f) :
961  {{_x, _y, _z, 1.0f}},
962  {{n_x, n_y, n_z, 0.0f}},
963  {{ {{{_b, _g, _r, 255u}}}, _curvature }}
964  }
965  {}
966 
967  inline constexpr PointXYZRGBNormal (float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b,
968  std::uint8_t _a, float n_x, float n_y, float n_z, float _curvature = 0.f) :
970  {{_x, _y, _z, 1.0f}},
971  {{n_x, n_y, n_z, 0.0f}},
972  {{ {{{_b, _g, _r, _a}}}, _curvature }}
973  }
974  {}
975 
976 
977  friend std::ostream& operator << (std::ostream& os, const PointXYZRGBNormal& p);
978  };
979 
980  struct EIGEN_ALIGN16 _PointXYZINormal
981  {
982  PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
983  PCL_ADD_NORMAL4D // This adds the member normal[3] which can also be accessed using the point (which is float[4])
984  union
985  {
986  struct
987  {
988  float intensity;
989  float curvature;
990  };
991  float data_c[4];
992  };
994  };
995 
996  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZINormal& p);
997  /** \brief A point structure representing Euclidean xyz coordinates, intensity, together with normal coordinates and the surface curvature estimate.
998  * \ingroup common
999  */
1001  {
1002  inline constexpr PointXYZINormal (const _PointXYZINormal &p) :
1003  PointXYZINormal {p.x, p.y, p.z, p.intensity, p.normal_x, p.normal_y, p.normal_z, p.curvature} {}
1004 
1005  inline constexpr PointXYZINormal (float _intensity = 0.f): PointXYZINormal (0.f, 0.f, 0.f, _intensity) {}
1006 
1007  inline constexpr PointXYZINormal (float _x, float _y, float _z, float _intensity = 0.f):
1008  PointXYZINormal (_x, _y, _z, _intensity, 0.f, 0.f, 0.f) {}
1009 
1010  inline constexpr PointXYZINormal (float _x, float _y, float _z, float _intensity,
1011  float n_x, float n_y, float n_z, float _curvature = 0.f) :
1013  {{_x, _y, _z, 1.0f}},
1014  {{n_x, n_y, n_z, 0.0f}},
1015  {{_intensity, _curvature}}
1016  }
1017  {}
1018 
1019  friend std::ostream& operator << (std::ostream& os, const PointXYZINormal& p);
1020  };
1021 
1022 //----
1023  struct EIGEN_ALIGN16 _PointXYZLNormal
1024  {
1025  PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1026  PCL_ADD_NORMAL4D // This adds the member normal[3] which can also be accessed using the point (which is float[4])
1027  union
1028  {
1029  struct
1030  {
1031  std::uint32_t label;
1032  float curvature;
1033  };
1034  float data_c[4];
1035  };
1037  };
1038 
1039  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZLNormal& p);
1040  /** \brief A point structure representing Euclidean xyz coordinates, a label, together with normal coordinates and the surface curvature estimate.
1041  * \ingroup common
1042  */
1044  {
1045  inline constexpr PointXYZLNormal (const _PointXYZLNormal &p) :
1046  PointXYZLNormal {p.x, p.y, p.z, p.label, p.normal_x, p.normal_y, p.normal_z, p.curvature} {}
1047 
1048  inline constexpr PointXYZLNormal (std::uint32_t _label = 0u): PointXYZLNormal (0.f, 0.f, 0.f, _label) {}
1049 
1050  inline constexpr PointXYZLNormal (float _x, float _y, float _z, std::uint32_t _label = 0u) :
1051  PointXYZLNormal (_x, _y, _z, _label, 0.f, 0.f, 0.f) {}
1052 
1053  inline constexpr PointXYZLNormal (float _x, float _y, float _z, std::uint32_t _label,
1054  float n_x, float n_y, float n_z, float _curvature = 0.f) :
1056  {{_x, _y, _z, 1.0f}},
1057  {{n_x, n_y, n_z, 0.0f}},
1058  {{_label, _curvature}}
1059  }
1060  {}
1061 
1062  friend std::ostream& operator << (std::ostream& os, const PointXYZLNormal& p);
1063  };
1064 
1065 // ---
1066 
1067 
1068  struct EIGEN_ALIGN16 _PointWithRange
1069  {
1070  PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1071  union
1072  {
1073  struct
1074  {
1075  float range;
1076  };
1077  float data_c[4];
1078  };
1080  };
1081 
1082  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithRange& p);
1083  /** \brief A point structure representing Euclidean xyz coordinates, padded with an extra range float.
1084  * \ingroup common
1085  */
1087  {
1088  inline constexpr PointWithRange (const _PointWithRange &p) : PointWithRange{p.x, p.y, p.z, p.range} {}
1089 
1090  inline constexpr PointWithRange (float _range = 0.f): PointWithRange (0.f, 0.f, 0.f, _range) {}
1091 
1092  inline constexpr PointWithRange (float _x, float _y, float _z, float _range = 0.f) :
1093  _PointWithRange{{{_x, _y, _z, 1.0f}}, {{_range}}} {}
1094 
1095  friend std::ostream& operator << (std::ostream& os, const PointWithRange& p);
1096  };
1097 
1098 
1099  struct EIGEN_ALIGN16 _PointWithViewpoint
1100  {
1101  PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1102  union
1103  {
1104  struct
1105  {
1106  float vp_x;
1107  float vp_y;
1108  float vp_z;
1109  };
1110  float data_c[4];
1111  };
1113  };
1114 
1115  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithViewpoint& p);
1116  /** \brief A point structure representing Euclidean xyz coordinates together with the viewpoint from which it was seen.
1117  * \ingroup common
1118  */
1119  struct EIGEN_ALIGN16 PointWithViewpoint : public _PointWithViewpoint
1120  {
1121  inline constexpr PointWithViewpoint (const _PointWithViewpoint &p) : PointWithViewpoint{p.x, p.y, p.z, p.vp_x, p.vp_y, p.vp_z} {}
1122 
1123  inline constexpr PointWithViewpoint (): PointWithViewpoint (0.f, 0.f, 0.f) {}
1124 
1125  inline constexpr PointWithViewpoint (float _x, float _y, float _z): PointWithViewpoint (_x, _y, _z, 0.f, 0.f, 0.f) {}
1126 
1127  inline constexpr PointWithViewpoint (float _x, float _y, float _z, float _vp_x, float _vp_y, float _vp_z) :
1128  _PointWithViewpoint{{{_x, _y, _z, 1.0f}}, {{_vp_x, _vp_y, _vp_z}}} {}
1129 
1130  friend std::ostream& operator << (std::ostream& os, const PointWithViewpoint& p);
1131  };
1132 
1133  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const MomentInvariants& p);
1134  /** \brief A point structure representing the three moment invariants.
1135  * \ingroup common
1136  */
1138  {
1139  float j1 = 0.f, j2 = 0.f, j3 = 0.f;
1140 
1141  inline constexpr MomentInvariants () = default;
1142 
1143  inline constexpr MomentInvariants (float _j1, float _j2, float _j3): j1 (_j1), j2 (_j2), j3 (_j3) {}
1144 
1145  friend std::ostream& operator << (std::ostream& os, const MomentInvariants& p);
1146  };
1147 
1148  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PrincipalRadiiRSD& p);
1149  /** \brief A point structure representing the minimum and maximum surface radii (in meters) computed using RSD.
1150  * \ingroup common
1151  */
1153  {
1154  float r_min = 0.f, r_max = 0.f;
1155 
1156  inline constexpr PrincipalRadiiRSD () = default;
1157 
1158  inline constexpr PrincipalRadiiRSD (float _r_min, float _r_max): r_min (_r_min), r_max (_r_max) {}
1159 
1160  friend std::ostream& operator << (std::ostream& os, const PrincipalRadiiRSD& p);
1161  };
1162 
1163  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Boundary& p);
1164  /** \brief A point structure representing a description of whether a point is lying on a surface boundary or not.
1165  * \ingroup common
1166  */
1167  struct Boundary
1168  {
1169  std::uint8_t boundary_point = 0;
1170 
1171 #if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 1101
1172  constexpr operator unsigned char() const
1173  {
1174  return boundary_point;
1175  }
1176 #endif
1177 
1178  inline constexpr Boundary (std::uint8_t _boundary = 0): boundary_point (_boundary) {}
1179 
1180  friend std::ostream& operator << (std::ostream& os, const Boundary& p);
1181  };
1182 
1183  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PrincipalCurvatures& p);
1184  /** \brief A point structure representing the principal curvatures and their magnitudes.
1185  * \ingroup common
1186  */
1188  {
1189  union
1190  {
1191  float principal_curvature[3];
1192  struct
1193  {
1197  };
1198  };
1199  float pc1 = 0.f;
1200  float pc2 = 0.f;
1201 
1202  inline constexpr PrincipalCurvatures (): PrincipalCurvatures (0.f, 0.f) {}
1203 
1204  inline constexpr PrincipalCurvatures (float _pc1, float _pc2): PrincipalCurvatures (0.f, 0.f, 0.f, _pc1, _pc2) {}
1205 
1206  inline constexpr PrincipalCurvatures (float _x, float _y, float _z): PrincipalCurvatures (_x, _y, _z, 0.f, 0.f) {}
1207 
1208  inline constexpr PrincipalCurvatures (float _x, float _y, float _z, float _pc1, float _pc2):
1209  principal_curvature_x (_x), principal_curvature_y (_y), principal_curvature_z (_z), pc1 (_pc1), pc2 (_pc2) {}
1210 
1211  friend std::ostream& operator << (std::ostream& os, const PrincipalCurvatures& p);
1212  };
1213 
1214  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PFHSignature125& p);
1215  /** \brief A point structure representing the Point Feature Histogram (PFH).
1216  * \ingroup common
1217  */
1219  {
1220  float histogram[125] = {0.f};
1221  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<PFHSignature125>; }
1222 
1223  inline constexpr PFHSignature125 () = default;
1224 
1225  friend std::ostream& operator << (std::ostream& os, const PFHSignature125& p);
1226  };
1227 
1228 
1229  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PFHRGBSignature250& p);
1230  /** \brief A point structure representing the Point Feature Histogram with colors (PFHRGB).
1231  * \ingroup common
1232  */
1234  {
1235  float histogram[250] = {0.f};
1236  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<PFHRGBSignature250>; }
1237 
1238  inline constexpr PFHRGBSignature250 () = default;
1239 
1240  friend std::ostream& operator << (std::ostream& os, const PFHRGBSignature250& p);
1241  };
1242 
1243  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PPFSignature& p);
1244  /** \brief A point structure for storing the Point Pair Feature (PPF) values
1245  * \ingroup common
1246  */
1248  {
1249  float f1 = 0.f, f2 = 0.f, f3 = 0.f, f4 = 0.f;
1250  float alpha_m = 0.f;
1251 
1252  inline constexpr PPFSignature (float _alpha = 0.f): PPFSignature (0.f, 0.f, 0.f, 0.f, _alpha) {}
1253 
1254  inline constexpr PPFSignature (float _f1, float _f2, float _f3, float _f4, float _alpha = 0.f):
1255  f1 (_f1), f2 (_f2), f3 (_f3), f4 (_f4), alpha_m (_alpha) {}
1256 
1257  friend std::ostream& operator << (std::ostream& os, const PPFSignature& p);
1258  };
1259 
1260  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const CPPFSignature& p);
1261  /** \brief A point structure for storing the Point Pair Feature (CPPF) values
1262  * \ingroup common
1263  */
1265  {
1266  float f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
1267  float alpha_m;
1268 
1269  inline constexpr CPPFSignature (float _alpha = 0.f):
1270  CPPFSignature (0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, _alpha) {}
1271 
1272  inline constexpr CPPFSignature (float _f1, float _f2, float _f3, float _f4, float _f5, float _f6,
1273  float _f7, float _f8, float _f9, float _f10, float _alpha = 0.f):
1274  f1 (_f1), f2 (_f2), f3 (_f3), f4 (_f4), f5 (_f5), f6 (_f6),
1275  f7 (_f7), f8 (_f8), f9 (_f9), f10 (_f10), alpha_m (_alpha) {}
1276 
1277  friend std::ostream& operator << (std::ostream& os, const CPPFSignature& p);
1278  };
1279 
1280  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PPFRGBSignature& p);
1281  /** \brief A point structure for storing the Point Pair Color Feature (PPFRGB) values
1282  * \ingroup common
1283  */
1285  {
1286  float f1 = 0.f, f2 = 0.f, f3 = 0.f, f4 = 0.f;
1287  float r_ratio = 0.f, g_ratio = 0.f, b_ratio = 0.f;
1288  float alpha_m = 0.f;
1289 
1290  inline constexpr PPFRGBSignature (float _alpha = 0.f): PPFRGBSignature (0.f, 0.f, 0.f, 0.f, _alpha) {}
1291 
1292  inline constexpr PPFRGBSignature (float _f1, float _f2, float _f3, float _f4, float _alpha = 0.f):
1293  PPFRGBSignature (_f1, _f2, _f3, _f4, _alpha, 0.f, 0.f, 0.f) {}
1294 
1295  inline constexpr PPFRGBSignature (float _f1, float _f2, float _f3, float _f4, float _alpha, float _r, float _g, float _b):
1296  f1 (_f1), f2 (_f2), f3 (_f3), f4 (_f4), r_ratio (_r), g_ratio (_g), b_ratio (_b), alpha_m (_alpha) {}
1297 
1298  friend std::ostream& operator << (std::ostream& os, const PPFRGBSignature& p);
1299  };
1300 
1301  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const NormalBasedSignature12& p);
1302  /** \brief A point structure representing the Normal Based Signature for
1303  * a feature matrix of 4-by-3
1304  * \ingroup common
1305  */
1307  {
1308  float values[12] = {0.f};
1309 
1310  inline constexpr NormalBasedSignature12 () = default;
1311 
1312  friend std::ostream& operator << (std::ostream& os, const NormalBasedSignature12& p);
1313  };
1314 
1315  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const ShapeContext1980& p);
1316  /** \brief A point structure representing a Shape Context.
1317  * \ingroup common
1318  */
1320  {
1321  float descriptor[1980] = {0.f};
1322  float rf[9] = {0.f};
1323  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<ShapeContext1980>; }
1324 
1325  inline constexpr ShapeContext1980 () = default;
1326 
1327  friend std::ostream& operator << (std::ostream& os, const ShapeContext1980& p);
1328  };
1329 
1330  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const UniqueShapeContext1960& p);
1331  /** \brief A point structure representing a Unique Shape Context.
1332  * \ingroup common
1333  */
1335  {
1336  float descriptor[1960] = {0.f};
1337  float rf[9] = {0.f};
1338  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<UniqueShapeContext1960>; }
1339 
1340  inline constexpr UniqueShapeContext1960 () = default;
1341 
1342  friend std::ostream& operator << (std::ostream& os, const UniqueShapeContext1960& p);
1343  };
1344 
1345  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const SHOT352& p);
1346  /** \brief A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape only.
1347  * \ingroup common
1348  */
1349  struct SHOT352
1350  {
1351  float descriptor[352] = {0.f};
1352  float rf[9] = {0.f};
1353  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<SHOT352>; }
1354 
1355  inline constexpr SHOT352 () = default;
1356 
1357  friend std::ostream& operator << (std::ostream& os, const SHOT352& p);
1358  };
1359 
1360 
1361  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const SHOT1344& p);
1362  /** \brief A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape+color.
1363  * \ingroup common
1364  */
1365  struct SHOT1344
1366  {
1367  float descriptor[1344] = {0.f};
1368  float rf[9] = {0.f};
1369  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<SHOT1344>; }
1370 
1371  inline constexpr SHOT1344 () = default;
1372 
1373  friend std::ostream& operator << (std::ostream& os, const SHOT1344& p);
1374  };
1375 
1376 
1377  /** \brief A structure representing the Local Reference Frame of a point.
1378  * \ingroup common
1379  */
1380  struct EIGEN_ALIGN16 _ReferenceFrame
1381  {
1382  union
1383  {
1384  float rf[9];
1385  struct
1386  {
1387  float x_axis[3];
1388  float y_axis[3];
1389  float z_axis[3];
1390  };
1391  };
1392 
1393  inline Eigen::Map<Eigen::Vector3f> getXAxisVector3fMap () { return (Eigen::Vector3f::Map (x_axis)); }
1394  inline const Eigen::Map<const Eigen::Vector3f> getXAxisVector3fMap () const { return (Eigen::Vector3f::Map (x_axis)); }
1395  inline Eigen::Map<Eigen::Vector3f> getYAxisVector3fMap () { return (Eigen::Vector3f::Map (y_axis)); }
1396  inline const Eigen::Map<const Eigen::Vector3f> getYAxisVector3fMap () const { return (Eigen::Vector3f::Map (y_axis)); }
1397  inline Eigen::Map<Eigen::Vector3f> getZAxisVector3fMap () { return (Eigen::Vector3f::Map (z_axis)); }
1398  inline const Eigen::Map<const Eigen::Vector3f> getZAxisVector3fMap () const { return (Eigen::Vector3f::Map (z_axis)); }
1399  inline Eigen::Map<Eigen::Matrix3f> getMatrix3fMap () { return (Eigen::Matrix3f::Map (rf)); }
1400  inline const Eigen::Map<const Eigen::Matrix3f> getMatrix3fMap () const { return (Eigen::Matrix3f::Map (rf)); }
1401 
1403  };
1404 
1405  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const ReferenceFrame& p);
1406  struct EIGEN_ALIGN16 ReferenceFrame : public _ReferenceFrame
1407  {
1408  inline constexpr ReferenceFrame (const _ReferenceFrame &p) :
1409  ReferenceFrame{p.rf}
1410  {
1411  //std::copy_n(p.rf, 9, rf); // this algorithm is constexpr starting from C++20
1412  }
1413 
1414  inline constexpr ReferenceFrame () :
1415  _ReferenceFrame{ {{0.0f}} }
1416  {
1417  // this algorithm is constexpr starting from C++20
1418  /*std::fill_n(x_axis, 3, 0.f);
1419  std::fill_n(y_axis, 3, 0.f);
1420  std::fill_n(z_axis, 3, 0.f);*/
1421  }
1422 
1423  inline constexpr ReferenceFrame (const float (&_rf)[9]) :
1424  _ReferenceFrame{ {{_rf[0], _rf[1], _rf[2], _rf[3], _rf[4], _rf[5], _rf[6], _rf[7], _rf[8]}} } {}
1425 
1426  friend std::ostream& operator << (std::ostream& os, const ReferenceFrame& p);
1428  };
1429 
1430 
1431  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const FPFHSignature33& p);
1432  /** \brief A point structure representing the Fast Point Feature Histogram (FPFH).
1433  * \ingroup common
1434  */
1436  {
1437  float histogram[33] = {0.f};
1438  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<FPFHSignature33>; }
1439 
1440  inline constexpr FPFHSignature33 () = default;
1441 
1442  friend std::ostream& operator << (std::ostream& os, const FPFHSignature33& p);
1443  };
1444 
1445  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const VFHSignature308& p);
1446  /** \brief A point structure representing the Viewpoint Feature Histogram (VFH).
1447  * \ingroup common
1448  */
1450  {
1451  float histogram[308] = {0.f};
1452  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<VFHSignature308>; }
1453 
1454  inline constexpr VFHSignature308 () = default;
1455 
1456  friend std::ostream& operator << (std::ostream& os, const VFHSignature308& p);
1457  };
1458 
1459  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GRSDSignature21& p);
1460  /** \brief A point structure representing the Global Radius-based Surface Descriptor (GRSD).
1461  * \ingroup common
1462  */
1464  {
1465  float histogram[21] = {0.f};
1466  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<GRSDSignature21>; }
1467 
1468  inline constexpr GRSDSignature21 () = default;
1469 
1470  friend std::ostream& operator << (std::ostream& os, const GRSDSignature21& p);
1471  };
1472 
1473  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const BRISKSignature512& p);
1474  /** \brief A point structure representing the Binary Robust Invariant Scalable Keypoints (BRISK).
1475  * \ingroup common
1476  */
1478  {
1479  float scale = 0.f;
1480  float orientation = 0.f;
1481  unsigned char descriptor[64] = {0};
1482  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<BRISKSignature512>; }
1483 
1484  inline constexpr BRISKSignature512 () = default;
1485 
1486  inline constexpr BRISKSignature512 (float _scale, float _orientation): scale (_scale), orientation (_orientation) {}
1487 
1488  friend std::ostream& operator << (std::ostream& os, const BRISKSignature512& p);
1489  };
1490 
1491  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const ESFSignature640& p);
1492  /** \brief A point structure representing the Ensemble of Shape Functions (ESF).
1493  * \ingroup common
1494  */
1496  {
1497  float histogram[640] = {0.f};
1498  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<ESFSignature640>; }
1499 
1500  inline constexpr ESFSignature640 () = default;
1501 
1502  friend std::ostream& operator << (std::ostream& os, const ESFSignature640& p);
1503  };
1504 
1505  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GASDSignature512& p);
1506  /** \brief A point structure representing the Globally Aligned Spatial Distribution (GASD) shape descriptor.
1507  * \ingroup common
1508  */
1510  {
1511  float histogram[512] = {0.f};
1512  static constexpr int descriptorSize() { return detail::traits::descriptorSize_v<GASDSignature512>; }
1513 
1514  inline constexpr GASDSignature512 () = default;
1515 
1516  friend std::ostream& operator << (std::ostream& os, const GASDSignature512& p);
1517  };
1518 
1519  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GASDSignature984& p);
1520  /** \brief A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descriptor.
1521  * \ingroup common
1522  */
1524  {
1525  float histogram[984] = {0.f};
1526  static constexpr int descriptorSize() { return detail::traits::descriptorSize_v<GASDSignature984>; }
1527 
1528  inline constexpr GASDSignature984 () = default;
1529 
1530  friend std::ostream& operator << (std::ostream& os, const GASDSignature984& p);
1531  };
1532 
1533  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GASDSignature7992& p);
1534  /** \brief A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descriptor.
1535  * \ingroup common
1536  */
1538  {
1539  float histogram[7992] = {0.f};
1540  static constexpr int descriptorSize() { return detail::traits::descriptorSize_v<GASDSignature7992>; }
1541 
1542  inline constexpr GASDSignature7992 () = default;
1543 
1544  friend std::ostream& operator << (std::ostream& os, const GASDSignature7992& p);
1545  };
1546 
1547  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GFPFHSignature16& p);
1548  /** \brief A point structure representing the GFPFH descriptor with 16 bins.
1549  * \ingroup common
1550  */
1552  {
1553  float histogram[16] = {0.f};
1554  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<GFPFHSignature16>; }
1555 
1556  inline constexpr GFPFHSignature16 () = default;
1557 
1558  friend std::ostream& operator << (std::ostream& os, const GFPFHSignature16& p);
1559  };
1560 
1561  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Narf36& p);
1562  /** \brief A point structure representing the Narf descriptor.
1563  * \ingroup common
1564  */
1565  struct Narf36
1566  {
1567  float x = 0.f, y = 0.f, z = 0.f, roll = 0.f, pitch = 0.f, yaw = 0.f;
1568  float descriptor[36] = {0.f};
1569  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<Narf36>; }
1570 
1571  inline constexpr Narf36 () = default;
1572 
1573  inline constexpr Narf36 (float _x, float _y, float _z): Narf36 (_x, _y, _z, 0.f, 0.f, 0.f) {}
1574 
1575  inline constexpr Narf36 (float _x, float _y, float _z, float _roll, float _pitch, float _yaw):
1576  x (_x), y (_y), z (_z), roll (_roll), pitch (_pitch), yaw (_yaw) {}
1577 
1578  friend std::ostream& operator << (std::ostream& os, const Narf36& p);
1579  };
1580 
1581  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const BorderDescription& p);
1582  /** \brief A structure to store if a point in a range image lies on a border between an obstacle and the background.
1583  * \ingroup common
1584  */
1586  {
1587  int x = 0, y = 0;
1589  //std::vector<const BorderDescription*> neighbors;
1590 
1591  inline constexpr BorderDescription () = default;
1592 
1593  inline constexpr BorderDescription (int _x, int _y) : x(_x), y(_y) {}
1594 
1595  friend std::ostream& operator << (std::ostream& os, const BorderDescription& p);
1596  };
1597 
1598 
1599  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const IntensityGradient& p);
1600  /** \brief A point structure representing the intensity gradient of an XYZI point cloud.
1601  * \ingroup common
1602  */
1604  {
1605  union
1606  {
1607  float gradient[3];
1608  struct
1609  {
1610  float gradient_x;
1611  float gradient_y;
1612  float gradient_z;
1613  };
1614  };
1615 
1616  inline constexpr IntensityGradient (): IntensityGradient (0.f, 0.f, 0.f) {}
1617 
1618  inline constexpr IntensityGradient (float _x, float _y, float _z): gradient_x (_x), gradient_y (_y), gradient_z (_z) {}
1619  friend std::ostream& operator << (std::ostream& os, const IntensityGradient& p);
1620  };
1621 
1622  // TODO: Maybe make other histogram based structs an alias for this
1623  /** \brief A point structure representing an N-D histogram.
1624  * \ingroup common
1625  */
1626  template <int N>
1627  struct Histogram
1628  {
1629  float histogram[N];
1630  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<Histogram<N>>; }
1631  };
1632 
1633  struct EIGEN_ALIGN16 _PointWithScale
1634  {
1635  PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1636 
1637  union
1638  {
1639  /** \brief Diameter of the meaningful keypoint neighborhood. */
1640  float scale;
1641  float size;
1642  };
1643 
1644  /** \brief Computed orientation of the keypoint (-1 if not applicable). */
1645  float angle;
1646  /** \brief The response by which the most strong keypoints have been selected. */
1647  float response;
1648  /** \brief octave (pyramid layer) from which the keypoint has been extracted. */
1649  int octave;
1650 
1652  };
1653 
1654  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithScale& p);
1655  /** \brief A point structure representing a 3-D position and scale.
1656  * \ingroup common
1657  */
1659  {
1660  inline constexpr PointWithScale (const _PointWithScale &p) :
1661  PointWithScale{p.x, p.y, p.z, p.scale, p.angle, p.response, p.octave} {}
1662 
1663  inline constexpr PointWithScale (): PointWithScale (0.f, 0.f, 0.f) {}
1664 
1665  inline constexpr PointWithScale (float _x, float _y, float _z, float _scale = 1.f,
1666  float _angle = -1.f, float _response = 0.f, int _octave = 0) :
1667  _PointWithScale{{{_x, _y, _z, 1.0f}}, {_scale}, _angle, _response, _octave } {}
1668 
1669  friend std::ostream& operator << (std::ostream& os, const PointWithScale& p);
1670  };
1671 
1672 
1673  struct EIGEN_ALIGN16 _PointSurfel
1674  {
1675  PCL_ADD_POINT4D // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1676  PCL_ADD_NORMAL4D // This adds the member normal[3] which can also be accessed using the point (which is float[4])
1677  union
1678  {
1679  struct
1680  {
1681  PCL_ADD_UNION_RGB
1682  float radius;
1683  float confidence;
1684  float curvature;
1685  };
1686  float data_c[4];
1687  };
1688  PCL_ADD_EIGEN_MAPS_RGB
1690  };
1691 
1692  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointSurfel& p);
1693  /** \brief A surfel, that is, a point structure representing Euclidean xyz coordinates, together with normal coordinates, a RGBA color, a radius, a confidence value and the surface curvature estimate.
1694  * \ingroup common
1695  */
1696  struct PointSurfel : public _PointSurfel
1697  {
1698  inline constexpr PointSurfel (const _PointSurfel &p) :
1699  PointSurfel{p.x, p.y, p.z, p.normal_x, p.normal_y, p.normal_z, p.r, p.g, p.b, p.a, p.radius, p.confidence, p.curvature} {}
1700 
1701  inline constexpr PointSurfel () :
1702  PointSurfel{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0u, 0u, 0u, 0u, 0.0f, 0.0f, 0.0f} {}
1703 
1704  inline constexpr PointSurfel (float _x, float _y, float _z, float _nx,
1705  float _ny, float _nz, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a,
1706  float _radius, float _confidence, float _curvature) :
1707  _PointSurfel{
1708  {{_x, _y, _z, 1.0f}},
1709  {{_nx, _ny, _nz, 0.0f}},
1710  {{{{{_b, _g, _r, _a}}}, _radius, _confidence, _curvature}}
1711  } {}
1712 
1713 
1714  friend std::ostream& operator << (std::ostream& os, const PointSurfel& p);
1715  };
1716 
1717  struct EIGEN_ALIGN16 _PointDEM
1718  {
1719  PCL_ADD_POINT4D
1720  float intensity;
1724  };
1725 
1726  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointDEM& p);
1727  /** \brief A point structure representing Digital Elevation Map.
1728  * \ingroup common
1729  */
1730  struct PointDEM : public _PointDEM
1731  {
1732  inline constexpr PointDEM (const _PointDEM &p) :
1733  PointDEM{p.x, p.y, p.z, p.intensity, p.intensity_variance, p.height_variance} {}
1734 
1735  inline constexpr PointDEM (): PointDEM (0.f, 0.f, 0.f) {}
1736 
1737  inline constexpr PointDEM (float _x, float _y, float _z): PointDEM (_x, _y, _z, 0.f, 0.f, 0.f) {}
1738 
1739  inline constexpr PointDEM (float _x, float _y, float _z, float _intensity,
1740  float _intensity_variance, float _height_variance) :
1741  _PointDEM{{{_x, _y, _z, 1.0f}}, _intensity, _intensity_variance, _height_variance} {}
1742 
1743  friend std::ostream& operator << (std::ostream& os, const PointDEM& p);
1744  };
1745 
1746  template <int N> std::ostream&
1747  operator << (std::ostream& os, const Histogram<N>& p)
1748  {
1749  // make constexpr
1750  PCL_IF_CONSTEXPR(N > 0)
1751  {
1752  os << "(" << p.histogram[0];
1753  std::for_each(p.histogram + 1, std::end(p.histogram),
1754  [&os](const auto& hist) { os << ", " << hist; });
1755  os << ")";
1756  }
1757  return (os);
1758  }
1759 } // namespace pcl
1760 
1761 // Register point structs and wrappers
1762 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_RGB,
1763  (std::uint32_t, rgba, rgba)
1764 )
1765 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::RGB, pcl::_RGB)
1766 
1767 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Intensity,
1768  (float, intensity, intensity)
1769 )
1770 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity, pcl::_Intensity)
1771 
1772 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Intensity8u,
1773  (std::uint8_t, intensity, intensity)
1774 )
1775 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity8u, pcl::_Intensity8u)
1776 
1777 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Intensity32u,
1778  (std::uint32_t, intensity, intensity)
1779 )
1780 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity32u, pcl::_Intensity32u)
1781 
1782 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZ,
1783  (float, x, x)
1784  (float, y, y)
1785  (float, z, z)
1786 )
1787 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZ, pcl::_PointXYZ)
1788 
1789 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBA,
1790  (float, x, x)
1791  (float, y, y)
1792  (float, z, z)
1793  (std::uint32_t, rgba, rgba)
1794 )
1795 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBA, pcl::_PointXYZRGBA)
1796 
1797 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGB,
1798  (float, x, x)
1799  (float, y, y)
1800  (float, z, z)
1801  (float, rgb, rgb)
1802 )
1803 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGB, pcl::_PointXYZRGB)
1804 
1805 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBL,
1806  (float, x, x)
1807  (float, y, y)
1808  (float, z, z)
1809  (std::uint32_t, rgba, rgba)
1810  (std::uint32_t, label, label)
1811 )
1812 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBL, pcl::_PointXYZRGBL)
1813 
1814 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZLAB,
1815  (float, x, x)
1816  (float, y, y)
1817  (float, z, z)
1818  (float, L, L)
1819  (float, a, a)
1820  (float, b, b)
1821 )
1822 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZLAB, pcl::_PointXYZLAB)
1823 
1824 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZHSV,
1825  (float, x, x)
1826  (float, y, y)
1827  (float, z, z)
1828  (float, h, h)
1829  (float, s, s)
1830  (float, v, v)
1831 )
1832 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZHSV, pcl::_PointXYZHSV)
1833 
1834 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXY,
1835  (float, x, x)
1836  (float, y, y)
1837 )
1838 
1839 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointUV,
1840  (float, u, u)
1841  (float, v, v)
1842 )
1843 
1844 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::InterestPoint,
1845  (float, x, x)
1846  (float, y, y)
1847  (float, z, z)
1848  (float, strength, strength)
1849 )
1850 
1851 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZI,
1852  (float, x, x)
1853  (float, y, y)
1854  (float, z, z)
1855  (float, intensity, intensity)
1856 )
1857 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZI, pcl::_PointXYZI)
1858 
1859 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZL,
1860  (float, x, x)
1861  (float, y, y)
1862  (float, z, z)
1863  (std::uint32_t, label, label)
1864 )
1865 
1866 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Label,
1867  (std::uint32_t, label, label)
1868 )
1869 
1870 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Normal,
1871  (float, normal_x, normal_x)
1872  (float, normal_y, normal_y)
1873  (float, normal_z, normal_z)
1874  (float, curvature, curvature)
1875 )
1876 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Normal, pcl::_Normal)
1877 
1878 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Axis,
1879  (float, normal_x, normal_x)
1880  (float, normal_y, normal_y)
1881  (float, normal_z, normal_z)
1882 )
1883 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Axis, pcl::_Axis)
1884 
1885 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointNormal,
1886  (float, x, x)
1887  (float, y, y)
1888  (float, z, z)
1889  (float, normal_x, normal_x)
1890  (float, normal_y, normal_y)
1891  (float, normal_z, normal_z)
1892  (float, curvature, curvature)
1893 )
1894 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBNormal,
1895  (float, x, x)
1896  (float, y, y)
1897  (float, z, z)
1898  (float, normal_x, normal_x)
1899  (float, normal_y, normal_y)
1900  (float, normal_z, normal_z)
1901  (float, rgb, rgb)
1902  (float, curvature, curvature)
1903 )
1904 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBNormal, pcl::_PointXYZRGBNormal)
1905 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZINormal,
1906  (float, x, x)
1907  (float, y, y)
1908  (float, z, z)
1909  (float, normal_x, normal_x)
1910  (float, normal_y, normal_y)
1911  (float, normal_z, normal_z)
1912  (float, intensity, intensity)
1913  (float, curvature, curvature)
1914 )
1915 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZLNormal,
1916  (float, x, x)
1917  (float, y, y)
1918  (float, z, z)
1919  (float, normal_x, normal_x)
1920  (float, normal_y, normal_y)
1921  (float, normal_z, normal_z)
1922  (std::uint32_t, label, label)
1923  (float, curvature, curvature)
1924 )
1925 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithRange,
1926  (float, x, x)
1927  (float, y, y)
1928  (float, z, z)
1929  (float, range, range)
1930 )
1931 
1932 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointWithViewpoint,
1933  (float, x, x)
1934  (float, y, y)
1935  (float, z, z)
1936  (float, vp_x, vp_x)
1937  (float, vp_y, vp_y)
1938  (float, vp_z, vp_z)
1939 )
1940 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointWithViewpoint, pcl::_PointWithViewpoint)
1941 
1942 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::MomentInvariants,
1943  (float, j1, j1)
1944  (float, j2, j2)
1945  (float, j3, j3)
1946 )
1947 
1948 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PrincipalRadiiRSD,
1949  (float, r_min, r_min)
1950  (float, r_max, r_max)
1951 )
1952 
1953 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Boundary,
1954  (std::uint8_t, boundary_point, boundary_point)
1955 )
1956 
1957 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PrincipalCurvatures,
1958  (float, principal_curvature_x, principal_curvature_x)
1959  (float, principal_curvature_y, principal_curvature_y)
1960  (float, principal_curvature_z, principal_curvature_z)
1961  (float, pc1, pc1)
1962  (float, pc2, pc2)
1963 )
1964 
1965 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PFHSignature125,
1966  (float[125], histogram, pfh)
1967 )
1968 
1969 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PFHRGBSignature250,
1970  (float[250], histogram, pfhrgb)
1971 )
1972 
1973 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFSignature,
1974  (float, f1, f1)
1975  (float, f2, f2)
1976  (float, f3, f3)
1977  (float, f4, f4)
1978  (float, alpha_m, alpha_m)
1979 )
1980 
1981 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::CPPFSignature,
1982  (float, f1, f1)
1983  (float, f2, f2)
1984  (float, f3, f3)
1985  (float, f4, f4)
1986  (float, f5, f5)
1987  (float, f6, f6)
1988  (float, f7, f7)
1989  (float, f8, f8)
1990  (float, f9, f9)
1991  (float, f10, f10)
1992  (float, alpha_m, alpha_m)
1993 )
1994 
1995 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFRGBSignature,
1996  (float, f1, f1)
1997  (float, f2, f2)
1998  (float, f3, f3)
1999  (float, f4, f4)
2000  (float, r_ratio, r_ratio)
2001  (float, g_ratio, g_ratio)
2002  (float, b_ratio, b_ratio)
2003  (float, alpha_m, alpha_m)
2004 )
2005 
2006 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::NormalBasedSignature12,
2007  (float[12], values, values)
2008 )
2009 
2010 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::ShapeContext1980,
2011  (float[1980], descriptor, shape_context)
2012  (float[9], rf, rf)
2013 )
2014 
2015 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::UniqueShapeContext1960,
2016  (float[1960], descriptor, shape_context)
2017  (float[9], rf, rf)
2018 )
2019 
2020 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::SHOT352,
2021  (float[352], descriptor, shot)
2022  (float[9], rf, rf)
2023 )
2024 
2025 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::SHOT1344,
2026  (float[1344], descriptor, shot)
2027  (float[9], rf, rf)
2028 )
2029 
2030 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::FPFHSignature33,
2031  (float[33], histogram, fpfh)
2032 )
2033 
2034 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::BRISKSignature512,
2035  (float, scale, brisk_scale)
2036  (float, orientation, brisk_orientation)
2037  (unsigned char[64], descriptor, brisk_descriptor512)
2038 )
2039 
2040 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::VFHSignature308,
2041  (float[308], histogram, vfh)
2042 )
2043 
2044 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::GRSDSignature21,
2045  (float[21], histogram, grsd)
2046 )
2047 
2048 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::ESFSignature640,
2049  (float[640], histogram, esf)
2050 )
2051 
2052 POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::GASDSignature512,
2053  (float[512], histogram, gasd)
2054 )
2055 
2056 POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::GASDSignature984,
2057  (float[984], histogram, gasd)
2058 )
2059 
2060 POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::GASDSignature7992,
2061  (float[7992], histogram, gasd)
2062 )
2063 
2064 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Narf36,
2065  (float[36], descriptor, descriptor)
2066 )
2067 
2068 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::GFPFHSignature16,
2069  (float[16], histogram, gfpfh)
2070 )
2071 
2072 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::IntensityGradient,
2073  (float, gradient_x, gradient_x)
2074  (float, gradient_y, gradient_y)
2075  (float, gradient_z, gradient_z)
2076 )
2077 
2078 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithScale,
2079  (float, x, x)
2080  (float, y, y)
2081  (float, z, z)
2082  (float, scale, scale)
2083 )
2084 
2085 POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::PointSurfel,
2086  (float, x, x)
2087  (float, y, y)
2088  (float, z, z)
2089  (float, normal_x, normal_x)
2090  (float, normal_y, normal_y)
2091  (float, normal_z, normal_z)
2092  (std::uint32_t, rgba, rgba)
2093  (float, radius, radius)
2094  (float, confidence, confidence)
2095  (float, curvature, curvature)
2096 )
2097 
2098 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_ReferenceFrame,
2099  (float[3], x_axis, x_axis)
2100  (float[3], y_axis, y_axis)
2101  (float[3], z_axis, z_axis)
2102 )
2103 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::ReferenceFrame, pcl::_ReferenceFrame)
2104 
2105 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointDEM,
2106  (float, x, x)
2107  (float, y, y)
2108  (float, z, z)
2109  (float, intensity, intensity)
2110  (float, intensity_variance, intensity_variance)
2111  (float, height_variance, height_variance)
2112 )
2113 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointDEM, pcl::_PointDEM)
2114 
2115 namespace pcl
2116 {
2117 
2118 // Allow float 'rgb' data to match to the newer uint32 'rgba' tag. This is so
2119 // you can load old 'rgb' PCD files into e.g. a PointCloud<PointXYZRGBA>.
2120 template<typename PointT>
2121 struct FieldMatches<PointT, ::pcl::fields::rgba>
2122 {
2123  bool operator() (const pcl::PCLPointField& field)
2124  {
2125  if (field.name == "rgb")
2126  {
2127  // For fixing the alpha value bug #1141, the rgb field can also match
2128  // uint32.
2129  return ((field.datatype == pcl::PCLPointField::FLOAT32 ||
2131  field.count == 1);
2132  }
2133  else
2134  {
2135  return (field.name == traits::name<PointT, fields::rgba>::value &&
2136  field.datatype == traits::datatype<PointT, fields::rgba>::value &&
2137  field.count == traits::datatype<PointT, fields::rgba>::size);
2138  }
2139  }
2140 };
2141 template<typename PointT>
2142 struct FieldMatches<PointT, fields::rgb>
2143 {
2144  bool operator() (const pcl::PCLPointField& field)
2145  {
2146  if (field.name == "rgba")
2147  {
2148  return (field.datatype == pcl::PCLPointField::UINT32 &&
2149  field.count == 1);
2150  }
2151  else
2152  {
2153  // For fixing the alpha value bug #1141, rgb can also match uint32
2154  return (field.name == traits::name<PointT, fields::rgb>::value &&
2155  (field.datatype == traits::datatype<PointT, fields::rgb>::value ||
2157  field.count == traits::datatype<PointT, fields::rgb>::size);
2158  }
2159  }
2160 };
2161 
2162 
2163 // We're doing a lot of black magic with Boost here, so disable warnings in Maintainer mode, as we will never
2164 // be able to fix them anyway
2165 #if defined _MSC_VER
2166  #pragma warning(disable: 4201)
2167 #endif
2168 
2169 namespace traits
2170 {
2171 
2172  /** \brief Metafunction to check if a given point type has a given field.
2173  *
2174  * Example usage at run-time:
2175  *
2176  * \code
2177  * bool curvature_available = pcl::traits::has_field<PointT, pcl::fields::curvature>::value;
2178  * \endcode
2179  *
2180  * Example usage at compile-time:
2181  *
2182  * \code
2183  * BOOST_MPL_ASSERT_MSG ((pcl::traits::has_field<PointT, pcl::fields::label>::value),
2184  * POINT_TYPE_SHOULD_HAVE_LABEL_FIELD,
2185  * (PointT));
2186  * \endcode
2187  */
2188  template <typename PointT, typename Field>
2189  struct has_field : boost::mpl::contains<typename pcl::traits::fieldList<PointT>::type, Field>::type
2190  { };
2191 
2192  /** Metafunction to check if a given point type has all given fields. */
2193  template <typename PointT, typename Field>
2194  struct has_all_fields : boost::mpl::fold<Field,
2195  boost::mpl::bool_<true>,
2196  boost::mpl::and_<boost::mpl::_1,
2197  has_field<PointT, boost::mpl::_2> > >::type
2198  { };
2199 
2200  /** Metafunction to check if a given point type has any of the given fields. */
2201  template <typename PointT, typename Field>
2202  struct has_any_field : boost::mpl::fold<Field,
2203  boost::mpl::bool_<false>,
2204  boost::mpl::or_<boost::mpl::_1,
2205  has_field<PointT, boost::mpl::_2> > >::type
2206  { };
2207 
2208  /** \brief Traits defined for ease of use with fields already registered before
2209  *
2210  * has_<fields to be detected>: struct with `value` datamember defined at compiletime
2211  * has_<fields to be detected>_v: constexpr boolean
2212  * Has<Fields to be detected>: concept modelling name alias for `enable_if`
2213  */
2214 
2215  /** Metafunction to check if a given point type has x and y fields. */
2216  template <typename PointT>
2217  struct has_xy : has_all_fields<PointT, boost::mpl::vector<pcl::fields::x,
2218  pcl::fields::y> >
2219  { };
2220 
2221  template <typename PointT>
2222  constexpr auto has_xy_v = has_xy<PointT>::value;
2223 
2224  template <typename PointT>
2225  using HasXY = std::enable_if_t<has_xy_v<PointT>, bool>;
2226 
2227  template <typename PointT>
2228  using HasNoXY = std::enable_if_t<!has_xy_v<PointT>, bool>;
2229 
2230  /** Metafunction to check if a given point type has x, y, and z fields. */
2231  template <typename PointT>
2232  struct has_xyz : has_all_fields<PointT, boost::mpl::vector<pcl::fields::x,
2233  pcl::fields::y,
2234  pcl::fields::z> >
2235  { };
2236 
2237  template <typename PointT>
2238  constexpr auto has_xyz_v = has_xyz<PointT>::value;
2239 
2240  template <typename PointT>
2241  using HasXYZ = std::enable_if_t<has_xyz_v<PointT>, bool>;
2242 
2243  template <typename PointT>
2244  using HasNoXYZ = std::enable_if_t<!has_xyz_v<PointT>, bool>;
2245 
2246  /** Metafunction to check if a given point type has normal_x, normal_y, and
2247  * normal_z fields. */
2248  template <typename PointT>
2249  struct has_normal : has_all_fields<PointT, boost::mpl::vector<pcl::fields::normal_x,
2250  pcl::fields::normal_y,
2251  pcl::fields::normal_z> >
2252  { };
2253 
2254  template <typename PointT>
2255  constexpr auto has_normal_v = has_normal<PointT>::value;
2256 
2257  template <typename PointT>
2258  using HasNormal = std::enable_if_t<has_normal_v<PointT>, bool>;
2259 
2260  template <typename PointT>
2261  using HasNoNormal = std::enable_if_t<!has_normal_v<PointT>, bool>;
2262 
2263  /** Metafunction to check if a given point type has curvature field. */
2264  template <typename PointT>
2265  struct has_curvature : has_field<PointT, pcl::fields::curvature>
2266  { };
2267 
2268  template <typename PointT>
2269  constexpr auto has_curvature_v = has_curvature<PointT>::value;
2270 
2271  template <typename PointT>
2272  using HasCurvature = std::enable_if_t<has_curvature_v<PointT>, bool>;
2273 
2274  template <typename PointT>
2275  using HasNoCurvature = std::enable_if_t<!has_curvature_v<PointT>, bool>;
2276 
2277  /** Metafunction to check if a given point type has intensity field. */
2278  template <typename PointT>
2279  struct has_intensity : has_field<PointT, pcl::fields::intensity>
2280  { };
2281 
2282  template <typename PointT>
2283  constexpr auto has_intensity_v = has_intensity<PointT>::value;
2284 
2285  template <typename PointT>
2286  using HasIntensity = std::enable_if_t<has_intensity_v<PointT>, bool>;
2287 
2288  template <typename PointT>
2289  using HasNoIntensity = std::enable_if_t<!has_intensity_v<PointT>, bool>;
2290 
2291  /** Metafunction to check if a given point type has either rgb or rgba field. */
2292  template <typename PointT>
2293  struct has_color : has_any_field<PointT, boost::mpl::vector<pcl::fields::rgb,
2294  pcl::fields::rgba> >
2295  { };
2296 
2297  template <typename PointT>
2298  constexpr auto has_color_v = has_color<PointT>::value;
2299 
2300  template <typename PointT>
2301  using HasColor = std::enable_if_t<has_color_v<PointT>, bool>;
2302 
2303  template <typename PointT>
2304  using HasNoColor = std::enable_if_t<!has_color_v<PointT>, bool>;
2305 
2306  /** Metafunction to check if a given point type has label field. */
2307  template <typename PointT>
2308  struct has_label : has_field<PointT, pcl::fields::label>
2309  { };
2310 
2311  template <typename PointT>
2312  constexpr auto has_label_v = has_label<PointT>::value;
2313 
2314  template <typename PointT>
2315  using HasLabel = std::enable_if_t<has_label_v<PointT>, bool>;
2316 
2317  template <typename PointT>
2318  using HasNoLabel = std::enable_if_t<!has_label_v<PointT>, bool>;
2319 }
2320 
2321 #if defined _MSC_VER
2322  #pragma warning(default: 4201)
2323 #endif
2324 
2325 } // namespace pcl
2326 
Defines all the PCL implemented PointT point type structures.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Definition: memory.h:63
std::bitset< 32 > BorderTraits
Data type to store extended information about a transition from foreground to backgroundSpecification...
Definition: point_types.h:307
Defines functions, macros and traits for allocating and using memory.
static constexpr int descriptorSize_v
std::ostream & operator<<(std::ostream &ostream, int8 value)
Definition: io_operators.h:86
Eigen::Map< Eigen::Vector2f > Vector2fMap
Eigen::Map< Eigen::Vector4f, Eigen::Aligned > Vector4fMap
const Eigen::Map< const Vector4c, Eigen::Aligned > Vector4cMapConst
const Eigen::Map< const Eigen::Vector2f > Vector2fMapConst
Eigen::Map< Vector4c, Eigen::Aligned > Vector4cMap
std::ostream & operator<<(std::ostream &os, const BivariatePolynomialT< real > &p)
const Eigen::Map< const Eigen::Vector3f > Vector3fMapConst
const Eigen::Map< const Vector3c > Vector3cMapConst
Eigen::Map< Eigen::Vector3f > Vector3fMap
Eigen::Matrix< std::uint8_t, 4, 1 > Vector4c
const Eigen::Map< const Eigen::Vector4f, Eigen::Aligned > Vector4fMapConst
const Eigen::Map< const Eigen::Array4f, Eigen::Aligned > Array4fMapConst
Eigen::Matrix< std::uint8_t, 3, 1 > Vector3c
Eigen::Map< Eigen::Array4f, Eigen::Aligned > Array4fMap
const Eigen::Map< const Eigen::Array3f > Array3fMapConst
Eigen::Map< Vector3c > Vector3cMap
Eigen::Map< Eigen::Array3f > Array3fMap
Defines all the PCL and non-PCL macros used.
#define PCL_EXPORTS
Definition: pcl_macros.h:323
#define PCL_IF_CONSTEXPR(x)
Definition: pcl_macros.h:449
float intensity_variance
PCL_ADD_POINT4D float intensity
PCL_ADD_UNION_RGB float radius
float angle
Computed orientation of the keypoint (-1 if not applicable).
float response
The response by which the most strong keypoints have been selected.
int octave
octave (pyramid layer) from which the keypoint has been extracted.
float scale
Diameter of the meaningful keypoint neighborhood.
A point structure representing Euclidean xyz coordinates, and the intensity value.
PCL_ADD_POINT4D std::uint32_t label
PCL_ADD_POINT4D PCL_ADD_RGB std::uint32_t label
PCL_ADD_UNION_RGB float curvature
A structure representing the Local Reference Frame of a point.
const Eigen::Map< const Eigen::Matrix3f > getMatrix3fMap() const
const Eigen::Map< const Eigen::Vector3f > getYAxisVector3fMap() const
Eigen::Map< Eigen::Vector3f > getXAxisVector3fMap()
Eigen::Map< Eigen::Vector3f > getYAxisVector3fMap()
const Eigen::Map< const Eigen::Vector3f > getZAxisVector3fMap() const
Eigen::Map< Eigen::Vector3f > getZAxisVector3fMap()
const Eigen::Map< const Eigen::Vector3f > getXAxisVector3fMap() const
Eigen::Map< Eigen::Matrix3f > getMatrix3fMap()
A point structure representing an Axis using its normal coordinates.
constexpr Axis(float n_x, float n_y, float n_z)
constexpr Axis()
constexpr Axis(const _Axis &p)
A point structure representing the Binary Robust Invariant Scalable Keypoints (BRISK).
constexpr BRISKSignature512()=default
static constexpr int descriptorSize()
constexpr BRISKSignature512(float _scale, float _orientation)
A structure to store if a point in a range image lies on a border between an obstacle and the backgro...
constexpr BorderDescription(int _x, int _y)
constexpr BorderDescription()=default
A point structure representing a description of whether a point is lying on a surface boundary or not...
constexpr Boundary(std::uint8_t _boundary=0)
A point structure for storing the Point Pair Feature (CPPF) values.
constexpr CPPFSignature(float _alpha=0.f)
constexpr CPPFSignature(float _f1, float _f2, float _f3, float _f4, float _f5, float _f6, float _f7, float _f8, float _f9, float _f10, float _alpha=0.f)
A point structure representing the Ensemble of Shape Functions (ESF).
static constexpr int descriptorSize()
constexpr ESFSignature640()=default
A point structure representing the Fast Point Feature Histogram (FPFH).
static constexpr int descriptorSize()
constexpr FPFHSignature33()=default
bool operator()(const PCLPointField &field)
Definition: PCLPointField.h:68
A point structure representing the Globally Aligned Spatial Distribution (GASD) shape descriptor.
static constexpr int descriptorSize()
constexpr GASDSignature512()=default
A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descr...
static constexpr int descriptorSize()
constexpr GASDSignature7992()=default
A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descr...
constexpr GASDSignature984()=default
static constexpr int descriptorSize()
A point structure representing the GFPFH descriptor with 16 bins.
constexpr GFPFHSignature16()=default
static constexpr int descriptorSize()
A point structure representing the Global Radius-based Surface Descriptor (GRSD).
static constexpr int descriptorSize()
constexpr GRSDSignature21()=default
A point structure representing an N-D histogram.
float histogram[N]
static constexpr int descriptorSize()
A point structure representing the grayscale intensity in single-channel images.
constexpr Intensity32u(const _Intensity32u &p)
constexpr Intensity32u(std::uint32_t _intensity=0)
A point structure representing the grayscale intensity in single-channel images.
constexpr Intensity8u(std::uint8_t _intensity=0)
constexpr Intensity8u(const _Intensity8u &p)
A point structure representing the intensity gradient of an XYZI point cloud.
constexpr IntensityGradient(float _x, float _y, float _z)
constexpr IntensityGradient()
A point structure representing the grayscale intensity in single-channel images.
constexpr Intensity(const _Intensity &p)
constexpr Intensity(float _intensity=0.f)
A point structure representing an interest point with Euclidean xyz coordinates, and an interest valu...
constexpr Label(std::uint32_t _label=0)
A point structure representing the three moment invariants.
constexpr MomentInvariants()=default
constexpr MomentInvariants(float _j1, float _j2, float _j3)
A point structure representing the Narf descriptor.
constexpr Narf36(float _x, float _y, float _z, float _roll, float _pitch, float _yaw)
static constexpr int descriptorSize()
constexpr Narf36(float _x, float _y, float _z)
constexpr Narf36()=default
A point structure representing the Normal Based Signature for a feature matrix of 4-by-3.
constexpr NormalBasedSignature12()=default
A point structure representing normal coordinates and the surface curvature estimate.
constexpr Normal(const _Normal &p)
constexpr Normal(float _curvature=0.f)
constexpr Normal(float n_x, float n_y, float n_z, float _curvature=0.f)
std::string name
Definition: PCLPointField.h:14
std::uint8_t datatype
Definition: PCLPointField.h:17
A point structure representing the Point Feature Histogram with colors (PFHRGB).
constexpr PFHRGBSignature250()=default
static constexpr int descriptorSize()
A point structure representing the Point Feature Histogram (PFH).
constexpr PFHSignature125()=default
static constexpr int descriptorSize()
A point structure for storing the Point Pair Color Feature (PPFRGB) values.
constexpr PPFRGBSignature(float _f1, float _f2, float _f3, float _f4, float _alpha, float _r, float _g, float _b)
constexpr PPFRGBSignature(float _f1, float _f2, float _f3, float _f4, float _alpha=0.f)
constexpr PPFRGBSignature(float _alpha=0.f)
A point structure for storing the Point Pair Feature (PPF) values.
constexpr PPFSignature(float _f1, float _f2, float _f3, float _f4, float _alpha=0.f)
constexpr PPFSignature(float _alpha=0.f)
A point structure representing Digital Elevation Map.
constexpr PointDEM(const _PointDEM &p)
constexpr PointDEM(float _x, float _y, float _z, float _intensity, float _intensity_variance, float _height_variance)
constexpr PointDEM(float _x, float _y, float _z)
constexpr PointDEM()
A point structure representing Euclidean xyz coordinates, together with normal coordinates and the su...
constexpr PointNormal(float _curvature=0.f)
constexpr PointNormal(float _x, float _y, float _z)
constexpr PointNormal(const _PointNormal &p)
constexpr PointNormal(float _x, float _y, float _z, float n_x, float n_y, float n_z, float _curvature=0.f)
A surfel, that is, a point structure representing Euclidean xyz coordinates, together with normal coo...
constexpr PointSurfel(const _PointSurfel &p)
constexpr PointSurfel()
constexpr PointSurfel(float _x, float _y, float _z, float _nx, float _ny, float _nz, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a, float _radius, float _confidence, float _curvature)
A 2D point structure representing pixel image coordinates.
constexpr PointUV(float _u, float _v)
constexpr PointUV()=default
A point structure representing Euclidean xyz coordinates, padded with an extra range float.
constexpr PointWithRange(float _range=0.f)
constexpr PointWithRange(float _x, float _y, float _z, float _range=0.f)
constexpr PointWithRange(const _PointWithRange &p)
A point structure representing a 3-D position and scale.
constexpr PointWithScale()
constexpr PointWithScale(const _PointWithScale &p)
constexpr PointWithScale(float _x, float _y, float _z, float _scale=1.f, float _angle=-1.f, float _response=0.f, int _octave=0)
A point structure representing Euclidean xyz coordinates together with the viewpoint from which it wa...
constexpr PointWithViewpoint(float _x, float _y, float _z)
constexpr PointWithViewpoint(float _x, float _y, float _z, float _vp_x, float _vp_y, float _vp_z)
constexpr PointWithViewpoint(const _PointWithViewpoint &p)
constexpr PointWithViewpoint()
A 2D point structure representing Euclidean xy coordinates.
constexpr PointXY()
pcl::Vector2fMap getVector2fMap()
constexpr PointXY(float _x, float _y)
pcl::Vector2fMapConst getVector2fMap() const
constexpr PointXYZHSV()
constexpr PointXYZHSV(const _PointXYZHSV &p)
constexpr PointXYZHSV(float _h, float _s, float _v)
constexpr PointXYZHSV(float _x, float _y, float _z, float _h, float _s, float _v)
A point structure representing Euclidean xyz coordinates.
constexpr PointXYZ(float _x, float _y, float _z)
constexpr PointXYZ(const _PointXYZ &p)
constexpr PointXYZ()
constexpr PointXYZI(float _x, float _y, float _z, float _intensity=0.f)
constexpr PointXYZI(float _intensity=0.f)
constexpr PointXYZI(const _PointXYZI &p)
A point structure representing Euclidean xyz coordinates, intensity, together with normal coordinates...
constexpr PointXYZINormal(float _intensity=0.f)
constexpr PointXYZINormal(const _PointXYZINormal &p)
constexpr PointXYZINormal(float _x, float _y, float _z, float _intensity, float n_x, float n_y, float n_z, float _curvature=0.f)
constexpr PointXYZINormal(float _x, float _y, float _z, float _intensity=0.f)
A point structure representing Euclidean xyz coordinates, and the CIELAB color.
constexpr PointXYZLAB()
constexpr PointXYZLAB(float _x, float _y, float _z, float _l, float _a, float _b)
constexpr PointXYZLAB(const _PointXYZLAB &p)
constexpr PointXYZL(std::uint32_t _label=0)
constexpr PointXYZL(const _PointXYZL &p)
constexpr PointXYZL(float _x, float _y, float _z, std::uint32_t _label=0)
A point structure representing Euclidean xyz coordinates, a label, together with normal coordinates a...
constexpr PointXYZLNormal(const _PointXYZLNormal &p)
constexpr PointXYZLNormal(float _x, float _y, float _z, std::uint32_t _label=0u)
constexpr PointXYZLNormal(std::uint32_t _label=0u)
constexpr PointXYZLNormal(float _x, float _y, float _z, std::uint32_t _label, float n_x, float n_y, float n_z, float _curvature=0.f)
A point structure representing Euclidean xyz coordinates, and the RGBA color.
constexpr PointXYZRGBA(const _PointXYZRGBA &p)
constexpr PointXYZRGBA()
constexpr PointXYZRGBA(float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a)
constexpr PointXYZRGBA(float _x, float _y, float _z)
constexpr PointXYZRGBA(std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a)
A point structure representing Euclidean xyz coordinates, and the RGB color.
constexpr PointXYZRGB(float _x, float _y, float _z)
constexpr PointXYZRGB()
constexpr PointXYZRGB(const _PointXYZRGB &p)
constexpr PointXYZRGB(float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
constexpr PointXYZRGB(std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
constexpr PointXYZRGBL(std::uint32_t _label=0)
constexpr PointXYZRGBL(float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint32_t _label=0, std::uint8_t _a=255)
constexpr PointXYZRGBL(float _x, float _y, float _z)
constexpr PointXYZRGBL(std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
constexpr PointXYZRGBL(const _PointXYZRGBL &p)
A point structure representing Euclidean xyz coordinates, and the RGB color, together with normal coo...
constexpr PointXYZRGBNormal(float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, float n_x, float n_y, float n_z, float _curvature=0.f)
constexpr PointXYZRGBNormal(float _x, float _y, float _z)
constexpr PointXYZRGBNormal(std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
constexpr PointXYZRGBNormal(float _curvature=0.f)
constexpr PointXYZRGBNormal(const _PointXYZRGBNormal &p)
constexpr PointXYZRGBNormal(float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a, float n_x, float n_y, float n_z, float _curvature=0.f)
constexpr PointXYZRGBNormal(float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
A point structure representing the principal curvatures and their magnitudes.
constexpr PrincipalCurvatures(float _pc1, float _pc2)
constexpr PrincipalCurvatures(float _x, float _y, float _z)
constexpr PrincipalCurvatures(float _x, float _y, float _z, float _pc1, float _pc2)
A point structure representing the minimum and maximum surface radii (in meters) computed using RSD.
constexpr PrincipalRadiiRSD(float _r_min, float _r_max)
constexpr PrincipalRadiiRSD()=default
A structure representing RGB color information.
constexpr RGB(std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a=255)
constexpr RGB()
constexpr RGB(const _RGB &p)
constexpr ReferenceFrame()
constexpr ReferenceFrame(const float(&_rf)[9])
constexpr ReferenceFrame(const _ReferenceFrame &p)
A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape+col...
static constexpr int descriptorSize()
constexpr SHOT1344()=default
A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape onl...
constexpr SHOT352()=default
static constexpr int descriptorSize()
A point structure representing a Shape Context.
static constexpr int descriptorSize()
constexpr ShapeContext1980()=default
A point structure representing a Unique Shape Context.
static constexpr int descriptorSize()
constexpr UniqueShapeContext1960()=default
A point structure representing the Viewpoint Feature Histogram (VFH).
static constexpr int descriptorSize()
constexpr VFHSignature308()=default