Point Cloud Library (PCL)  1.12.1-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  {
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  {
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])
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])
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])
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  struct PointXY
744  {
745  union
746  {
747  float data[2];
748  struct
749  {
750  float x;
751  float y;
752  };
753  };
754 
755  inline constexpr PointXY(float _x, float _y): x(_x), y(_y) {}
756  inline constexpr PointXY(): x(0.0f), y(0.0f) {}
757 
758  inline pcl::Vector2fMap getVector2fMap () { return (pcl::Vector2fMap (data)); }
759  inline pcl::Vector2fMapConst getVector2fMap () const { return (pcl::Vector2fMapConst (data)); }
760 
761  friend std::ostream& operator << (std::ostream& os, const PointXY& p);
762  };
763 
764  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointUV& p);
765  /** \brief A 2D point structure representing pixel image coordinates.
766  * \note We use float to be able to represent subpixels.
767  * \ingroup common
768  */
769  struct PointUV
770  {
771  float u = 0.f;
772  float v = 0.f;
773 
774  inline constexpr PointUV() = default;
775 
776  inline constexpr PointUV(float _u, float _v): u(_u), v(_v) {}
777 
778  friend std::ostream& operator << (std::ostream& os, const PointUV& p);
779  };
780 
781  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const InterestPoint& p);
782  /** \brief A point structure representing an interest point with Euclidean xyz coordinates, and an interest value.
783  * \ingroup common
784  */
785  // @TODO: inheritance trick like on other PointTypes
786  struct EIGEN_ALIGN16 InterestPoint
787  {
788  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
789  union
790  {
791  struct
792  {
793  float strength;
794  };
795  float data_c[4];
796  };
798 
799  friend std::ostream& operator << (std::ostream& os, const InterestPoint& p);
800  };
801 
802  struct EIGEN_ALIGN16 _Normal
803  {
804  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
805  union
806  {
807  struct
808  {
809  float curvature;
810  };
811  float data_c[4];
812  };
814  };
815 
816  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Normal& p);
817  /** \brief A point structure representing normal coordinates and the surface curvature estimate. (SSE friendly)
818  * \ingroup common
819  */
820  struct Normal : public _Normal
821  {
822  inline constexpr Normal (const _Normal &p) : Normal {p.normal_x, p.normal_y, p.normal_z, p.curvature} {}
823 
824  inline constexpr Normal (float _curvature = 0.f): Normal (0.f, 0.f, 0.f, _curvature) {}
825 
826  inline constexpr Normal (float n_x, float n_y, float n_z, float _curvature = 0.f) :
827  _Normal{{{n_x, n_y, n_z, 0.0f}}, {{_curvature}}} {}
828 
829  friend std::ostream& operator << (std::ostream& os, const Normal& p);
831  };
832 
833 
834  struct EIGEN_ALIGN16 _Axis
835  {
838  };
839 
840  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Axis& p);
841  /** \brief A point structure representing an Axis using its normal coordinates. (SSE friendly)
842  * \ingroup common
843  */
844  struct EIGEN_ALIGN16 Axis : public _Axis
845  {
846  inline constexpr Axis (const _Axis &p) : Axis{p.normal_x, p.normal_y, p.normal_z} {}
847 
848  inline constexpr Axis (): Axis (0.f, 0.f, 0.f) {}
849 
850  inline constexpr Axis (float n_x, float n_y, float n_z) : _Axis{{{n_x, n_y, n_z, 0.0f}}} {}
851 
852  friend std::ostream& operator << (std::ostream& os, const Axis& p);
854  };
855 
856 
857  struct EIGEN_ALIGN16 _PointNormal
858  {
859  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
860  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
861  union
862  {
863  struct
864  {
865  float curvature;
866  };
867  float data_c[4];
868  };
870  };
871 
872  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointNormal& p);
873  /** \brief A point structure representing Euclidean xyz coordinates, together with normal coordinates and the surface curvature estimate. (SSE friendly)
874  * \ingroup common
875  */
876  struct PointNormal : public _PointNormal
877  {
878  inline constexpr PointNormal (const _PointNormal &p) : PointNormal{p.x, p.y, p.z, p.normal_x, p.normal_y, p.normal_z, p.curvature} {}
879 
880  inline constexpr PointNormal (float _curvature = 0.f): PointNormal (0.f, 0.f, 0.f, 0.f, 0.f, 0.f, _curvature) {}
881 
882  inline constexpr PointNormal (float _x, float _y, float _z):
883  PointNormal (_x, _y, _z, 0.f, 0.f, 0.f, 0.f) {}
884 
885  inline constexpr PointNormal (float _x, float _y, float _z, float n_x, float n_y, float n_z, float _curvature = 0.f) :
886  _PointNormal{{{_x, _y, _z, 1.0f}}, {{n_x, n_y, n_z, 0.0f}}, {{_curvature}}} {}
887 
888  friend std::ostream& operator << (std::ostream& os, const PointNormal& p);
889  };
890 
891 
892  struct EIGEN_ALIGN16 _PointXYZRGBNormal
893  {
894  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
895  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
896  union
897  {
898  struct
899  {
901  float curvature;
902  };
903  float data_c[4];
904  };
907  };
908 
909  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBNormal& p);
910  /** \brief A point structure representing Euclidean xyz coordinates, and the RGB color, together with normal coordinates and the surface curvature estimate.
911  * Due to historical reasons (PCL was first developed as a ROS package), the
912  * RGB information is packed into an integer and casted to a float. This is
913  * something we wish to remove in the near future, but in the meantime, the
914  * following code snippet should help you pack and unpack RGB colors in your
915  * PointXYZRGB structure:
916  *
917  * \code
918  * // pack r/g/b into rgb
919  * std::uint8_t r = 255, g = 0, b = 0; // Example: Red color
920  * std::uint32_t rgb = ((std::uint32_t)r << 16 | (std::uint32_t)g << 8 | (std::uint32_t)b);
921  * p.rgb = *reinterpret_cast<float*>(&rgb);
922  * \endcode
923  *
924  * To unpack the data into separate values, use:
925  *
926  * \code
927  * PointXYZRGB p;
928  * // unpack rgb into r/g/b
929  * std::uint32_t rgb = *reinterpret_cast<int*>(&p.rgb);
930  * std::uint8_t r = (rgb >> 16) & 0x0000ff;
931  * std::uint8_t g = (rgb >> 8) & 0x0000ff;
932  * std::uint8_t b = (rgb) & 0x0000ff;
933  * \endcode
934  *
935  *
936  * Alternatively, from 1.1.0 onwards, you can use p.r, p.g, and p.b directly.
937  * \ingroup common
938  */
940  {
941  inline constexpr PointXYZRGBNormal (const _PointXYZRGBNormal &p) :
942  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} {}
943 
944  inline constexpr PointXYZRGBNormal (float _curvature = 0.f):
945  PointXYZRGBNormal (0.f, 0.f, 0.f, 0, 0, 0, 0.f, 0.f, 0.f, _curvature) {}
946 
947  inline constexpr PointXYZRGBNormal (float _x, float _y, float _z):
948  PointXYZRGBNormal (_x, _y, _z, 0, 0, 0) {}
949 
950  inline constexpr PointXYZRGBNormal (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
951  PointXYZRGBNormal (0.f, 0.f, 0.f, _r, _g, _b) {}
952 
953  inline constexpr PointXYZRGBNormal (float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
954  PointXYZRGBNormal (_x, _y, _z, _r, _g, _b, 0.f, 0.f, 0.f) {}
955 
956  inline constexpr PointXYZRGBNormal (float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b,
957  float n_x, float n_y, float n_z, float _curvature = 0.f) :
959  {{_x, _y, _z, 1.0f}},
960  {{n_x, n_y, n_z, 0.0f}},
961  {{ {{{_b, _g, _r, 255u}}}, _curvature }}
962  }
963  {}
964 
965  inline constexpr PointXYZRGBNormal (float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b,
966  std::uint8_t _a, float n_x, float n_y, float n_z, float _curvature = 0.f) :
968  {{_x, _y, _z, 1.0f}},
969  {{n_x, n_y, n_z, 0.0f}},
970  {{ {{{_b, _g, _r, _a}}}, _curvature }}
971  }
972  {}
973 
974 
975  friend std::ostream& operator << (std::ostream& os, const PointXYZRGBNormal& p);
976  };
977 
978  struct EIGEN_ALIGN16 _PointXYZINormal
979  {
980  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
981  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
982  union
983  {
984  struct
985  {
986  float intensity;
987  float curvature;
988  };
989  float data_c[4];
990  };
992  };
993 
994  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZINormal& p);
995  /** \brief A point structure representing Euclidean xyz coordinates, intensity, together with normal coordinates and the surface curvature estimate.
996  * \ingroup common
997  */
999  {
1000  inline constexpr PointXYZINormal (const _PointXYZINormal &p) :
1001  PointXYZINormal {p.x, p.y, p.z, p.intensity, p.normal_x, p.normal_y, p.normal_z, p.curvature} {}
1002 
1003  inline constexpr PointXYZINormal (float _intensity = 0.f): PointXYZINormal (0.f, 0.f, 0.f, _intensity) {}
1004 
1005  inline constexpr PointXYZINormal (float _x, float _y, float _z, float _intensity = 0.f):
1006  PointXYZINormal (_x, _y, _z, _intensity, 0.f, 0.f, 0.f) {}
1007 
1008  inline constexpr PointXYZINormal (float _x, float _y, float _z, float _intensity,
1009  float n_x, float n_y, float n_z, float _curvature = 0.f) :
1011  {{_x, _y, _z, 1.0f}},
1012  {{n_x, n_y, n_z, 0.0f}},
1013  {{_intensity, _curvature}}
1014  }
1015  {}
1016 
1017  friend std::ostream& operator << (std::ostream& os, const PointXYZINormal& p);
1018  };
1019 
1020 //----
1021  struct EIGEN_ALIGN16 _PointXYZLNormal
1022  {
1023  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1024  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
1025  union
1026  {
1027  struct
1028  {
1029  std::uint32_t label;
1030  float curvature;
1031  };
1032  float data_c[4];
1033  };
1035  };
1036 
1037  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZLNormal& p);
1038  /** \brief A point structure representing Euclidean xyz coordinates, a label, together with normal coordinates and the surface curvature estimate.
1039  * \ingroup common
1040  */
1042  {
1043  inline constexpr PointXYZLNormal (const _PointXYZLNormal &p) :
1044  PointXYZLNormal {p.x, p.y, p.z, p.label, p.normal_x, p.normal_y, p.normal_z, p.curvature} {}
1045 
1046  inline constexpr PointXYZLNormal (std::uint32_t _label = 0u): PointXYZLNormal (0.f, 0.f, 0.f, _label) {}
1047 
1048  inline constexpr PointXYZLNormal (float _x, float _y, float _z, std::uint32_t _label = 0u) :
1049  PointXYZLNormal (_x, _y, _z, _label, 0.f, 0.f, 0.f) {}
1050 
1051  inline constexpr PointXYZLNormal (float _x, float _y, float _z, std::uint32_t _label,
1052  float n_x, float n_y, float n_z, float _curvature = 0.f) :
1054  {{_x, _y, _z, 1.0f}},
1055  {{n_x, n_y, n_z, 0.0f}},
1056  {{_label, _curvature}}
1057  }
1058  {}
1059 
1060  friend std::ostream& operator << (std::ostream& os, const PointXYZLNormal& p);
1061  };
1062 
1063 // ---
1064 
1065 
1066  struct EIGEN_ALIGN16 _PointWithRange
1067  {
1068  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1069  union
1070  {
1071  struct
1072  {
1073  float range;
1074  };
1075  float data_c[4];
1076  };
1078  };
1079 
1080  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithRange& p);
1081  /** \brief A point structure representing Euclidean xyz coordinates, padded with an extra range float.
1082  * \ingroup common
1083  */
1085  {
1086  inline constexpr PointWithRange (const _PointWithRange &p) : PointWithRange{p.x, p.y, p.z, p.range} {}
1087 
1088  inline constexpr PointWithRange (float _range = 0.f): PointWithRange (0.f, 0.f, 0.f, _range) {}
1089 
1090  inline constexpr PointWithRange (float _x, float _y, float _z, float _range = 0.f) :
1091  _PointWithRange{{{_x, _y, _z, 1.0f}}, {{_range}}} {}
1092 
1093  friend std::ostream& operator << (std::ostream& os, const PointWithRange& p);
1094  };
1095 
1096 
1097  struct EIGEN_ALIGN16 _PointWithViewpoint
1098  {
1099  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1100  union
1101  {
1102  struct
1103  {
1104  float vp_x;
1105  float vp_y;
1106  float vp_z;
1107  };
1108  float data_c[4];
1109  };
1111  };
1112 
1113  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithViewpoint& p);
1114  /** \brief A point structure representing Euclidean xyz coordinates together with the viewpoint from which it was seen.
1115  * \ingroup common
1116  */
1117  struct EIGEN_ALIGN16 PointWithViewpoint : public _PointWithViewpoint
1118  {
1119  inline constexpr PointWithViewpoint (const _PointWithViewpoint &p) : PointWithViewpoint{p.x, p.y, p.z, p.vp_x, p.vp_y, p.vp_z} {}
1120 
1121  inline constexpr PointWithViewpoint (): PointWithViewpoint (0.f, 0.f, 0.f) {}
1122 
1123  inline constexpr PointWithViewpoint (float _x, float _y, float _z): PointWithViewpoint (_x, _y, _z, 0.f, 0.f, 0.f) {}
1124 
1125  inline constexpr PointWithViewpoint (float _x, float _y, float _z, float _vp_x, float _vp_y, float _vp_z) :
1126  _PointWithViewpoint{{{_x, _y, _z, 1.0f}}, {{_vp_x, _vp_y, _vp_z}}} {}
1127 
1128  friend std::ostream& operator << (std::ostream& os, const PointWithViewpoint& p);
1129  };
1130 
1131  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const MomentInvariants& p);
1132  /** \brief A point structure representing the three moment invariants.
1133  * \ingroup common
1134  */
1136  {
1137  float j1 = 0.f, j2 = 0.f, j3 = 0.f;
1138 
1139  inline constexpr MomentInvariants () = default;
1140 
1141  inline constexpr MomentInvariants (float _j1, float _j2, float _j3): j1 (_j1), j2 (_j2), j3 (_j3) {}
1142 
1143  friend std::ostream& operator << (std::ostream& os, const MomentInvariants& p);
1144  };
1145 
1146  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PrincipalRadiiRSD& p);
1147  /** \brief A point structure representing the minimum and maximum surface radii (in meters) computed using RSD.
1148  * \ingroup common
1149  */
1151  {
1152  float r_min = 0.f, r_max = 0.f;
1153 
1154  inline constexpr PrincipalRadiiRSD () = default;
1155 
1156  inline constexpr PrincipalRadiiRSD (float _r_min, float _r_max): r_min (_r_min), r_max (_r_max) {}
1157 
1158  friend std::ostream& operator << (std::ostream& os, const PrincipalRadiiRSD& p);
1159  };
1160 
1161  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Boundary& p);
1162  /** \brief A point structure representing a description of whether a point is lying on a surface boundary or not.
1163  * \ingroup common
1164  */
1165  struct Boundary
1166  {
1167  std::uint8_t boundary_point = 0;
1168 
1169 #if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 1101
1170  constexpr operator unsigned char() const
1171  {
1172  return boundary_point;
1173  }
1174 #endif
1175 
1176  inline constexpr Boundary (std::uint8_t _boundary = 0): boundary_point (_boundary) {}
1177 
1178  friend std::ostream& operator << (std::ostream& os, const Boundary& p);
1179  };
1180 
1181  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PrincipalCurvatures& p);
1182  /** \brief A point structure representing the principal curvatures and their magnitudes.
1183  * \ingroup common
1184  */
1186  {
1187  union
1188  {
1189  float principal_curvature[3];
1190  struct
1191  {
1195  };
1196  };
1197  float pc1 = 0.f;
1198  float pc2 = 0.f;
1199 
1200  inline constexpr PrincipalCurvatures (): PrincipalCurvatures (0.f, 0.f) {}
1201 
1202  inline constexpr PrincipalCurvatures (float _pc1, float _pc2): PrincipalCurvatures (0.f, 0.f, 0.f, _pc1, _pc2) {}
1203 
1204  inline constexpr PrincipalCurvatures (float _x, float _y, float _z): PrincipalCurvatures (_x, _y, _z, 0.f, 0.f) {}
1205 
1206  inline constexpr PrincipalCurvatures (float _x, float _y, float _z, float _pc1, float _pc2):
1207  principal_curvature_x (_x), principal_curvature_y (_y), principal_curvature_z (_z), pc1 (_pc1), pc2 (_pc2) {}
1208 
1209  friend std::ostream& operator << (std::ostream& os, const PrincipalCurvatures& p);
1210  };
1211 
1212  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PFHSignature125& p);
1213  /** \brief A point structure representing the Point Feature Histogram (PFH).
1214  * \ingroup common
1215  */
1217  {
1218  float histogram[125] = {0.f};
1219  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<PFHSignature125>; }
1220 
1221  inline constexpr PFHSignature125 () = default;
1222 
1223  friend std::ostream& operator << (std::ostream& os, const PFHSignature125& p);
1224  };
1225 
1226 
1227  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PFHRGBSignature250& p);
1228  /** \brief A point structure representing the Point Feature Histogram with colors (PFHRGB).
1229  * \ingroup common
1230  */
1232  {
1233  float histogram[250] = {0.f};
1234  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<PFHRGBSignature250>; }
1235 
1236  inline constexpr PFHRGBSignature250 () = default;
1237 
1238  friend std::ostream& operator << (std::ostream& os, const PFHRGBSignature250& p);
1239  };
1240 
1241  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PPFSignature& p);
1242  /** \brief A point structure for storing the Point Pair Feature (PPF) values
1243  * \ingroup common
1244  */
1246  {
1247  float f1 = 0.f, f2 = 0.f, f3 = 0.f, f4 = 0.f;
1248  float alpha_m = 0.f;
1249 
1250  inline constexpr PPFSignature (float _alpha = 0.f): PPFSignature (0.f, 0.f, 0.f, 0.f, _alpha) {}
1251 
1252  inline constexpr PPFSignature (float _f1, float _f2, float _f3, float _f4, float _alpha = 0.f):
1253  f1 (_f1), f2 (_f2), f3 (_f3), f4 (_f4), alpha_m (_alpha) {}
1254 
1255  friend std::ostream& operator << (std::ostream& os, const PPFSignature& p);
1256  };
1257 
1258  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const CPPFSignature& p);
1259  /** \brief A point structure for storing the Point Pair Feature (CPPF) values
1260  * \ingroup common
1261  */
1263  {
1264  float f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
1265  float alpha_m;
1266 
1267  inline constexpr CPPFSignature (float _alpha = 0.f):
1268  CPPFSignature (0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, _alpha) {}
1269 
1270  inline constexpr CPPFSignature (float _f1, float _f2, float _f3, float _f4, float _f5, float _f6,
1271  float _f7, float _f8, float _f9, float _f10, float _alpha = 0.f):
1272  f1 (_f1), f2 (_f2), f3 (_f3), f4 (_f4), f5 (_f5), f6 (_f6),
1273  f7 (_f7), f8 (_f8), f9 (_f9), f10 (_f10), alpha_m (_alpha) {}
1274 
1275  friend std::ostream& operator << (std::ostream& os, const CPPFSignature& p);
1276  };
1277 
1278  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PPFRGBSignature& p);
1279  /** \brief A point structure for storing the Point Pair Color Feature (PPFRGB) values
1280  * \ingroup common
1281  */
1283  {
1284  float f1 = 0.f, f2 = 0.f, f3 = 0.f, f4 = 0.f;
1285  float r_ratio = 0.f, g_ratio = 0.f, b_ratio = 0.f;
1286  float alpha_m = 0.f;
1287 
1288  inline constexpr PPFRGBSignature (float _alpha = 0.f): PPFRGBSignature (0.f, 0.f, 0.f, 0.f, _alpha) {}
1289 
1290  inline constexpr PPFRGBSignature (float _f1, float _f2, float _f3, float _f4, float _alpha = 0.f):
1291  PPFRGBSignature (_f1, _f2, _f3, _f4, _alpha, 0.f, 0.f, 0.f) {}
1292 
1293  inline constexpr PPFRGBSignature (float _f1, float _f2, float _f3, float _f4, float _alpha, float _r, float _g, float _b):
1294  f1 (_f1), f2 (_f2), f3 (_f3), f4 (_f4), r_ratio (_r), g_ratio (_g), b_ratio (_b), alpha_m (_alpha) {}
1295 
1296  friend std::ostream& operator << (std::ostream& os, const PPFRGBSignature& p);
1297  };
1298 
1299  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const NormalBasedSignature12& p);
1300  /** \brief A point structure representing the Normal Based Signature for
1301  * a feature matrix of 4-by-3
1302  * \ingroup common
1303  */
1305  {
1306  float values[12] = {0.f};
1307 
1308  inline constexpr NormalBasedSignature12 () = default;
1309 
1310  friend std::ostream& operator << (std::ostream& os, const NormalBasedSignature12& p);
1311  };
1312 
1313  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const ShapeContext1980& p);
1314  /** \brief A point structure representing a Shape Context.
1315  * \ingroup common
1316  */
1318  {
1319  float descriptor[1980] = {0.f};
1320  float rf[9] = {0.f};
1321  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<ShapeContext1980>; }
1322 
1323  inline constexpr ShapeContext1980 () = default;
1324 
1325  friend std::ostream& operator << (std::ostream& os, const ShapeContext1980& p);
1326  };
1327 
1328  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const UniqueShapeContext1960& p);
1329  /** \brief A point structure representing a Unique Shape Context.
1330  * \ingroup common
1331  */
1333  {
1334  float descriptor[1960] = {0.f};
1335  float rf[9] = {0.f};
1336  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<UniqueShapeContext1960>; }
1337 
1338  inline constexpr UniqueShapeContext1960 () = default;
1339 
1340  friend std::ostream& operator << (std::ostream& os, const UniqueShapeContext1960& p);
1341  };
1342 
1343  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const SHOT352& p);
1344  /** \brief A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape only.
1345  * \ingroup common
1346  */
1347  struct SHOT352
1348  {
1349  float descriptor[352] = {0.f};
1350  float rf[9] = {0.f};
1351  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<SHOT352>; }
1352 
1353  inline constexpr SHOT352 () = default;
1354 
1355  friend std::ostream& operator << (std::ostream& os, const SHOT352& p);
1356  };
1357 
1358 
1359  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const SHOT1344& p);
1360  /** \brief A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape+color.
1361  * \ingroup common
1362  */
1363  struct SHOT1344
1364  {
1365  float descriptor[1344] = {0.f};
1366  float rf[9] = {0.f};
1367  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<SHOT1344>; }
1368 
1369  inline constexpr SHOT1344 () = default;
1370 
1371  friend std::ostream& operator << (std::ostream& os, const SHOT1344& p);
1372  };
1373 
1374 
1375  /** \brief A structure representing the Local Reference Frame of a point.
1376  * \ingroup common
1377  */
1378  struct EIGEN_ALIGN16 _ReferenceFrame
1379  {
1380  union
1381  {
1382  float rf[9];
1383  struct
1384  {
1385  float x_axis[3];
1386  float y_axis[3];
1387  float z_axis[3];
1388  };
1389  };
1390 
1391  inline Eigen::Map<Eigen::Vector3f> getXAxisVector3fMap () { return (Eigen::Vector3f::Map (x_axis)); }
1392  inline const Eigen::Map<const Eigen::Vector3f> getXAxisVector3fMap () const { return (Eigen::Vector3f::Map (x_axis)); }
1393  inline Eigen::Map<Eigen::Vector3f> getYAxisVector3fMap () { return (Eigen::Vector3f::Map (y_axis)); }
1394  inline const Eigen::Map<const Eigen::Vector3f> getYAxisVector3fMap () const { return (Eigen::Vector3f::Map (y_axis)); }
1395  inline Eigen::Map<Eigen::Vector3f> getZAxisVector3fMap () { return (Eigen::Vector3f::Map (z_axis)); }
1396  inline const Eigen::Map<const Eigen::Vector3f> getZAxisVector3fMap () const { return (Eigen::Vector3f::Map (z_axis)); }
1397  inline Eigen::Map<Eigen::Matrix3f> getMatrix3fMap () { return (Eigen::Matrix3f::Map (rf)); }
1398  inline const Eigen::Map<const Eigen::Matrix3f> getMatrix3fMap () const { return (Eigen::Matrix3f::Map (rf)); }
1399 
1401  };
1402 
1403  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const ReferenceFrame& p);
1404  struct EIGEN_ALIGN16 ReferenceFrame : public _ReferenceFrame
1405  {
1406  inline constexpr ReferenceFrame (const _ReferenceFrame &p) :
1407  ReferenceFrame{p.rf}
1408  {
1409  //std::copy_n(p.rf, 9, rf); // this algorithm is constexpr starting from C++20
1410  }
1411 
1412  inline constexpr ReferenceFrame () :
1413  _ReferenceFrame{ {{0.0f}} }
1414  {
1415  // this algorithm is constexpr starting from C++20
1416  /*std::fill_n(x_axis, 3, 0.f);
1417  std::fill_n(y_axis, 3, 0.f);
1418  std::fill_n(z_axis, 3, 0.f);*/
1419  }
1420 
1421  inline constexpr ReferenceFrame (const float (&_rf)[9]) :
1422  _ReferenceFrame{ {{_rf[0], _rf[1], _rf[2], _rf[3], _rf[4], _rf[5], _rf[6], _rf[7], _rf[8]}} } {}
1423 
1424  friend std::ostream& operator << (std::ostream& os, const ReferenceFrame& p);
1426  };
1427 
1428 
1429  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const FPFHSignature33& p);
1430  /** \brief A point structure representing the Fast Point Feature Histogram (FPFH).
1431  * \ingroup common
1432  */
1434  {
1435  float histogram[33] = {0.f};
1436  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<FPFHSignature33>; }
1437 
1438  inline constexpr FPFHSignature33 () = default;
1439 
1440  friend std::ostream& operator << (std::ostream& os, const FPFHSignature33& p);
1441  };
1442 
1443  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const VFHSignature308& p);
1444  /** \brief A point structure representing the Viewpoint Feature Histogram (VFH).
1445  * \ingroup common
1446  */
1448  {
1449  float histogram[308] = {0.f};
1450  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<VFHSignature308>; }
1451 
1452  inline constexpr VFHSignature308 () = default;
1453 
1454  friend std::ostream& operator << (std::ostream& os, const VFHSignature308& p);
1455  };
1456 
1457  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GRSDSignature21& p);
1458  /** \brief A point structure representing the Global Radius-based Surface Descriptor (GRSD).
1459  * \ingroup common
1460  */
1462  {
1463  float histogram[21] = {0.f};
1464  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<GRSDSignature21>; }
1465 
1466  inline constexpr GRSDSignature21 () = default;
1467 
1468  friend std::ostream& operator << (std::ostream& os, const GRSDSignature21& p);
1469  };
1470 
1471  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const BRISKSignature512& p);
1472  /** \brief A point structure representing the Binary Robust Invariant Scalable Keypoints (BRISK).
1473  * \ingroup common
1474  */
1476  {
1477  float scale = 0.f;
1478  float orientation = 0.f;
1479  unsigned char descriptor[64] = {0};
1480  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<BRISKSignature512>; }
1481 
1482  inline constexpr BRISKSignature512 () = default;
1483 
1484  inline constexpr BRISKSignature512 (float _scale, float _orientation): scale (_scale), orientation (_orientation) {}
1485 
1486  friend std::ostream& operator << (std::ostream& os, const BRISKSignature512& p);
1487  };
1488 
1489  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const ESFSignature640& p);
1490  /** \brief A point structure representing the Ensemble of Shape Functions (ESF).
1491  * \ingroup common
1492  */
1494  {
1495  float histogram[640] = {0.f};
1496  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<ESFSignature640>; }
1497 
1498  inline constexpr ESFSignature640 () = default;
1499 
1500  friend std::ostream& operator << (std::ostream& os, const ESFSignature640& p);
1501  };
1502 
1503  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GASDSignature512& p);
1504  /** \brief A point structure representing the Globally Aligned Spatial Distribution (GASD) shape descriptor.
1505  * \ingroup common
1506  */
1508  {
1509  float histogram[512] = {0.f};
1510  static constexpr int descriptorSize() { return detail::traits::descriptorSize_v<GASDSignature512>; }
1511 
1512  inline constexpr GASDSignature512 () = default;
1513 
1514  friend std::ostream& operator << (std::ostream& os, const GASDSignature512& p);
1515  };
1516 
1517  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GASDSignature984& p);
1518  /** \brief A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descriptor.
1519  * \ingroup common
1520  */
1522  {
1523  float histogram[984] = {0.f};
1524  static constexpr int descriptorSize() { return detail::traits::descriptorSize_v<GASDSignature984>; }
1525 
1526  inline constexpr GASDSignature984 () = default;
1527 
1528  friend std::ostream& operator << (std::ostream& os, const GASDSignature984& p);
1529  };
1530 
1531  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GASDSignature7992& p);
1532  /** \brief A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descriptor.
1533  * \ingroup common
1534  */
1536  {
1537  float histogram[7992] = {0.f};
1538  static constexpr int descriptorSize() { return detail::traits::descriptorSize_v<GASDSignature7992>; }
1539 
1540  inline constexpr GASDSignature7992 () = default;
1541 
1542  friend std::ostream& operator << (std::ostream& os, const GASDSignature7992& p);
1543  };
1544 
1545  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GFPFHSignature16& p);
1546  /** \brief A point structure representing the GFPFH descriptor with 16 bins.
1547  * \ingroup common
1548  */
1550  {
1551  float histogram[16] = {0.f};
1552  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<GFPFHSignature16>; }
1553 
1554  inline constexpr GFPFHSignature16 () = default;
1555 
1556  friend std::ostream& operator << (std::ostream& os, const GFPFHSignature16& p);
1557  };
1558 
1559  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Narf36& p);
1560  /** \brief A point structure representing the Narf descriptor.
1561  * \ingroup common
1562  */
1563  struct Narf36
1564  {
1565  float x = 0.f, y = 0.f, z = 0.f, roll = 0.f, pitch = 0.f, yaw = 0.f;
1566  float descriptor[36] = {0.f};
1567  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<Narf36>; }
1568 
1569  inline constexpr Narf36 () = default;
1570 
1571  inline constexpr Narf36 (float _x, float _y, float _z): Narf36 (_x, _y, _z, 0.f, 0.f, 0.f) {}
1572 
1573  inline constexpr Narf36 (float _x, float _y, float _z, float _roll, float _pitch, float _yaw):
1574  x (_x), y (_y), z (_z), roll (_roll), pitch (_pitch), yaw (_yaw) {}
1575 
1576  friend std::ostream& operator << (std::ostream& os, const Narf36& p);
1577  };
1578 
1579  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const BorderDescription& p);
1580  /** \brief A structure to store if a point in a range image lies on a border between an obstacle and the background.
1581  * \ingroup common
1582  */
1584  {
1585  int x = 0, y = 0;
1587  //std::vector<const BorderDescription*> neighbors;
1588 
1589  inline constexpr BorderDescription () = default;
1590 
1591  inline constexpr BorderDescription (int _x, int _y) : x(_x), y(_y) {}
1592 
1593  friend std::ostream& operator << (std::ostream& os, const BorderDescription& p);
1594  };
1595 
1596 
1597  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const IntensityGradient& p);
1598  /** \brief A point structure representing the intensity gradient of an XYZI point cloud.
1599  * \ingroup common
1600  */
1602  {
1603  union
1604  {
1605  float gradient[3];
1606  struct
1607  {
1608  float gradient_x;
1609  float gradient_y;
1610  float gradient_z;
1611  };
1612  };
1613 
1614  inline constexpr IntensityGradient (): IntensityGradient (0.f, 0.f, 0.f) {}
1615 
1616  inline constexpr IntensityGradient (float _x, float _y, float _z): gradient_x (_x), gradient_y (_y), gradient_z (_z) {}
1617 
1618  friend std::ostream& operator << (std::ostream& os, const IntensityGradient& p);
1619  };
1620 
1621  // TODO: Maybe make other histogram based structs an alias for this
1622  /** \brief A point structure representing an N-D histogram.
1623  * \ingroup common
1624  */
1625  template <int N>
1626  struct Histogram
1627  {
1628  float histogram[N];
1629  static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<Histogram<N>>; }
1630  };
1631 
1632  struct EIGEN_ALIGN16 _PointWithScale
1633  {
1634  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1635 
1636  union
1637  {
1638  /** \brief Diameter of the meaningful keypoint neighborhood. */
1639  float scale;
1640  float size;
1641  };
1642 
1643  /** \brief Computed orientation of the keypoint (-1 if not applicable). */
1644  float angle;
1645  /** \brief The response by which the most strong keypoints have been selected. */
1646  float response;
1647  /** \brief octave (pyramid layer) from which the keypoint has been extracted. */
1648  int octave;
1649 
1651  };
1652 
1653  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithScale& p);
1654  /** \brief A point structure representing a 3-D position and scale.
1655  * \ingroup common
1656  */
1658  {
1659  inline constexpr PointWithScale (const _PointWithScale &p) :
1660  PointWithScale{p.x, p.y, p.z, p.scale, p.angle, p.response, p.octave} {}
1661 
1662  inline constexpr PointWithScale (): PointWithScale (0.f, 0.f, 0.f) {}
1663 
1664  inline constexpr PointWithScale (float _x, float _y, float _z, float _scale = 1.f,
1665  float _angle = -1.f, float _response = 0.f, int _octave = 0) :
1666  _PointWithScale{{{_x, _y, _z, 1.0f}}, {_scale}, _angle, _response, _octave } {}
1667 
1668  friend std::ostream& operator << (std::ostream& os, const PointWithScale& p);
1669  };
1670 
1671 
1672  struct EIGEN_ALIGN16 _PointSurfel
1673  {
1674  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1675  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
1676  union
1677  {
1678  struct
1679  {
1681  float radius;
1682  float confidence;
1683  float curvature;
1684  };
1685  float data_c[4];
1686  };
1689  };
1690 
1691  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointSurfel& p);
1692  /** \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.
1693  * \ingroup common
1694  */
1695  struct PointSurfel : public _PointSurfel
1696  {
1697  inline constexpr PointSurfel (const _PointSurfel &p) :
1698  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} {}
1699 
1700  inline constexpr PointSurfel () :
1701  PointSurfel{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0u, 0u, 0u, 0u, 0.0f, 0.0f, 0.0f} {}
1702 
1703  inline constexpr PointSurfel (float _x, float _y, float _z, float _nx,
1704  float _ny, float _nz, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a,
1705  float _radius, float _confidence, float _curvature) :
1706  _PointSurfel{
1707  {{_x, _y, _z, 1.0f}},
1708  {{_nx, _ny, _nz, 0.0f}},
1709  {{{{{_b, _g, _r, _a}}}, _radius, _confidence, _curvature}}
1710  } {}
1711 
1712 
1713  friend std::ostream& operator << (std::ostream& os, const PointSurfel& p);
1714  };
1715 
1716  struct EIGEN_ALIGN16 _PointDEM
1717  {
1719  float intensity;
1723  };
1724 
1725  PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointDEM& p);
1726  /** \brief A point structure representing Digital Elevation Map.
1727  * \ingroup common
1728  */
1729  struct PointDEM : public _PointDEM
1730  {
1731  inline constexpr PointDEM (const _PointDEM &p) :
1732  PointDEM{p.x, p.y, p.z, p.intensity, p.intensity_variance, p.height_variance} {}
1733 
1734  inline constexpr PointDEM (): PointDEM (0.f, 0.f, 0.f) {}
1735 
1736  inline constexpr PointDEM (float _x, float _y, float _z): PointDEM (_x, _y, _z, 0.f, 0.f, 0.f) {}
1737 
1738  inline constexpr PointDEM (float _x, float _y, float _z, float _intensity,
1739  float _intensity_variance, float _height_variance) :
1740  _PointDEM{{{_x, _y, _z, 1.0f}}, _intensity, _intensity_variance, _height_variance} {}
1741 
1742  friend std::ostream& operator << (std::ostream& os, const PointDEM& p);
1743  };
1744 
1745  template <int N> std::ostream&
1746  operator << (std::ostream& os, const Histogram<N>& p)
1747  {
1748  // make constexpr
1749  PCL_IF_CONSTEXPR(N > 0)
1750  {
1751  os << "(" << p.histogram[0];
1752  std::for_each(p.histogram + 1, std::end(p.histogram),
1753  [&os](const auto& hist) { os << ", " << hist; });
1754  os << ")";
1755  }
1756  return (os);
1757  }
1758 } // namespace pcl
1759 
1760 // Register point structs and wrappers
1761 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_RGB,
1762  (std::uint32_t, rgba, rgba)
1763 )
1764 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::RGB, pcl::_RGB)
1765 
1766 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Intensity,
1767  (float, intensity, intensity)
1768 )
1769 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity, pcl::_Intensity)
1770 
1771 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Intensity8u,
1772  (std::uint8_t, intensity, intensity)
1773 )
1774 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity8u, pcl::_Intensity8u)
1775 
1776 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Intensity32u,
1777  (std::uint32_t, intensity, intensity)
1778 )
1779 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity32u, pcl::_Intensity32u)
1780 
1781 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZ,
1782  (float, x, x)
1783  (float, y, y)
1784  (float, z, z)
1785 )
1786 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZ, pcl::_PointXYZ)
1787 
1788 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBA,
1789  (float, x, x)
1790  (float, y, y)
1791  (float, z, z)
1792  (std::uint32_t, rgba, rgba)
1793 )
1794 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBA, pcl::_PointXYZRGBA)
1795 
1796 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGB,
1797  (float, x, x)
1798  (float, y, y)
1799  (float, z, z)
1800  (float, rgb, rgb)
1801 )
1802 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGB, pcl::_PointXYZRGB)
1803 
1804 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBL,
1805  (float, x, x)
1806  (float, y, y)
1807  (float, z, z)
1808  (std::uint32_t, rgba, rgba)
1809  (std::uint32_t, label, label)
1810 )
1811 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBL, pcl::_PointXYZRGBL)
1812 
1813 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZLAB,
1814  (float, x, x)
1815  (float, y, y)
1816  (float, z, z)
1817  (float, L, L)
1818  (float, a, a)
1819  (float, b, b)
1820 )
1821 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZLAB, pcl::_PointXYZLAB)
1822 
1823 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZHSV,
1824  (float, x, x)
1825  (float, y, y)
1826  (float, z, z)
1827  (float, h, h)
1828  (float, s, s)
1829  (float, v, v)
1830 )
1831 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZHSV, pcl::_PointXYZHSV)
1832 
1833 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXY,
1834  (float, x, x)
1835  (float, y, y)
1836 )
1837 
1838 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointUV,
1839  (float, u, u)
1840  (float, v, v)
1841 )
1842 
1843 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::InterestPoint,
1844  (float, x, x)
1845  (float, y, y)
1846  (float, z, z)
1847  (float, strength, strength)
1848 )
1849 
1850 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZI,
1851  (float, x, x)
1852  (float, y, y)
1853  (float, z, z)
1854  (float, intensity, intensity)
1855 )
1856 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZI, pcl::_PointXYZI)
1857 
1858 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZL,
1859  (float, x, x)
1860  (float, y, y)
1861  (float, z, z)
1862  (std::uint32_t, label, label)
1863 )
1864 
1865 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Label,
1866  (std::uint32_t, label, label)
1867 )
1868 
1869 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Normal,
1870  (float, normal_x, normal_x)
1871  (float, normal_y, normal_y)
1872  (float, normal_z, normal_z)
1873  (float, curvature, curvature)
1874 )
1875 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Normal, pcl::_Normal)
1876 
1877 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Axis,
1878  (float, normal_x, normal_x)
1879  (float, normal_y, normal_y)
1880  (float, normal_z, normal_z)
1881 )
1882 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Axis, pcl::_Axis)
1883 
1884 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointNormal,
1885  (float, x, x)
1886  (float, y, y)
1887  (float, z, z)
1888  (float, normal_x, normal_x)
1889  (float, normal_y, normal_y)
1890  (float, normal_z, normal_z)
1891  (float, curvature, curvature)
1892 )
1893 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBNormal,
1894  (float, x, x)
1895  (float, y, y)
1896  (float, z, z)
1897  (float, rgb, rgb)
1898  (float, normal_x, normal_x)
1899  (float, normal_y, normal_y)
1900  (float, normal_z, normal_z)
1901  (float, curvature, curvature)
1902 )
1903 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBNormal, pcl::_PointXYZRGBNormal)
1904 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZINormal,
1905  (float, x, x)
1906  (float, y, y)
1907  (float, z, z)
1908  (float, intensity, intensity)
1909  (float, normal_x, normal_x)
1910  (float, normal_y, normal_y)
1911  (float, normal_z, normal_z)
1912  (float, curvature, curvature)
1913 )
1914 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZLNormal,
1915  (float, x, x)
1916  (float, y, y)
1917  (float, z, z)
1918  (std::uint32_t, label, label)
1919  (float, normal_x, normal_x)
1920  (float, normal_y, normal_y)
1921  (float, normal_z, normal_z)
1922  (float, curvature, curvature)
1923 )
1924 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithRange,
1925  (float, x, x)
1926  (float, y, y)
1927  (float, z, z)
1928  (float, range, range)
1929 )
1930 
1931 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointWithViewpoint,
1932  (float, x, x)
1933  (float, y, y)
1934  (float, z, z)
1935  (float, vp_x, vp_x)
1936  (float, vp_y, vp_y)
1937  (float, vp_z, vp_z)
1938 )
1939 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointWithViewpoint, pcl::_PointWithViewpoint)
1940 
1941 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::MomentInvariants,
1942  (float, j1, j1)
1943  (float, j2, j2)
1944  (float, j3, j3)
1945 )
1946 
1947 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PrincipalRadiiRSD,
1948  (float, r_min, r_min)
1949  (float, r_max, r_max)
1950 )
1951 
1952 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Boundary,
1953  (std::uint8_t, boundary_point, boundary_point)
1954 )
1955 
1956 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PrincipalCurvatures,
1957  (float, principal_curvature_x, principal_curvature_x)
1958  (float, principal_curvature_y, principal_curvature_y)
1959  (float, principal_curvature_z, principal_curvature_z)
1960  (float, pc1, pc1)
1961  (float, pc2, pc2)
1962 )
1963 
1964 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PFHSignature125,
1965  (float[125], histogram, pfh)
1966 )
1967 
1968 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PFHRGBSignature250,
1969  (float[250], histogram, pfhrgb)
1970 )
1971 
1972 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFSignature,
1973  (float, f1, f1)
1974  (float, f2, f2)
1975  (float, f3, f3)
1976  (float, f4, f4)
1977  (float, alpha_m, alpha_m)
1978 )
1979 
1980 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::CPPFSignature,
1981  (float, f1, f1)
1982  (float, f2, f2)
1983  (float, f3, f3)
1984  (float, f4, f4)
1985  (float, f5, f5)
1986  (float, f6, f6)
1987  (float, f7, f7)
1988  (float, f8, f8)
1989  (float, f9, f9)
1990  (float, f10, f10)
1991  (float, alpha_m, alpha_m)
1992 )
1993 
1994 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFRGBSignature,
1995  (float, f1, f1)
1996  (float, f2, f2)
1997  (float, f3, f3)
1998  (float, f4, f4)
1999  (float, r_ratio, r_ratio)
2000  (float, g_ratio, g_ratio)
2001  (float, b_ratio, b_ratio)
2002  (float, alpha_m, alpha_m)
2003 )
2004 
2005 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::NormalBasedSignature12,
2006  (float[12], values, values)
2007 )
2008 
2009 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::ShapeContext1980,
2010  (float[1980], descriptor, shape_context)
2011  (float[9], rf, rf)
2012 )
2013 
2014 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::UniqueShapeContext1960,
2015  (float[1960], descriptor, shape_context)
2016  (float[9], rf, rf)
2017 )
2018 
2019 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::SHOT352,
2020  (float[352], descriptor, shot)
2021  (float[9], rf, rf)
2022 )
2023 
2024 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::SHOT1344,
2025  (float[1344], descriptor, shot)
2026  (float[9], rf, rf)
2027 )
2028 
2029 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::FPFHSignature33,
2030  (float[33], histogram, fpfh)
2031 )
2032 
2033 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::BRISKSignature512,
2034  (float, scale, brisk_scale)
2035  (float, orientation, brisk_orientation)
2036  (unsigned char[64], descriptor, brisk_descriptor512)
2037 )
2038 
2039 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::VFHSignature308,
2040  (float[308], histogram, vfh)
2041 )
2042 
2043 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::GRSDSignature21,
2044  (float[21], histogram, grsd)
2045 )
2046 
2047 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::ESFSignature640,
2048  (float[640], histogram, esf)
2049 )
2050 
2051 POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::GASDSignature512,
2052  (float[512], histogram, gasd)
2053 )
2054 
2055 POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::GASDSignature984,
2056  (float[984], histogram, gasd)
2057 )
2058 
2059 POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::GASDSignature7992,
2060  (float[7992], histogram, gasd)
2061 )
2062 
2063 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Narf36,
2064  (float[36], descriptor, descriptor)
2065 )
2066 
2067 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::GFPFHSignature16,
2068  (float[16], histogram, gfpfh)
2069 )
2070 
2071 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::IntensityGradient,
2072  (float, gradient_x, gradient_x)
2073  (float, gradient_y, gradient_y)
2074  (float, gradient_z, gradient_z)
2075 )
2076 
2077 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithScale,
2078  (float, x, x)
2079  (float, y, y)
2080  (float, z, z)
2081  (float, scale, scale)
2082 )
2083 
2084 POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::PointSurfel,
2085  (float, x, x)
2086  (float, y, y)
2087  (float, z, z)
2088  (float, normal_x, normal_x)
2089  (float, normal_y, normal_y)
2090  (float, normal_z, normal_z)
2091  (std::uint32_t, rgba, rgba)
2092  (float, radius, radius)
2093  (float, confidence, confidence)
2094  (float, curvature, curvature)
2095 )
2096 
2097 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_ReferenceFrame,
2098  (float[3], x_axis, x_axis)
2099  (float[3], y_axis, y_axis)
2100  (float[3], z_axis, z_axis)
2101 )
2102 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::ReferenceFrame, pcl::_ReferenceFrame)
2103 
2104 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointDEM,
2105  (float, x, x)
2106  (float, y, y)
2107  (float, z, z)
2108  (float, intensity, intensity)
2109  (float, intensity_variance, intensity_variance)
2110  (float, height_variance, height_variance)
2111 )
2112 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointDEM, pcl::_PointDEM)
2113 
2114 namespace pcl
2115 {
2116 
2117 // Allow float 'rgb' data to match to the newer uint32 'rgba' tag. This is so
2118 // you can load old 'rgb' PCD files into e.g. a PointCloud<PointXYZRGBA>.
2119 template<typename PointT>
2120 struct FieldMatches<PointT, ::pcl::fields::rgba>
2121 {
2122  bool operator() (const pcl::PCLPointField& field)
2123  {
2124  if (field.name == "rgb")
2125  {
2126  // For fixing the alpha value bug #1141, the rgb field can also match
2127  // uint32.
2128  return ((field.datatype == pcl::PCLPointField::FLOAT32 ||
2130  field.count == 1);
2131  }
2132  else
2133  {
2134  return (field.name == traits::name<PointT, fields::rgba>::value &&
2135  field.datatype == traits::datatype<PointT, fields::rgba>::value &&
2136  field.count == traits::datatype<PointT, fields::rgba>::size);
2137  }
2138  }
2139 };
2140 template<typename PointT>
2141 struct FieldMatches<PointT, fields::rgb>
2142 {
2143  bool operator() (const pcl::PCLPointField& field)
2144  {
2145  if (field.name == "rgba")
2146  {
2147  return (field.datatype == pcl::PCLPointField::UINT32 &&
2148  field.count == 1);
2149  }
2150  else
2151  {
2152  // For fixing the alpha value bug #1141, rgb can also match uint32
2153  return (field.name == traits::name<PointT, fields::rgb>::value &&
2154  (field.datatype == traits::datatype<PointT, fields::rgb>::value ||
2156  field.count == traits::datatype<PointT, fields::rgb>::size);
2157  }
2158  }
2159 };
2160 
2161 
2162 // We're doing a lot of black magic with Boost here, so disable warnings in Maintainer mode, as we will never
2163 // be able to fix them anyway
2164 #if defined _MSC_VER
2165  #pragma warning(disable: 4201)
2166 #endif
2167 
2168 namespace traits
2169 {
2170 
2171  /** \brief Metafunction to check if a given point type has a given field.
2172  *
2173  * Example usage at run-time:
2174  *
2175  * \code
2176  * bool curvature_available = pcl::traits::has_field<PointT, pcl::fields::curvature>::value;
2177  * \endcode
2178  *
2179  * Example usage at compile-time:
2180  *
2181  * \code
2182  * BOOST_MPL_ASSERT_MSG ((pcl::traits::has_field<PointT, pcl::fields::label>::value),
2183  * POINT_TYPE_SHOULD_HAVE_LABEL_FIELD,
2184  * (PointT));
2185  * \endcode
2186  */
2187  template <typename PointT, typename Field>
2188  struct has_field : boost::mpl::contains<typename pcl::traits::fieldList<PointT>::type, Field>::type
2189  { };
2190 
2191  /** Metafunction to check if a given point type has all given fields. */
2192  template <typename PointT, typename Field>
2193  struct has_all_fields : boost::mpl::fold<Field,
2194  boost::mpl::bool_<true>,
2195  boost::mpl::and_<boost::mpl::_1,
2196  has_field<PointT, boost::mpl::_2> > >::type
2197  { };
2198 
2199  /** Metafunction to check if a given point type has any of the given fields. */
2200  template <typename PointT, typename Field>
2201  struct has_any_field : boost::mpl::fold<Field,
2202  boost::mpl::bool_<false>,
2203  boost::mpl::or_<boost::mpl::_1,
2204  has_field<PointT, boost::mpl::_2> > >::type
2205  { };
2206 
2207  /** \brief Traits defined for ease of use with fields already registered before
2208  *
2209  * has_<fields to be detected>: struct with `value` datamember defined at compiletime
2210  * has_<fields to be detected>_v: constexpr boolean
2211  * Has<Fields to be detected>: concept modelling name alias for `enable_if`
2212  */
2213 
2214  /** Metafunction to check if a given point type has x and y fields. */
2215  template <typename PointT>
2216  struct has_xy : has_all_fields<PointT, boost::mpl::vector<pcl::fields::x,
2217  pcl::fields::y> >
2218  { };
2219 
2220  template <typename PointT>
2221  constexpr auto has_xy_v = has_xy<PointT>::value;
2222 
2223  template <typename PointT>
2224  using HasXY = std::enable_if_t<has_xy_v<PointT>, bool>;
2225 
2226  template <typename PointT>
2227  using HasNoXY = std::enable_if_t<!has_xy_v<PointT>, bool>;
2228 
2229  /** Metafunction to check if a given point type has x, y, and z fields. */
2230  template <typename PointT>
2231  struct has_xyz : has_all_fields<PointT, boost::mpl::vector<pcl::fields::x,
2232  pcl::fields::y,
2233  pcl::fields::z> >
2234  { };
2235 
2236  template <typename PointT>
2237  constexpr auto has_xyz_v = has_xyz<PointT>::value;
2238 
2239  template <typename PointT>
2240  using HasXYZ = std::enable_if_t<has_xyz_v<PointT>, bool>;
2241 
2242  template <typename PointT>
2243  using HasNoXYZ = std::enable_if_t<!has_xyz_v<PointT>, bool>;
2244 
2245  /** Metafunction to check if a given point type has normal_x, normal_y, and
2246  * normal_z fields. */
2247  template <typename PointT>
2248  struct has_normal : has_all_fields<PointT, boost::mpl::vector<pcl::fields::normal_x,
2249  pcl::fields::normal_y,
2250  pcl::fields::normal_z> >
2251  { };
2252 
2253  template <typename PointT>
2254  constexpr auto has_normal_v = has_normal<PointT>::value;
2255 
2256  template <typename PointT>
2257  using HasNormal = std::enable_if_t<has_normal_v<PointT>, bool>;
2258 
2259  template <typename PointT>
2260  using HasNoNormal = std::enable_if_t<!has_normal_v<PointT>, bool>;
2261 
2262  /** Metafunction to check if a given point type has curvature field. */
2263  template <typename PointT>
2264  struct has_curvature : has_field<PointT, pcl::fields::curvature>
2265  { };
2266 
2267  template <typename PointT>
2268  constexpr auto has_curvature_v = has_curvature<PointT>::value;
2269 
2270  template <typename PointT>
2271  using HasCurvature = std::enable_if_t<has_curvature_v<PointT>, bool>;
2272 
2273  template <typename PointT>
2274  using HasNoCurvature = std::enable_if_t<!has_curvature_v<PointT>, bool>;
2275 
2276  /** Metafunction to check if a given point type has intensity field. */
2277  template <typename PointT>
2278  struct has_intensity : has_field<PointT, pcl::fields::intensity>
2279  { };
2280 
2281  template <typename PointT>
2282  constexpr auto has_intensity_v = has_intensity<PointT>::value;
2283 
2284  template <typename PointT>
2285  using HasIntensity = std::enable_if_t<has_intensity_v<PointT>, bool>;
2286 
2287  template <typename PointT>
2288  using HasNoIntensity = std::enable_if_t<!has_intensity_v<PointT>, bool>;
2289 
2290  /** Metafunction to check if a given point type has either rgb or rgba field. */
2291  template <typename PointT>
2292  struct has_color : has_any_field<PointT, boost::mpl::vector<pcl::fields::rgb,
2293  pcl::fields::rgba> >
2294  { };
2295 
2296  template <typename PointT>
2297  constexpr auto has_color_v = has_color<PointT>::value;
2298 
2299  template <typename PointT>
2300  using HasColor = std::enable_if_t<has_color_v<PointT>, bool>;
2301 
2302  template <typename PointT>
2303  using HasNoColor = std::enable_if_t<!has_color_v<PointT>, bool>;
2304 
2305  /** Metafunction to check if a given point type has label field. */
2306  template <typename PointT>
2307  struct has_label : has_field<PointT, pcl::fields::label>
2308  { };
2309 
2310  template <typename PointT>
2311  constexpr auto has_label_v = has_label<PointT>::value;
2312 
2313  template <typename PointT>
2314  using HasLabel = std::enable_if_t<has_label_v<PointT>, bool>;
2315 
2316  template <typename PointT>
2317  using HasNoLabel = std::enable_if_t<!has_label_v<PointT>, bool>;
2318 }
2319 
2320 #if defined _MSC_VER
2321  #pragma warning(default: 4201)
2322 #endif
2323 
2324 } // namespace pcl
2325 
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
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.
std::uint32_t label
std::uint32_t label
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:65
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