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>
218       static constexpr int descriptorSize_v = descriptorSize<FeaturePointT>::value;
219     }
220   }
221 
222   using Array3fMap = Eigen::Map<Eigen::Array3f>;
223   using Array3fMapConst = const Eigen::Map<const Eigen::Array3f>;
224   using Array4fMap = Eigen::Map<Eigen::Array4f, Eigen::Aligned>;
225   using Array4fMapConst = const Eigen::Map<const Eigen::Array4f, Eigen::Aligned>;
226   using Vector3fMap = Eigen::Map<Eigen::Vector3f>;
227   using Vector3fMapConst = const Eigen::Map<const Eigen::Vector3f>;
228   using Vector4fMap = Eigen::Map<Eigen::Vector4f, Eigen::Aligned>;
229   using Vector4fMapConst = const Eigen::Map<const Eigen::Vector4f, Eigen::Aligned>;
230 
231   using Vector3c = Eigen::Matrix<std::uint8_t, 3, 1>;
232   using Vector3cMap = Eigen::Map<Vector3c>;
233   using Vector3cMapConst = const Eigen::Map<const Vector3c>;
234   using Vector4c = Eigen::Matrix<std::uint8_t, 4, 1>;
235   using Vector4cMap = Eigen::Map<Vector4c, Eigen::Aligned>;
236   using Vector4cMapConst = const Eigen::Map<const Vector4c, Eigen::Aligned>;
237 
238 #define PCL_ADD_UNION_POINT4D \
239   union EIGEN_ALIGN16 { \
240     float data[4]; \
241     struct { \
242       float x; \
243       float y; \
244       float z; \
245     }; \
246   };
247 
248 #define PCL_ADD_EIGEN_MAPS_POINT4D \
249   inline pcl::Vector3fMap getVector3fMap () { return (pcl::Vector3fMap (data)); } \
250   inline pcl::Vector3fMapConst getVector3fMap () const { return (pcl::Vector3fMapConst (data)); } \
251   inline pcl::Vector4fMap getVector4fMap () { return (pcl::Vector4fMap (data)); } \
252   inline pcl::Vector4fMapConst getVector4fMap () const { return (pcl::Vector4fMapConst (data)); } \
253   inline pcl::Array3fMap getArray3fMap () { return (pcl::Array3fMap (data)); } \
254   inline pcl::Array3fMapConst getArray3fMap () const { return (pcl::Array3fMapConst (data)); } \
255   inline pcl::Array4fMap getArray4fMap () { return (pcl::Array4fMap (data)); } \
256   inline pcl::Array4fMapConst getArray4fMap () const { return (pcl::Array4fMapConst (data)); }
257 
258 #define PCL_ADD_POINT4D \
259   PCL_ADD_UNION_POINT4D \
260   PCL_ADD_EIGEN_MAPS_POINT4D
261 
262 #define PCL_ADD_UNION_NORMAL4D \
263   union EIGEN_ALIGN16 { \
264     float data_n[4]; \
265     float normal[3]; \
266     struct { \
267       float normal_x; \
268       float normal_y; \
269       float normal_z; \
270     }; \
271   };
272 
273 #define PCL_ADD_EIGEN_MAPS_NORMAL4D \
274   inline pcl::Vector3fMap getNormalVector3fMap () { return (pcl::Vector3fMap (data_n)); } \
275   inline pcl::Vector3fMapConst getNormalVector3fMap () const { return (pcl::Vector3fMapConst (data_n)); } \
276   inline pcl::Vector4fMap getNormalVector4fMap () { return (pcl::Vector4fMap (data_n)); } \
277   inline pcl::Vector4fMapConst getNormalVector4fMap () const { return (pcl::Vector4fMapConst (data_n)); }
278 
279 #define PCL_ADD_NORMAL4D \
280   PCL_ADD_UNION_NORMAL4D \
281   PCL_ADD_EIGEN_MAPS_NORMAL4D
282 
283 #define PCL_ADD_UNION_RGB \
284   union \
285   { \
286     union \
287     { \
288       struct \
289       { \
290         std::uint8_t b; \
291         std::uint8_t g; \
292         std::uint8_t r; \
293         std::uint8_t a; \
294       }; \
295       float rgb; \
296     }; \
297     std::uint32_t rgba; \
298   };
299 
300 #define PCL_ADD_EIGEN_MAPS_RGB \
301   inline Eigen::Vector3i getRGBVector3i () { return (Eigen::Vector3i (r, g, b)); } \
302   inline const Eigen::Vector3i getRGBVector3i () const { return (Eigen::Vector3i (r, g, b)); } \
303   inline Eigen::Vector4i getRGBVector4i () { return (Eigen::Vector4i (r, g, b, a)); } \
304   inline const Eigen::Vector4i getRGBVector4i () const { return (Eigen::Vector4i (r, g, b, a)); } \
305   inline Eigen::Vector4i getRGBAVector4i () { return (Eigen::Vector4i (r, g, b, a)); } \
306   inline const Eigen::Vector4i getRGBAVector4i () const { return (Eigen::Vector4i (r, g, b, a)); } \
307   inline pcl::Vector3cMap getBGRVector3cMap () { return (pcl::Vector3cMap (reinterpret_cast<std::uint8_t*> (&rgba))); } \
308   inline pcl::Vector3cMapConst getBGRVector3cMap () const { return (pcl::Vector3cMapConst (reinterpret_cast<const std::uint8_t*> (&rgba))); } \
309   inline pcl::Vector4cMap getBGRAVector4cMap () { return (pcl::Vector4cMap (reinterpret_cast<std::uint8_t*> (&rgba))); } \
310   inline pcl::Vector4cMapConst getBGRAVector4cMap () const { return (pcl::Vector4cMapConst (reinterpret_cast<const std::uint8_t*> (&rgba))); }
311 
312 #define PCL_ADD_RGB \
313   PCL_ADD_UNION_RGB \
314   PCL_ADD_EIGEN_MAPS_RGB
315 
316 #define PCL_ADD_INTENSITY \
317     struct \
318     { \
319       float intensity; \
320     }; \
321 
322 #define PCL_ADD_INTENSITY_8U \
323     struct \
324     { \
325       std::uint8_t intensity; \
326     }; \
327 
328 #define PCL_ADD_INTENSITY_32U \
329     struct \
330     { \
331         std::uint32_t intensity; \
332     }; \
333 
334 
335   struct _PointXYZ
336   {
337     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
338 
339     PCL_MAKE_ALIGNED_OPERATOR_NEW
340   };
341 
342   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZ& p);
343   /** \brief A point structure representing Euclidean xyz coordinates. (SSE friendly)
344     * \ingroup common
345     */
346   struct EIGEN_ALIGN16 PointXYZ : public _PointXYZ
347   {
PointXYZpcl::PointXYZ348     inline PointXYZ (const _PointXYZ &p): PointXYZ(p.x, p.y, p.z) {}
349 
PointXYZpcl::PointXYZ350     inline PointXYZ (): PointXYZ(0.f, 0.f, 0.f) {}
351 
PointXYZpcl::PointXYZ352     inline PointXYZ (float _x, float _y, float _z)
353     {
354       x = _x; y = _y; z = _z;
355       data[3] = 1.0f;
356     }
357 
358     friend std::ostream& operator << (std::ostream& os, const PointXYZ& p);
359     PCL_MAKE_ALIGNED_OPERATOR_NEW
360   };
361 
362 
363 #ifdef RGB
364 #undef RGB
365 #endif
366   struct _RGB
367   {
368     PCL_ADD_RGB;
369   };
370 
371   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const RGB& p);
372   /** \brief A structure representing RGB color information.
373     *
374     * The RGBA information is available either as separate r, g, b, or as a
375     * packed std::uint32_t rgba value. To pack it, use:
376     *
377     * \code
378     * int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b);
379     * \endcode
380     *
381     * To unpack it use:
382     *
383     * \code
384     * int rgb = ...;
385     * std::uint8_t r = (rgb >> 16) & 0x0000ff;
386     * std::uint8_t g = (rgb >> 8)  & 0x0000ff;
387     * std::uint8_t b = (rgb)     & 0x0000ff;
388     * \endcode
389     *
390     */
391   struct RGB: public _RGB
392   {
RGBpcl::RGB393     inline RGB (const _RGB &p)
394     {
395         rgba = p.rgba;
396     }
397 
RGBpcl::RGB398     inline RGB (): RGB(0, 0, 0) {}
399 
RGBpcl::RGB400     inline RGB (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
401     {
402       r = _r; g = _g; b = _b;
403       a = 255;
404     }
405 
406     friend std::ostream& operator << (std::ostream& os, const RGB& p);
407   };
408 
409   struct _Intensity
410   {
411     PCL_ADD_INTENSITY;
412   };
413 
414   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Intensity& p);
415   /** \brief A point structure representing the grayscale intensity in single-channel images.
416     * Intensity is represented as a float value.
417     * \ingroup common
418     */
419   struct Intensity: public _Intensity
420   {
Intensitypcl::Intensity421     inline Intensity (const _Intensity &p)
422     {
423       intensity = p.intensity;
424     }
425 
Intensitypcl::Intensity426     inline Intensity (float _intensity = 0.f)
427     {
428         intensity = _intensity;
429     }
430 
431     friend std::ostream& operator << (std::ostream& os, const Intensity& p);
432   };
433 
434 
435   struct _Intensity8u
436   {
437     PCL_ADD_INTENSITY_8U;
438   };
439 
440   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Intensity8u& p);
441   /** \brief A point structure representing the grayscale intensity in single-channel images.
442     * Intensity is represented as a std::uint8_t value.
443     * \ingroup common
444     */
445   struct Intensity8u: public _Intensity8u
446   {
Intensity8upcl::Intensity8u447     inline Intensity8u (const _Intensity8u &p)
448     {
449       intensity = p.intensity;
450     }
451 
Intensity8upcl::Intensity8u452     inline Intensity8u (std::uint8_t _intensity = 0)
453     {
454       intensity = _intensity;
455     }
456 
457 #if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 1101
operator unsigned charpcl::Intensity8u458     operator unsigned char() const
459     {
460       return intensity;
461     }
462 #endif
463 
464     friend std::ostream& operator << (std::ostream& os, const Intensity8u& p);
465   };
466 
467   struct _Intensity32u
468   {
469     PCL_ADD_INTENSITY_32U;
470   };
471 
472   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Intensity32u& p);
473   /** \brief A point structure representing the grayscale intensity in single-channel images.
474     * Intensity is represented as a std::uint32_t value.
475     * \ingroup common
476     */
477   struct Intensity32u: public _Intensity32u
478   {
Intensity32upcl::Intensity32u479     inline Intensity32u (const _Intensity32u &p)
480     {
481       intensity = p.intensity;
482     }
483 
Intensity32upcl::Intensity32u484     inline Intensity32u (std::uint32_t _intensity = 0)
485     {
486       intensity = _intensity;
487     }
488 
489     friend std::ostream& operator << (std::ostream& os, const Intensity32u& p);
490   };
491 
492   /** \brief A point structure representing Euclidean xyz coordinates, and the intensity value.
493     * \ingroup common
494     */
495   struct EIGEN_ALIGN16 _PointXYZI
496   {
497     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
498     union
499     {
500       struct
501       {
502         float intensity;
503       };
504       float data_c[4];
505     };
506     PCL_MAKE_ALIGNED_OPERATOR_NEW
507   };
508 
509   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZI& p);
510   struct PointXYZI : public _PointXYZI
511   {
PointXYZIpcl::PointXYZI512     inline PointXYZI (const _PointXYZI &p)
513     {
514       x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
515       intensity = p.intensity;
516     }
517 
PointXYZIpcl::PointXYZI518     inline PointXYZI (float _intensity = 0.f): PointXYZI(0.f, 0.f, 0.f, _intensity) {}
519 
PointXYZIpcl::PointXYZI520     inline PointXYZI (float _x, float _y, float _z, float _intensity = 0.f)
521     {
522       x = _x; y = _y; z = _z;
523       data[3] = 1.0f;
524       intensity = _intensity;
525     }
526 
527     friend std::ostream& operator << (std::ostream& os, const PointXYZI& p);
528   };
529 
530 
531   struct EIGEN_ALIGN16 _PointXYZL
532   {
533     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
534     std::uint32_t label;
535     PCL_MAKE_ALIGNED_OPERATOR_NEW
536   };
537 
538   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZL& p);
539   struct PointXYZL : public _PointXYZL
540   {
PointXYZLpcl::PointXYZL541     inline PointXYZL (const _PointXYZL &p)
542     {
543       x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
544       label = p.label;
545     }
546 
PointXYZLpcl::PointXYZL547     inline PointXYZL (std::uint32_t _label = 0): PointXYZL(0.f, 0.f, 0.f, _label) {}
548 
PointXYZLpcl::PointXYZL549     inline PointXYZL (float _x, float _y, float _z, std::uint32_t _label = 0)
550     {
551       x = _x; y = _y; z = _z;
552       data[3] = 1.0f;
553       label = _label;
554     }
555 
556     friend std::ostream& operator << (std::ostream& os, const PointXYZL& p);
557   };
558 
559 
560   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Label& p);
561   struct Label
562   {
563     std::uint32_t label = 0;
564 
Labelpcl::Label565     Label (std::uint32_t _label = 0): label(_label) {}
566 
567     friend std::ostream& operator << (std::ostream& os, const Label& p);
568   };
569 
570 
571   struct EIGEN_ALIGN16 _PointXYZRGBA
572   {
573     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
574     PCL_ADD_RGB;
575     PCL_MAKE_ALIGNED_OPERATOR_NEW
576   };
577 
578   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBA& p);
579   /** \brief A point structure representing Euclidean xyz coordinates, and the RGBA color.
580     *
581     * The RGBA information is available either as separate r, g, b, or as a
582     * packed std::uint32_t rgba value. To pack it, use:
583     *
584     * \code
585     * int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b);
586     * \endcode
587     *
588     * To unpack it use:
589     *
590     * \code
591     * int rgb = ...;
592     * std::uint8_t r = (rgb >> 16) & 0x0000ff;
593     * std::uint8_t g = (rgb >> 8)  & 0x0000ff;
594     * std::uint8_t b = (rgb)     & 0x0000ff;
595     * \endcode
596     *
597     * \ingroup common
598     */
599   struct EIGEN_ALIGN16 PointXYZRGBA : public _PointXYZRGBA
600   {
PointXYZRGBApcl::PointXYZRGBA601     inline PointXYZRGBA (const _PointXYZRGBA &p)
602     {
603       x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
604       rgba = p.rgba;
605     }
606 
PointXYZRGBApcl::PointXYZRGBA607     inline PointXYZRGBA (): PointXYZRGBA (0, 0, 0, 255) {}
608 
PointXYZRGBApcl::PointXYZRGBA609     inline PointXYZRGBA (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b, std::uint8_t _a):
610       PointXYZRGBA (0.f, 0.f, 0.f, _r, _g, _b, _a) {}
611 
PointXYZRGBApcl::PointXYZRGBA612     inline PointXYZRGBA (float _x, float _y, float _z):
613       PointXYZRGBA (_x, _y, _z, 0, 0, 0, 255) {}
614 
PointXYZRGBApcl::PointXYZRGBA615     inline PointXYZRGBA (float _x, float _y, float _z, std::uint8_t _r,
616                          std::uint8_t _g, std::uint8_t _b, std::uint8_t _a)
617     {
618       x = _x; y = _y; z = _z;
619       data[3] = 1.0f;
620       r = _r; g = _g; b = _b; a = _a;
621     }
622 
623     friend std::ostream& operator << (std::ostream& os, const PointXYZRGBA& p);
624   };
625 
626 
627   struct EIGEN_ALIGN16 _PointXYZRGB
628   {
629     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
630     PCL_ADD_RGB;
631     PCL_MAKE_ALIGNED_OPERATOR_NEW
632   };
633 
634   struct EIGEN_ALIGN16 _PointXYZRGBL
635   {
636     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
637     PCL_ADD_RGB;
638     std::uint32_t label;
639     PCL_MAKE_ALIGNED_OPERATOR_NEW
640   };
641 
642   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGB& p);
643   /** \brief A point structure representing Euclidean xyz coordinates, and the RGB color.
644     *
645     * Due to historical reasons (PCL was first developed as a ROS package), the
646     * RGB information is packed into an integer and casted to a float. This is
647     * something we wish to remove in the near future, but in the meantime, the
648     * following code snippet should help you pack and unpack RGB colors in your
649     * PointXYZRGB structure:
650     *
651     * \code
652     * // pack r/g/b into rgb
653     * std::uint8_t r = 255, g = 0, b = 0;    // Example: Red color
654     * std::uint32_t rgb = ((std::uint32_t)r << 16 | (std::uint32_t)g << 8 | (std::uint32_t)b);
655     * p.rgb = *reinterpret_cast<float*>(&rgb);
656     * \endcode
657     *
658     * To unpack the data into separate values, use:
659     *
660     * \code
661     * PointXYZRGB p;
662     * // unpack rgb into r/g/b
663     * std::uint32_t rgb = *reinterpret_cast<int*>(&p.rgb);
664     * std::uint8_t r = (rgb >> 16) & 0x0000ff;
665     * std::uint8_t g = (rgb >> 8)  & 0x0000ff;
666     * std::uint8_t b = (rgb)       & 0x0000ff;
667     * \endcode
668     *
669     *
670     * Alternatively, from 1.1.0 onwards, you can use p.r, p.g, and p.b directly.
671     *
672     * \ingroup common
673     */
674   struct EIGEN_ALIGN16 PointXYZRGB : public _PointXYZRGB
675   {
PointXYZRGBpcl::PointXYZRGB676     inline PointXYZRGB (const _PointXYZRGB &p)
677     {
678       x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
679       rgb = p.rgb;
680     }
681 
PointXYZRGBpcl::PointXYZRGB682     inline PointXYZRGB (): PointXYZRGB (0.f, 0.f, 0.f) {}
683 
PointXYZRGBpcl::PointXYZRGB684     inline PointXYZRGB (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
685       PointXYZRGB (0.f, 0.f, 0.f, _r, _g, _b) {}
686 
PointXYZRGBpcl::PointXYZRGB687     inline PointXYZRGB (float _x, float _y, float _z):
688       PointXYZRGB (_x, _y, _z, 0, 0, 0) {}
689 
PointXYZRGBpcl::PointXYZRGB690     inline PointXYZRGB (float _x, float _y, float _z,
691                          std::uint8_t _r, std::uint8_t _g, std::uint8_t _b)
692     {
693       x = _x; y = _y; z = _z;
694       data[3] = 1.0f;
695       r = _r; g = _g; b = _b;
696       a = 255;
697     }
698 
699     friend std::ostream& operator << (std::ostream& os, const PointXYZRGB& p);
700     PCL_MAKE_ALIGNED_OPERATOR_NEW
701   };
702 
703 
704   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBL& p);
705   struct EIGEN_ALIGN16 PointXYZRGBL : public _PointXYZRGBL
706   {
PointXYZRGBLpcl::PointXYZRGBL707     inline PointXYZRGBL (const _PointXYZRGBL &p)
708     {
709       x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
710       rgba = p.rgba;
711       label = p.label;
712     }
713 
PointXYZRGBLpcl::PointXYZRGBL714     inline PointXYZRGBL (std::uint32_t _label = 0):
715       PointXYZRGBL (0.f, 0.f, 0.f, 0, 0, 0, _label) {}
716 
PointXYZRGBLpcl::PointXYZRGBL717     inline PointXYZRGBL (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
718       PointXYZRGBL (0.f, 0.f, 0.f, _r, _g, _b) {}
719 
PointXYZRGBLpcl::PointXYZRGBL720     inline PointXYZRGBL (float _x, float _y, float _z):
721       PointXYZRGBL (_x, _y, _z, 0, 0, 0) {}
722 
PointXYZRGBLpcl::PointXYZRGBL723     inline PointXYZRGBL (float _x, float _y, float _z,
724                          std::uint8_t _r, std::uint8_t _g, std::uint8_t _b,
725                          std::uint32_t _label = 0)
726     {
727       x = _x; y = _y; z = _z;
728       data[3] = 1.0f;
729       r = _r; g = _g; b = _b;
730       a = 255;
731       label = _label;
732     }
733 
734     friend std::ostream& operator << (std::ostream& os, const PointXYZRGBL& p);
735     PCL_MAKE_ALIGNED_OPERATOR_NEW
736   };
737 
738 
739   struct EIGEN_ALIGN16 _PointXYZLAB
740   {
741     PCL_ADD_POINT4D; // this adds the members x,y,z
742     union
743     {
744       struct
745       {
746         float L;
747         float a;
748         float b;
749       };
750       float data_lab[4];
751     };
752     PCL_MAKE_ALIGNED_OPERATOR_NEW
753   };
754 
755   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZLAB& p);
756   /** \brief A point structure representing Euclidean xyz coordinates, and the CIELAB color.
757     * \ingroup common
758   */
759   struct PointXYZLAB : public _PointXYZLAB
760   {
PointXYZLABpcl::PointXYZLAB761     inline PointXYZLAB (const _PointXYZLAB &p)
762     {
763       x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
764       L = p.L; a = p.a; b = p.b;
765     }
766 
PointXYZLABpcl::PointXYZLAB767     inline PointXYZLAB()
768     {
769       x = y = z = 0.0f;
770       data[3] = 1.0f; // important for homogeneous coordinates
771       L = a = b = 0.0f;
772       data_lab[3] = 0.0f;
773     }
774 
775     friend std::ostream& operator << (std::ostream& os, const PointXYZLAB& p);
776     PCL_MAKE_ALIGNED_OPERATOR_NEW
777   };
778 
779 
780   struct EIGEN_ALIGN16 _PointXYZHSV
781   {
782     PCL_ADD_POINT4D;    // This adds the members x,y,z which can also be accessed using the point (which is float[4])
783     union
784     {
785       struct
786       {
787         float h;
788         float s;
789         float v;
790       };
791       float data_c[4];
792     };
793     PCL_MAKE_ALIGNED_OPERATOR_NEW
794   };
795 
796   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZHSV& p);
797   struct EIGEN_ALIGN16 PointXYZHSV : public _PointXYZHSV
798   {
PointXYZHSVpcl::PointXYZHSV799     inline PointXYZHSV (const _PointXYZHSV &p)
800     {
801       x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
802       h = p.h; s = p.s; v = p.v;
803     }
804 
PointXYZHSVpcl::PointXYZHSV805     inline PointXYZHSV (): PointXYZHSV (0.f, 0.f, 0.f) {}
806 
807     // @TODO: Use strong types??
808     // This is a dangerous type, doesn't behave like others
PointXYZHSVpcl::PointXYZHSV809     inline PointXYZHSV (float _h, float _s, float _v):
810       PointXYZHSV (0.f, 0.f, 0.f, _h, _s, _v) {}
811 
PointXYZHSVpcl::PointXYZHSV812     inline PointXYZHSV (float _x, float _y, float _z,
813                         float _h, float _s, float _v)
814     {
815       x = _x; y = _y; z = _z;
816       data[3] = 1.0f;
817       h = _h; s = _s; v = _v;
818       data_c[3] = 0;
819     }
820 
821     friend std::ostream& operator << (std::ostream& os, const PointXYZHSV& p);
822     PCL_MAKE_ALIGNED_OPERATOR_NEW
823   };
824 
825 
826 
827   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXY& p);
828   /** \brief A 2D point structure representing Euclidean xy coordinates.
829     * \ingroup common
830     */
831   struct PointXY
832   {
833     float x = 0.f;
834     float y = 0.f;
835 
836     inline PointXY() = default;
837 
PointXYpcl::PointXY838     inline PointXY(float _x, float _y): x(_x), y(_y) {}
839 
840     friend std::ostream& operator << (std::ostream& os, const PointXY& p);
841   };
842 
843   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointUV& p);
844   /** \brief A 2D point structure representing pixel image coordinates.
845     * \note We use float to be able to represent subpixels.
846     * \ingroup common
847     */
848   struct PointUV
849   {
850     float u = 0.f;
851     float v = 0.f;
852 
853     inline PointUV() = default;
854 
PointUVpcl::PointUV855     inline PointUV(float _u, float _v): u(_u), v(_v) {}
856 
857     friend std::ostream& operator << (std::ostream& os, const PointUV& p);
858   };
859 
860   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const InterestPoint& p);
861   /** \brief A point structure representing an interest point with Euclidean xyz coordinates, and an interest value.
862     * \ingroup common
863     */
864   // @TODO: inheritance trick like on other PointTypes
865   struct EIGEN_ALIGN16 InterestPoint
866   {
867     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
868     union
869     {
870       struct
871       {
872         float strength;
873       };
874       float data_c[4];
875     };
876     PCL_MAKE_ALIGNED_OPERATOR_NEW
877 
878     friend std::ostream& operator << (std::ostream& os, const InterestPoint& p);
879   };
880 
881   struct EIGEN_ALIGN16 _Normal
882   {
883     PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
884     union
885     {
886       struct
887       {
888         float curvature;
889       };
890       float data_c[4];
891     };
892     PCL_MAKE_ALIGNED_OPERATOR_NEW
893   };
894 
895   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Normal& p);
896   /** \brief A point structure representing normal coordinates and the surface curvature estimate. (SSE friendly)
897     * \ingroup common
898     */
899   struct Normal : public _Normal
900   {
Normalpcl::Normal901     inline Normal (const _Normal &p)
902     {
903       normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z;
904       data_n[3] = 0.0f;
905       curvature = p.curvature;
906     }
907 
Normalpcl::Normal908     inline Normal (float _curvature = 0.f): Normal (0.f, 0.f, 0.f, _curvature) {}
909 
Normalpcl::Normal910     inline Normal (float n_x, float n_y, float n_z, float _curvature = 0.f)
911     {
912       normal_x = n_x; normal_y = n_y; normal_z = n_z;
913       data_n[3] = 0.0f;
914       curvature = _curvature;
915     }
916 
917     friend std::ostream& operator << (std::ostream& os, const Normal& p);
918     PCL_MAKE_ALIGNED_OPERATOR_NEW
919   };
920 
921 
922   struct EIGEN_ALIGN16 _Axis
923   {
924     PCL_ADD_NORMAL4D;
925     PCL_MAKE_ALIGNED_OPERATOR_NEW
926   };
927 
928   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Axis& p);
929   /** \brief A point structure representing an Axis using its normal coordinates. (SSE friendly)
930     *  \ingroup common
931     */
932   struct EIGEN_ALIGN16 Axis : public _Axis
933   {
Axispcl::Axis934     inline Axis (const _Axis &p)
935     {
936       normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z;
937       data_n[3] = 0.0f;
938     }
939 
Axispcl::Axis940     inline Axis (): Axis (0.f, 0.f, 0.f) {}
941 
Axispcl::Axis942     inline Axis (float n_x, float n_y, float n_z)
943     {
944       normal_x = n_x; normal_y = n_y; normal_z = n_z;
945       data_n[3] = 0.0f;
946     }
947 
948     friend std::ostream& operator << (std::ostream& os, const Axis& p);
949     PCL_MAKE_ALIGNED_OPERATOR_NEW
950   };
951 
952 
953   struct EIGEN_ALIGN16 _PointNormal
954   {
955     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
956     PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
957     union
958     {
959       struct
960       {
961         float curvature;
962       };
963       float data_c[4];
964     };
965     PCL_MAKE_ALIGNED_OPERATOR_NEW
966   };
967 
968   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointNormal& p);
969   /** \brief A point structure representing Euclidean xyz coordinates, together with normal coordinates and the surface curvature estimate. (SSE friendly)
970     * \ingroup common
971     */
972   struct PointNormal : public _PointNormal
973   {
PointNormalpcl::PointNormal974     inline PointNormal (const _PointNormal &p)
975     {
976       x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
977       normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z; data_n[3] = 0.0f;
978       curvature = p.curvature;
979     }
980 
PointNormalpcl::PointNormal981     inline PointNormal (float _curvature = 0.f): PointNormal (0.f, 0.f, 0.f, 0.f, 0.f, 0.f, _curvature) {}
982 
PointNormalpcl::PointNormal983     inline PointNormal (float _x, float _y, float _z):
984       PointNormal (_x, _y, _z, 0.f, 0.f, 0.f, 0.f) {}
985 
PointNormalpcl::PointNormal986     inline PointNormal (float _x, float _y, float _z, float n_x, float n_y, float n_z, float _curvature = 0.f)
987     {
988       x = _x; y = _y; z = _z;
989       data[3] = 1.0f;
990       normal_x = n_x; normal_y = n_y; normal_z = n_z;
991       data_n[3] = 0.0f;
992       curvature = _curvature;
993     }
994 
995     friend std::ostream& operator << (std::ostream& os, const PointNormal& p);
996   };
997 
998 
999   struct EIGEN_ALIGN16 _PointXYZRGBNormal
1000   {
1001     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1002     PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
1003     union
1004     {
1005       struct
1006       {
1007         PCL_ADD_UNION_RGB;
1008         float curvature;
1009       };
1010       float data_c[4];
1011     };
1012     PCL_ADD_EIGEN_MAPS_RGB;
1013     PCL_MAKE_ALIGNED_OPERATOR_NEW
1014   };
1015 
1016   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBNormal& p);
1017   /** \brief A point structure representing Euclidean xyz coordinates, and the RGB color, together with normal coordinates and the surface curvature estimate.
1018     * Due to historical reasons (PCL was first developed as a ROS package), the
1019     * RGB information is packed into an integer and casted to a float. This is
1020     * something we wish to remove in the near future, but in the meantime, the
1021     * following code snippet should help you pack and unpack RGB colors in your
1022     * PointXYZRGB structure:
1023     *
1024     * \code
1025     * // pack r/g/b into rgb
1026     * std::uint8_t r = 255, g = 0, b = 0;    // Example: Red color
1027     * std::uint32_t rgb = ((std::uint32_t)r << 16 | (std::uint32_t)g << 8 | (std::uint32_t)b);
1028     * p.rgb = *reinterpret_cast<float*>(&rgb);
1029     * \endcode
1030     *
1031     * To unpack the data into separate values, use:
1032     *
1033     * \code
1034     * PointXYZRGB p;
1035     * // unpack rgb into r/g/b
1036     * std::uint32_t rgb = *reinterpret_cast<int*>(&p.rgb);
1037     * std::uint8_t r = (rgb >> 16) & 0x0000ff;
1038     * std::uint8_t g = (rgb >> 8)  & 0x0000ff;
1039     * std::uint8_t b = (rgb)       & 0x0000ff;
1040     * \endcode
1041     *
1042     *
1043     * Alternatively, from 1.1.0 onwards, you can use p.r, p.g, and p.b directly.
1044     * \ingroup common
1045     */
1046   struct PointXYZRGBNormal : public _PointXYZRGBNormal
1047   {
PointXYZRGBNormalpcl::PointXYZRGBNormal1048     inline PointXYZRGBNormal (const _PointXYZRGBNormal &p)
1049     {
1050       x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1051       normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z; data_n[3] = 0.0f;
1052       curvature = p.curvature;
1053       rgba = p.rgba;
1054     }
1055 
PointXYZRGBNormalpcl::PointXYZRGBNormal1056     inline PointXYZRGBNormal (float _curvature = 0.f):
1057         PointXYZRGBNormal (0.f, 0.f, 0.f, 0, 0, 0, 0.f, 0.f, 0.f, _curvature) {}
1058 
PointXYZRGBNormalpcl::PointXYZRGBNormal1059     inline PointXYZRGBNormal (float _x, float _y, float _z):
1060       PointXYZRGBNormal (_x, _y, _z, 0, 0, 0) {}
1061 
PointXYZRGBNormalpcl::PointXYZRGBNormal1062     inline PointXYZRGBNormal (std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
1063       PointXYZRGBNormal (0.f, 0.f, 0.f, _r, _g, _b) {}
1064 
PointXYZRGBNormalpcl::PointXYZRGBNormal1065     inline PointXYZRGBNormal (float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b):
1066       PointXYZRGBNormal (_x, _y, _z, _r, _g, _b, 0.f, 0.f, 0.f) {}
1067 
PointXYZRGBNormalpcl::PointXYZRGBNormal1068     inline PointXYZRGBNormal (float _x, float _y, float _z, std::uint8_t _r, std::uint8_t _g, std::uint8_t _b,
1069                               float n_x, float n_y, float n_z, float _curvature = 0.f)
1070     {
1071       x = _x; y = _y; z = _z;
1072       data[3] = 1.0f;
1073       r = _r; g = _g; b = _b;
1074       a = 255;
1075       normal_x = n_x; normal_y = n_y; normal_z = n_z;
1076       data_n[3] = 0.f;
1077       curvature = _curvature;
1078     }
1079 
1080     friend std::ostream& operator << (std::ostream& os, const PointXYZRGBNormal& p);
1081   };
1082 
1083   struct EIGEN_ALIGN16 _PointXYZINormal
1084   {
1085     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1086     PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
1087     union
1088     {
1089       struct
1090       {
1091         float intensity;
1092         float curvature;
1093       };
1094       float data_c[4];
1095     };
1096     PCL_MAKE_ALIGNED_OPERATOR_NEW
1097   };
1098 
1099   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZINormal& p);
1100   /** \brief A point structure representing Euclidean xyz coordinates, intensity, together with normal coordinates and the surface curvature estimate.
1101     * \ingroup common
1102     */
1103   struct PointXYZINormal : public _PointXYZINormal
1104   {
PointXYZINormalpcl::PointXYZINormal1105     inline PointXYZINormal (const _PointXYZINormal &p)
1106     {
1107       x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1108       normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z; data_n[3] = 0.0f;
1109       curvature = p.curvature;
1110       intensity = p.intensity;
1111     }
1112 
PointXYZINormalpcl::PointXYZINormal1113     inline PointXYZINormal (float _intensity = 0.f): PointXYZINormal (0.f, 0.f, 0.f, _intensity) {}
1114 
PointXYZINormalpcl::PointXYZINormal1115     inline PointXYZINormal (float _x, float _y, float _z, float _intensity = 0.f):
1116       PointXYZINormal (_x, _y, _z, _intensity, 0.f, 0.f, 0.f) {}
1117 
PointXYZINormalpcl::PointXYZINormal1118     inline PointXYZINormal (float _x, float _y, float _z, float _intensity,
1119                             float n_x, float n_y, float n_z, float _curvature = 0.f)
1120     {
1121       x = _x; y = _y; z = _z;
1122       data[3] = 1.0f;
1123       intensity = _intensity;
1124       normal_x = n_x; normal_y = n_y; normal_z = n_z;
1125       data_n[3] = 0.f;
1126       curvature = _curvature;
1127     }
1128 
1129     friend std::ostream& operator << (std::ostream& os, const PointXYZINormal& p);
1130   };
1131 
1132 //----
1133   struct EIGEN_ALIGN16 _PointXYZLNormal
1134   {
1135     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1136     PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
1137     union
1138     {
1139       struct
1140       {
1141         std::uint32_t label;
1142         float curvature;
1143       };
1144       float data_c[4];
1145     };
1146     PCL_MAKE_ALIGNED_OPERATOR_NEW
1147   };
1148 
1149   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZLNormal& p);
1150   /** \brief A point structure representing Euclidean xyz coordinates, a label, together with normal coordinates and the surface curvature estimate.
1151     * \ingroup common
1152     */
1153   struct PointXYZLNormal : public _PointXYZLNormal
1154   {
PointXYZLNormalpcl::PointXYZLNormal1155     inline PointXYZLNormal (const _PointXYZLNormal &p)
1156     {
1157       x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1158       normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z; data_n[3] = 0.0f;
1159       curvature = p.curvature;
1160       label = p.label;
1161     }
1162 
PointXYZLNormalpcl::PointXYZLNormal1163     inline PointXYZLNormal (std::uint32_t _label = 0): PointXYZLNormal (0.f, 0.f, 0.f, _label) {}
1164 
PointXYZLNormalpcl::PointXYZLNormal1165     inline PointXYZLNormal (float _x, float _y, float _z, std::uint32_t _label = 0.f):
1166       PointXYZLNormal (_x, _y, _z, _label, 0.f, 0.f, 0.f) {}
1167 
PointXYZLNormalpcl::PointXYZLNormal1168     inline PointXYZLNormal (float _x, float _y, float _z, std::uint32_t _label,
1169                             float n_x, float n_y, float n_z, float _curvature = 0.f)
1170     {
1171       x = _x; y = _y; z = _z;
1172       data[3] = 1.0f;
1173       label = _label;
1174       normal_x = n_x; normal_y = n_y; normal_z = n_z;
1175       data_n[3] = 0.f;
1176       curvature = _curvature;
1177     }
1178 
1179     friend std::ostream& operator << (std::ostream& os, const PointXYZLNormal& p);
1180   };
1181 
1182 //  ---
1183 
1184 
1185   struct EIGEN_ALIGN16 _PointWithRange
1186   {
1187     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1188     union
1189     {
1190       struct
1191       {
1192         float range;
1193       };
1194       float data_c[4];
1195     };
1196     PCL_MAKE_ALIGNED_OPERATOR_NEW
1197   };
1198 
1199   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithRange& p);
1200   /** \brief A point structure representing Euclidean xyz coordinates, padded with an extra range float.
1201     * \ingroup common
1202     */
1203   struct PointWithRange : public _PointWithRange
1204   {
PointWithRangepcl::PointWithRange1205     inline PointWithRange (const _PointWithRange &p)
1206     {
1207       x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1208       range = p.range;
1209     }
1210 
PointWithRangepcl::PointWithRange1211     inline PointWithRange (float _range = 0.f): PointWithRange (0.f, 0.f, 0.f, _range) {}
1212 
PointWithRangepcl::PointWithRange1213     inline PointWithRange (float _x, float _y, float _z, float _range = 0.f)
1214     {
1215       x = _x; y = _y; z = _z;
1216       data[3] = 1.0f;
1217       range = _range;
1218     }
1219 
1220     friend std::ostream& operator << (std::ostream& os, const PointWithRange& p);
1221   };
1222 
1223 
1224   struct EIGEN_ALIGN16 _PointWithViewpoint
1225   {
1226     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1227     union
1228     {
1229       struct
1230       {
1231         float vp_x;
1232         float vp_y;
1233         float vp_z;
1234       };
1235       float data_c[4];
1236     };
1237     PCL_MAKE_ALIGNED_OPERATOR_NEW
1238   };
1239 
1240   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithViewpoint& p);
1241   /** \brief A point structure representing Euclidean xyz coordinates together with the viewpoint from which it was seen.
1242     * \ingroup common
1243     */
1244   struct EIGEN_ALIGN16 PointWithViewpoint : public _PointWithViewpoint
1245   {
PointWithViewpointpcl::PointWithViewpoint1246     inline PointWithViewpoint (const _PointWithViewpoint &p)
1247     {
1248       x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1249       vp_x = p.vp_x; vp_y = p.vp_y; vp_z = p.vp_z;
1250     }
1251 
PointWithViewpointpcl::PointWithViewpoint1252     inline PointWithViewpoint (): PointWithViewpoint (0.f, 0.f, 0.f) {}
1253 
PointWithViewpointpcl::PointWithViewpoint1254     inline PointWithViewpoint (float _x, float _y, float _z): PointWithViewpoint (_x, _y, _z, 0.f, 0.f, 0.f) {}
1255 
PointWithViewpointpcl::PointWithViewpoint1256     inline PointWithViewpoint (float _x, float _y, float _z, float _vp_x, float _vp_y, float _vp_z)
1257     {
1258       x = _x; y = _y; z = _z;
1259       data[3] = 1.0f;
1260       vp_x = _vp_x; vp_y = _vp_y; vp_z = _vp_z;
1261     }
1262 
1263     friend std::ostream& operator << (std::ostream& os, const PointWithViewpoint& p);
1264   };
1265 
1266   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const MomentInvariants& p);
1267   /** \brief A point structure representing the three moment invariants.
1268     * \ingroup common
1269     */
1270   struct MomentInvariants
1271   {
1272     float j1 = 0.f, j2 = 0.f, j3 = 0.f;
1273 
1274     inline MomentInvariants () = default;
1275 
MomentInvariantspcl::MomentInvariants1276     inline MomentInvariants (float _j1, float _j2, float _j3): j1 (_j1), j2 (_j2), j3 (_j3) {}
1277 
1278     friend std::ostream& operator << (std::ostream& os, const MomentInvariants& p);
1279   };
1280 
1281   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PrincipalRadiiRSD& p);
1282   /** \brief A point structure representing the minimum and maximum surface radii (in meters) computed using RSD.
1283     * \ingroup common
1284     */
1285   struct PrincipalRadiiRSD
1286   {
1287     float r_min = 0.f, r_max = 0.f;
1288 
1289     inline PrincipalRadiiRSD () = default;
1290 
PrincipalRadiiRSDpcl::PrincipalRadiiRSD1291     inline PrincipalRadiiRSD (float _r_min, float _r_max): r_min (_r_min), r_max (_r_max) {}
1292 
1293     friend std::ostream& operator << (std::ostream& os, const PrincipalRadiiRSD& p);
1294   };
1295 
1296   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Boundary& p);
1297   /** \brief A point structure representing a description of whether a point is lying on a surface boundary or not.
1298     * \ingroup common
1299     */
1300   struct Boundary
1301   {
1302     std::uint8_t boundary_point = 0;
1303 
1304 #if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 1101
operator unsigned charpcl::Boundary1305     operator unsigned char() const
1306     {
1307       return boundary_point;
1308     }
1309 #endif
1310 
Boundarypcl::Boundary1311     inline Boundary (std::uint8_t _boundary = 0): boundary_point (_boundary) {}
1312 
1313     friend std::ostream& operator << (std::ostream& os, const Boundary& p);
1314   };
1315 
1316   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PrincipalCurvatures& p);
1317   /** \brief A point structure representing the principal curvatures and their magnitudes.
1318     * \ingroup common
1319     */
1320   struct PrincipalCurvatures
1321   {
1322     union
1323     {
1324       float principal_curvature[3];
1325       struct
1326       {
1327         float principal_curvature_x;
1328         float principal_curvature_y;
1329         float principal_curvature_z;
1330       };
1331     };
1332     float pc1 = 0.f;
1333     float pc2 = 0.f;
1334 
PrincipalCurvaturespcl::PrincipalCurvatures1335     inline PrincipalCurvatures (): PrincipalCurvatures (0.f, 0.f) {}
1336 
PrincipalCurvaturespcl::PrincipalCurvatures1337     inline PrincipalCurvatures (float _pc1, float _pc2): PrincipalCurvatures (0.f, 0.f, 0.f, _pc1, _pc2) {}
1338 
PrincipalCurvaturespcl::PrincipalCurvatures1339     inline PrincipalCurvatures (float _x, float _y, float _z): PrincipalCurvatures (_x, _y, _z, 0.f, 0.f) {}
1340 
PrincipalCurvaturespcl::PrincipalCurvatures1341     inline PrincipalCurvatures (float _x, float _y, float _z, float _pc1, float _pc2):
1342       principal_curvature_x (_x), principal_curvature_y (_y), principal_curvature_z (_z), pc1 (_pc1), pc2 (_pc2) {}
1343 
1344     friend std::ostream& operator << (std::ostream& os, const PrincipalCurvatures& p);
1345   };
1346 
1347   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PFHSignature125& p);
1348   /** \brief A point structure representing the Point Feature Histogram (PFH).
1349     * \ingroup common
1350     */
1351   struct PFHSignature125
1352   {
1353     float histogram[125] = {0.f};
descriptorSizepcl::PFHSignature1251354     static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<PFHSignature125>; }
1355 
1356     inline PFHSignature125 () = default;
1357 
1358     friend std::ostream& operator << (std::ostream& os, const PFHSignature125& p);
1359   };
1360 
1361 
1362   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PFHRGBSignature250& p);
1363   /** \brief A point structure representing the Point Feature Histogram with colors (PFHRGB).
1364     * \ingroup common
1365     */
1366   struct PFHRGBSignature250
1367   {
1368     float histogram[250] = {0.f};
descriptorSizepcl::PFHRGBSignature2501369     static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<PFHRGBSignature250>; }
1370 
1371     inline PFHRGBSignature250 () = default;
1372 
1373     friend std::ostream& operator << (std::ostream& os, const PFHRGBSignature250& p);
1374   };
1375 
1376   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PPFSignature& p);
1377   /** \brief A point structure for storing the Point Pair Feature (PPF) values
1378     * \ingroup common
1379     */
1380   struct PPFSignature
1381   {
1382     float f1 = 0.f, f2 = 0.f, f3 = 0.f, f4 = 0.f;
1383     float alpha_m = 0.f;
1384 
PPFSignaturepcl::PPFSignature1385     inline PPFSignature (float _alpha = 0.f): PPFSignature (0.f, 0.f, 0.f, 0.f, _alpha) {}
1386 
PPFSignaturepcl::PPFSignature1387     inline PPFSignature (float _f1, float _f2, float _f3, float _f4, float _alpha = 0.f):
1388       f1 (_f1), f2 (_f2), f3 (_f3), f4 (_f4), alpha_m (_alpha) {}
1389 
1390     friend std::ostream& operator << (std::ostream& os, const PPFSignature& p);
1391   };
1392 
1393   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const CPPFSignature& p);
1394   /** \brief A point structure for storing the Point Pair Feature (CPPF) values
1395     * \ingroup common
1396     */
1397   struct CPPFSignature
1398   {
1399     float f1, f2, f3, f4, f5, f6, f7, f8, f9, f10;
1400     float alpha_m;
1401 
CPPFSignaturepcl::CPPFSignature1402     inline CPPFSignature (float _alpha = 0.f):
1403       CPPFSignature (0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, _alpha) {}
1404 
CPPFSignaturepcl::CPPFSignature1405     inline CPPFSignature (float _f1, float _f2, float _f3, float _f4, float _f5, float _f6,
1406                           float _f7, float _f8, float _f9, float _f10, float _alpha = 0.f):
1407       f1 (_f1), f2 (_f2), f3 (_f3), f4 (_f4), f5 (_f5), f6 (_f6),
1408       f7 (_f7), f8 (_f8), f9 (_f9), f10 (_f10), alpha_m (_alpha) {}
1409 
1410     friend std::ostream& operator << (std::ostream& os, const CPPFSignature& p);
1411   };
1412 
1413   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PPFRGBSignature& p);
1414   /** \brief A point structure for storing the Point Pair Color Feature (PPFRGB) values
1415     * \ingroup common
1416     */
1417   struct PPFRGBSignature
1418   {
1419     float f1 = 0.f, f2 = 0.f, f3 = 0.f, f4 = 0.f;
1420     float r_ratio = 0.f, g_ratio = 0.f, b_ratio = 0.f;
1421     float alpha_m = 0.f;
1422 
PPFRGBSignaturepcl::PPFRGBSignature1423     inline PPFRGBSignature (float _alpha = 0.f): PPFRGBSignature (0.f, 0.f, 0.f, 0.f, _alpha) {}
1424 
PPFRGBSignaturepcl::PPFRGBSignature1425     inline PPFRGBSignature (float _f1, float _f2, float _f3, float _f4, float _alpha = 0.f):
1426       PPFRGBSignature (_f1, _f2, _f3, _f4, _alpha, 0.f, 0.f, 0.f) {}
1427 
PPFRGBSignaturepcl::PPFRGBSignature1428     inline PPFRGBSignature (float _f1, float _f2, float _f3, float _f4, float _alpha, float _r, float _g, float _b):
1429       f1 (_f1), f2 (_f2), f3 (_f3), f4 (_f4), r_ratio (_r), g_ratio (_g), b_ratio (_b), alpha_m (_alpha) {}
1430 
1431     friend std::ostream& operator << (std::ostream& os, const PPFRGBSignature& p);
1432   };
1433 
1434   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const NormalBasedSignature12& p);
1435   /** \brief A point structure representing the Normal Based Signature for
1436     * a feature matrix of 4-by-3
1437     * \ingroup common
1438     */
1439   struct NormalBasedSignature12
1440   {
1441     float values[12] = {0.f};
1442 
1443     inline NormalBasedSignature12 () = default;
1444 
1445     friend std::ostream& operator << (std::ostream& os, const NormalBasedSignature12& p);
1446   };
1447 
1448   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const ShapeContext1980& p);
1449   /** \brief A point structure representing a Shape Context.
1450     * \ingroup common
1451     */
1452   struct ShapeContext1980
1453   {
1454     float descriptor[1980] = {0.f};
1455     float rf[9] = {0.f};
descriptorSizepcl::ShapeContext19801456     static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<ShapeContext1980>; }
1457 
1458     inline ShapeContext1980 () = default;
1459 
1460     friend std::ostream& operator << (std::ostream& os, const ShapeContext1980& p);
1461   };
1462 
1463   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const UniqueShapeContext1960& p);
1464   /** \brief A point structure representing a Unique Shape Context.
1465     * \ingroup common
1466     */
1467   struct UniqueShapeContext1960
1468   {
1469     float descriptor[1960] = {0.f};
1470     float rf[9] = {0.f};
descriptorSizepcl::UniqueShapeContext19601471     static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<UniqueShapeContext1960>; }
1472 
1473     inline UniqueShapeContext1960 () = default;
1474 
1475     friend std::ostream& operator << (std::ostream& os, const UniqueShapeContext1960& p);
1476   };
1477 
1478   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const SHOT352& p);
1479   /** \brief A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape only.
1480     * \ingroup common
1481     */
1482   struct SHOT352
1483   {
1484     float descriptor[352] = {0.f};
1485     float rf[9] = {0.f};
descriptorSizepcl::SHOT3521486     static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<SHOT352>; }
1487 
1488     inline SHOT352 () = default;
1489 
1490     friend std::ostream& operator << (std::ostream& os, const SHOT352& p);
1491   };
1492 
1493 
1494   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const SHOT1344& p);
1495   /** \brief A point structure representing the generic Signature of Histograms of OrienTations (SHOT) - shape+color.
1496     * \ingroup common
1497     */
1498   struct SHOT1344
1499   {
1500     float descriptor[1344] = {0.f};
1501     float rf[9] = {0.f};
descriptorSizepcl::SHOT13441502     static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<SHOT1344>; }
1503 
1504     inline SHOT1344 () = default;
1505 
1506     friend std::ostream& operator << (std::ostream& os, const SHOT1344& p);
1507   };
1508 
1509 
1510   /** \brief A structure representing the Local Reference Frame of a point.
1511     *  \ingroup common
1512     */
1513   struct EIGEN_ALIGN16 _ReferenceFrame
1514   {
1515     union
1516     {
1517       float rf[9];
1518       struct
1519       {
1520         float x_axis[3];
1521         float y_axis[3];
1522         float z_axis[3];
1523       };
1524     };
1525 
getXAxisVector3fMappcl::_ReferenceFrame1526     inline Eigen::Map<Eigen::Vector3f> getXAxisVector3fMap () { return (Eigen::Vector3f::Map (x_axis)); }
getXAxisVector3fMappcl::_ReferenceFrame1527     inline const Eigen::Map<const Eigen::Vector3f> getXAxisVector3fMap () const { return (Eigen::Vector3f::Map (x_axis)); }
getYAxisVector3fMappcl::_ReferenceFrame1528     inline Eigen::Map<Eigen::Vector3f> getYAxisVector3fMap () { return (Eigen::Vector3f::Map (y_axis)); }
getYAxisVector3fMappcl::_ReferenceFrame1529     inline const Eigen::Map<const Eigen::Vector3f> getYAxisVector3fMap () const { return (Eigen::Vector3f::Map (y_axis)); }
getZAxisVector3fMappcl::_ReferenceFrame1530     inline Eigen::Map<Eigen::Vector3f> getZAxisVector3fMap () { return (Eigen::Vector3f::Map (z_axis)); }
getZAxisVector3fMappcl::_ReferenceFrame1531     inline const Eigen::Map<const Eigen::Vector3f> getZAxisVector3fMap () const { return (Eigen::Vector3f::Map (z_axis)); }
getMatrix3fMappcl::_ReferenceFrame1532     inline Eigen::Map<Eigen::Matrix3f> getMatrix3fMap () { return (Eigen::Matrix3f::Map (rf)); }
getMatrix3fMappcl::_ReferenceFrame1533     inline const Eigen::Map<const Eigen::Matrix3f> getMatrix3fMap () const { return (Eigen::Matrix3f::Map (rf)); }
1534 
1535     PCL_MAKE_ALIGNED_OPERATOR_NEW
1536   };
1537 
1538   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const ReferenceFrame& p);
1539   struct EIGEN_ALIGN16 ReferenceFrame : public _ReferenceFrame
1540   {
ReferenceFramepcl::ReferenceFrame1541     inline ReferenceFrame (const _ReferenceFrame &p)
1542     {
1543       std::copy_n(p.rf, 9, rf);
1544     }
1545 
ReferenceFramepcl::ReferenceFrame1546     inline ReferenceFrame ()
1547     {
1548       std::fill_n(x_axis, 3, 0.f);
1549       std::fill_n(y_axis, 3, 0.f);
1550       std::fill_n(z_axis, 3, 0.f);
1551     }
1552 
1553     // @TODO: add other ctors
1554 
1555     friend std::ostream& operator << (std::ostream& os, const ReferenceFrame& p);
1556     PCL_MAKE_ALIGNED_OPERATOR_NEW
1557   };
1558 
1559 
1560   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const FPFHSignature33& p);
1561   /** \brief A point structure representing the Fast Point Feature Histogram (FPFH).
1562     * \ingroup common
1563     */
1564   struct FPFHSignature33
1565   {
1566     float histogram[33] = {0.f};
descriptorSizepcl::FPFHSignature331567     static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<FPFHSignature33>; }
1568 
1569     inline FPFHSignature33 () = default;
1570 
1571     friend std::ostream& operator << (std::ostream& os, const FPFHSignature33& p);
1572   };
1573 
1574   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const VFHSignature308& p);
1575   /** \brief A point structure representing the Viewpoint Feature Histogram (VFH).
1576     * \ingroup common
1577     */
1578   struct VFHSignature308
1579   {
1580     float histogram[308] = {0.f};
descriptorSizepcl::VFHSignature3081581     static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<VFHSignature308>; }
1582 
1583     inline VFHSignature308 () = default;
1584 
1585     friend std::ostream& operator << (std::ostream& os, const VFHSignature308& p);
1586   };
1587 
1588   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GRSDSignature21& p);
1589   /** \brief A point structure representing the Global Radius-based Surface Descriptor (GRSD).
1590     * \ingroup common
1591     */
1592   struct GRSDSignature21
1593   {
1594     float histogram[21] = {0.f};
descriptorSizepcl::GRSDSignature211595     static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<GRSDSignature21>; }
1596 
1597     inline GRSDSignature21 () = default;
1598 
1599     friend std::ostream& operator << (std::ostream& os, const GRSDSignature21& p);
1600   };
1601 
1602   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const BRISKSignature512& p);
1603   /** \brief A point structure representing the Binary Robust Invariant Scalable Keypoints (BRISK).
1604     * \ingroup common
1605     */
1606   struct BRISKSignature512
1607   {
1608     float scale = 0.f;
1609     float orientation = 0.f;
1610     unsigned char descriptor[64] = {0};
descriptorSizepcl::BRISKSignature5121611     static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<BRISKSignature512>; }
1612 
1613     inline BRISKSignature512 () = default;
1614 
BRISKSignature512pcl::BRISKSignature5121615     inline BRISKSignature512 (float _scale, float _orientation): scale (_scale), orientation (_orientation) {}
1616 
1617     friend std::ostream& operator << (std::ostream& os, const BRISKSignature512& p);
1618   };
1619 
1620   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const ESFSignature640& p);
1621   /** \brief A point structure representing the Ensemble of Shape Functions (ESF).
1622     * \ingroup common
1623     */
1624   struct ESFSignature640
1625   {
1626     float histogram[640] = {0.f};
descriptorSizepcl::ESFSignature6401627     static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<ESFSignature640>; }
1628 
1629     inline ESFSignature640 () = default;
1630 
1631     friend std::ostream& operator << (std::ostream& os, const ESFSignature640& p);
1632   };
1633 
1634   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GASDSignature512& p);
1635   /** \brief A point structure representing the Globally Aligned Spatial Distribution (GASD) shape descriptor.
1636   * \ingroup common
1637   */
1638   struct GASDSignature512
1639   {
1640     float histogram[512] = {0.f};
descriptorSizepcl::GASDSignature5121641     static constexpr int descriptorSize() { return detail::traits::descriptorSize_v<GASDSignature512>; }
1642 
1643     inline GASDSignature512 () = default;
1644 
1645     friend std::ostream& operator << (std::ostream& os, const GASDSignature512& p);
1646   };
1647 
1648   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GASDSignature984& p);
1649   /** \brief A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descriptor.
1650   * \ingroup common
1651   */
1652   struct GASDSignature984
1653   {
1654     float histogram[984] = {0.f};
descriptorSizepcl::GASDSignature9841655     static constexpr int descriptorSize() { return detail::traits::descriptorSize_v<GASDSignature984>; }
1656 
1657     inline GASDSignature984 () = default;
1658 
1659     friend std::ostream& operator << (std::ostream& os, const GASDSignature984& p);
1660   };
1661 
1662   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GASDSignature7992& p);
1663   /** \brief A point structure representing the Globally Aligned Spatial Distribution (GASD) shape and color descriptor.
1664   * \ingroup common
1665   */
1666   struct GASDSignature7992
1667   {
1668     float histogram[7992] = {0.f};
descriptorSizepcl::GASDSignature79921669     static constexpr int descriptorSize() { return detail::traits::descriptorSize_v<GASDSignature7992>; }
1670 
1671     inline GASDSignature7992 () = default;
1672 
1673     friend std::ostream& operator << (std::ostream& os, const GASDSignature7992& p);
1674   };
1675 
1676   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const GFPFHSignature16& p);
1677   /** \brief A point structure representing the GFPFH descriptor with 16 bins.
1678     * \ingroup common
1679     */
1680   struct GFPFHSignature16
1681   {
1682     float histogram[16] = {0.f};
descriptorSizepcl::GFPFHSignature161683     static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<GFPFHSignature16>; }
1684 
1685     inline GFPFHSignature16 () = default;
1686 
1687     friend std::ostream& operator << (std::ostream& os, const GFPFHSignature16& p);
1688   };
1689 
1690   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Narf36& p);
1691   /** \brief A point structure representing the Narf descriptor.
1692     * \ingroup common
1693     */
1694   struct Narf36
1695   {
1696     float x = 0.f, y = 0.f, z = 0.f, roll = 0.f, pitch = 0.f, yaw = 0.f;
1697     float descriptor[36] = {0.f};
descriptorSizepcl::Narf361698     static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<Narf36>; }
1699 
1700     inline Narf36 () = default;
1701 
Narf36pcl::Narf361702     inline Narf36 (float _x, float _y, float _z): Narf36 (_x, _y, _z, 0.f, 0.f, 0.f) {}
1703 
Narf36pcl::Narf361704     inline Narf36 (float _x, float _y, float _z, float _roll, float _pitch, float _yaw):
1705       x (_x), y (_y), z (_z), roll (_roll), pitch (_pitch), yaw (_yaw) {}
1706 
1707     friend std::ostream& operator << (std::ostream& os, const Narf36& p);
1708   };
1709 
1710   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const BorderDescription& p);
1711   /** \brief A structure to store if a point in a range image lies on a border between an obstacle and the background.
1712     * \ingroup common
1713     */
1714   struct BorderDescription
1715   {
1716     int x = 0, y = 0;
1717     BorderTraits traits;
1718     //std::vector<const BorderDescription*> neighbors;
1719 
1720     inline BorderDescription () = default;
1721 
1722     // TODO: provide other ctors
1723 
1724     friend std::ostream& operator << (std::ostream& os, const BorderDescription& p);
1725   };
1726 
1727 
1728   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const IntensityGradient& p);
1729   /** \brief A point structure representing the intensity gradient of an XYZI point cloud.
1730     * \ingroup common
1731     */
1732   struct IntensityGradient
1733   {
1734     union
1735     {
1736       float gradient[3];
1737       struct
1738       {
1739         float gradient_x;
1740         float gradient_y;
1741         float gradient_z;
1742       };
1743     };
1744 
IntensityGradientpcl::IntensityGradient1745     inline IntensityGradient (): IntensityGradient (0.f, 0.f, 0.f) {}
1746 
IntensityGradientpcl::IntensityGradient1747     inline IntensityGradient (float _x, float _y, float _z): gradient_x (_x), gradient_y (_y), gradient_z (_z) {}
1748 
1749     friend std::ostream& operator << (std::ostream& os, const IntensityGradient& p);
1750   };
1751 
1752   // TODO: Maybe make other histogram based structs an alias for this
1753   /** \brief A point structure representing an N-D histogram.
1754     * \ingroup common
1755     */
1756   template <int N>
1757   struct Histogram
1758   {
1759     float histogram[N];
descriptorSizepcl::Histogram1760     static constexpr int descriptorSize () { return detail::traits::descriptorSize_v<Histogram<N>>; }
1761   };
1762 
1763   struct EIGEN_ALIGN16 _PointWithScale
1764   {
1765     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1766 
1767     union
1768     {
1769       /** \brief Diameter of the meaningful keypoint neighborhood. */
1770       float scale;
1771       float size;
1772     };
1773 
1774     /** \brief Computed orientation of the keypoint (-1 if not applicable). */
1775     float angle;
1776     /** \brief The response by which the most strong keypoints have been selected. */
1777     float response;
1778     /** \brief octave (pyramid layer) from which the keypoint has been extracted. */
1779     int   octave;
1780 
1781     PCL_MAKE_ALIGNED_OPERATOR_NEW
1782   };
1783 
1784   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointWithScale& p);
1785   /** \brief A point structure representing a 3-D position and scale.
1786     * \ingroup common
1787     */
1788   struct PointWithScale : public _PointWithScale
1789   {
PointWithScalepcl::PointWithScale1790     inline PointWithScale (const _PointWithScale &p)
1791     {
1792       x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1793       scale = p.scale;
1794       angle = p.angle;
1795       response = p.response;
1796       octave = p.octave;
1797     }
1798 
PointWithScalepcl::PointWithScale1799     inline PointWithScale (): PointWithScale (0.f, 0.f, 0.f) {}
1800 
PointWithScalepcl::PointWithScale1801     inline PointWithScale (float _x, float _y, float _z, float _scale = 1.f,
1802                            float _angle = -1.f, float _response = 0.f, int _octave = 0)
1803     {
1804       x = _x; y = _y; z = _z;
1805       data[3] = 1.0f;
1806       scale = _scale;
1807       angle = _angle;
1808       response = _response;
1809       octave = _octave;
1810     }
1811 
1812     friend std::ostream& operator << (std::ostream& os, const PointWithScale& p);
1813   };
1814 
1815 
1816   struct EIGEN_ALIGN16 _PointSurfel
1817   {
1818     PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1819     PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
1820     union
1821     {
1822       struct
1823       {
1824         PCL_ADD_UNION_RGB;
1825         float radius;
1826         float confidence;
1827         float curvature;
1828       };
1829       float data_c[4];
1830     };
1831     PCL_ADD_EIGEN_MAPS_RGB;
1832     PCL_MAKE_ALIGNED_OPERATOR_NEW
1833   };
1834 
1835   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointSurfel& p);
1836   /** \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.
1837     * \ingroup common
1838     */
1839   struct PointSurfel : public _PointSurfel
1840   {
PointSurfelpcl::PointSurfel1841     inline PointSurfel (const _PointSurfel &p)
1842     {
1843       x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1844       rgba = p.rgba;
1845       radius = p.radius;
1846       confidence = p.confidence;
1847       curvature = p.curvature;
1848     }
1849 
PointSurfelpcl::PointSurfel1850     inline PointSurfel ()
1851     {
1852       x = y = z = 0.0f;
1853       data[3] = 1.0f;
1854       normal_x = normal_y = normal_z = data_n[3] = 0.0f;
1855       r = g = b = 0;
1856       a = 255;
1857       radius = confidence = curvature = 0.0f;
1858     }
1859 
1860     // TODO: add other ctor to PointSurfel
1861 
1862     friend std::ostream& operator << (std::ostream& os, const PointSurfel& p);
1863   };
1864 
1865   struct EIGEN_ALIGN16 _PointDEM
1866   {
1867     PCL_ADD_POINT4D;
1868     float intensity;
1869     float intensity_variance;
1870     float height_variance;
1871     PCL_MAKE_ALIGNED_OPERATOR_NEW
1872   };
1873 
1874   PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointDEM& p);
1875   /** \brief A point structure representing Digital Elevation Map.
1876     * \ingroup common
1877     */
1878   struct PointDEM : public _PointDEM
1879   {
PointDEMpcl::PointDEM1880     inline PointDEM (const _PointDEM &p)
1881     {
1882       x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
1883       intensity = p.intensity;
1884       intensity_variance = p.intensity_variance;
1885       height_variance = p.height_variance;
1886     }
1887 
PointDEMpcl::PointDEM1888     inline PointDEM (): PointDEM (0.f, 0.f, 0.f) {}
1889 
PointDEMpcl::PointDEM1890     inline PointDEM (float _x, float _y, float _z): PointDEM (_x, _y, _z, 0.f, 0.f, 0.f) {}
1891 
PointDEMpcl::PointDEM1892     inline PointDEM (float _x, float _y, float _z, float _intensity,
1893                      float _intensity_variance, float _height_variance)
1894     {
1895       x = _x; y = _y; z = _z;
1896       data[3] = 1.0f;
1897       intensity = _intensity;
1898       intensity_variance = _intensity_variance;
1899       height_variance = _height_variance;
1900     }
1901 
1902     friend std::ostream& operator << (std::ostream& os, const PointDEM& p);
1903   };
1904 
1905   template <int N> std::ostream&
operator <<(std::ostream & os,const Histogram<N> & p)1906   operator << (std::ostream& os, const Histogram<N>& p)
1907   {
1908     // make constexpr
1909     PCL_IF_CONSTEXPR(N > 0)
1910     {
1911         os << "(" << p.histogram[0];
1912         std::for_each(p.histogram + 1, std::end(p.histogram),
1913             [&os](const auto& hist) { os << ", " << hist; });
1914         os << ")";
1915     }
1916     return (os);
1917   }
1918 } // namespace pcl
1919 
1920 // Register point structs and wrappers
1921 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_RGB,
1922     (std::uint32_t, rgba, rgba)
1923 )
1924 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::RGB, pcl::_RGB)
1925 
1926 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Intensity,
1927     (float, intensity, intensity)
1928 )
1929 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity, pcl::_Intensity)
1930 
1931 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Intensity8u,
1932     (std::uint8_t, intensity, intensity)
1933 )
1934 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity8u, pcl::_Intensity8u)
1935 
1936 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Intensity32u,
1937     (std::uint32_t, intensity, intensity)
1938 )
1939 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Intensity32u, pcl::_Intensity32u)
1940 
1941 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZ,
1942     (float, x, x)
1943     (float, y, y)
1944     (float, z, z)
1945 )
1946 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZ, pcl::_PointXYZ)
1947 
1948 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBA,
1949     (float, x, x)
1950     (float, y, y)
1951     (float, z, z)
1952     (std::uint32_t, rgba, rgba)
1953 )
1954 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBA, pcl::_PointXYZRGBA)
1955 
1956 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGB,
1957     (float, x, x)
1958     (float, y, y)
1959     (float, z, z)
1960     (float, rgb, rgb)
1961 )
1962 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGB, pcl::_PointXYZRGB)
1963 
1964 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBL,
1965     (float, x, x)
1966     (float, y, y)
1967     (float, z, z)
1968     (std::uint32_t, rgba, rgba)
1969     (std::uint32_t, label, label)
1970 )
1971 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBL, pcl::_PointXYZRGBL)
1972 
1973 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZLAB,
1974     (float, x, x)
1975     (float, y, y)
1976     (float, z, z)
1977     (float, L, L)
1978     (float, a, a)
1979     (float, b, b)
1980 )
1981 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZLAB, pcl::_PointXYZLAB)
1982 
1983 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZHSV,
1984     (float, x, x)
1985     (float, y, y)
1986     (float, z, z)
1987     (float, h, h)
1988     (float, s, s)
1989     (float, v, v)
1990 )
1991 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZHSV, pcl::_PointXYZHSV)
1992 
1993 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXY,
1994     (float, x, x)
1995     (float, y, y)
1996 )
1997 
1998 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointUV,
1999     (float, u, u)
2000     (float, v, v)
2001 )
2002 
2003 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::InterestPoint,
2004     (float, x, x)
2005     (float, y, y)
2006     (float, z, z)
2007     (float, strength, strength)
2008 )
2009 
2010 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZI,
2011     (float, x, x)
2012     (float, y, y)
2013     (float, z, z)
2014     (float, intensity, intensity)
2015 )
2016 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZI, pcl::_PointXYZI)
2017 
2018 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZL,
2019     (float, x, x)
2020     (float, y, y)
2021     (float, z, z)
2022     (std::uint32_t, label, label)
2023 )
2024 
2025 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Label,
2026     (std::uint32_t, label, label)
2027 )
2028 
2029 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Normal,
2030     (float, normal_x, normal_x)
2031     (float, normal_y, normal_y)
2032     (float, normal_z, normal_z)
2033     (float, curvature, curvature)
2034 )
2035 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Normal, pcl::_Normal)
2036 
2037 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_Axis,
2038     (float, normal_x, normal_x)
2039     (float, normal_y, normal_y)
2040     (float, normal_z, normal_z)
2041 )
2042 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::Axis, pcl::_Axis)
2043 
2044 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointNormal,
2045     (float, x, x)
2046     (float, y, y)
2047     (float, z, z)
2048     (float, normal_x, normal_x)
2049     (float, normal_y, normal_y)
2050     (float, normal_z, normal_z)
2051     (float, curvature, curvature)
2052 )
2053 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointXYZRGBNormal,
2054     (float, x, x)
2055     (float, y, y)
2056     (float, z, z)
2057     (float, rgb, rgb)
2058     (float, normal_x, normal_x)
2059     (float, normal_y, normal_y)
2060     (float, normal_z, normal_z)
2061     (float, curvature, curvature)
2062 )
2063 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointXYZRGBNormal, pcl::_PointXYZRGBNormal)
2064 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZINormal,
2065     (float, x, x)
2066     (float, y, y)
2067     (float, z, z)
2068     (float, intensity, intensity)
2069     (float, normal_x, normal_x)
2070     (float, normal_y, normal_y)
2071     (float, normal_z, normal_z)
2072     (float, curvature, curvature)
2073 )
2074 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointXYZLNormal,
2075     (float, x, x)
2076     (float, y, y)
2077     (float, z, z)
2078     (std::uint32_t, label, label)
2079     (float, normal_x, normal_x)
2080     (float, normal_y, normal_y)
2081     (float, normal_z, normal_z)
2082     (float, curvature, curvature)
2083 )
2084 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithRange,
2085     (float, x, x)
2086     (float, y, y)
2087     (float, z, z)
2088     (float, range, range)
2089 )
2090 
2091 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointWithViewpoint,
2092     (float, x, x)
2093     (float, y, y)
2094     (float, z, z)
2095     (float, vp_x, vp_x)
2096     (float, vp_y, vp_y)
2097     (float, vp_z, vp_z)
2098 )
2099 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointWithViewpoint, pcl::_PointWithViewpoint)
2100 
2101 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::MomentInvariants,
2102     (float, j1, j1)
2103     (float, j2, j2)
2104     (float, j3, j3)
2105 )
2106 
2107 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PrincipalRadiiRSD,
2108     (float, r_min, r_min)
2109     (float, r_max, r_max)
2110 )
2111 
2112 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Boundary,
2113     (std::uint8_t, boundary_point, boundary_point)
2114 )
2115 
2116 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PrincipalCurvatures,
2117     (float, principal_curvature_x, principal_curvature_x)
2118     (float, principal_curvature_y, principal_curvature_y)
2119     (float, principal_curvature_z, principal_curvature_z)
2120     (float, pc1, pc1)
2121     (float, pc2, pc2)
2122 )
2123 
2124 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PFHSignature125,
2125     (float[125], histogram, pfh)
2126 )
2127 
2128 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PFHRGBSignature250,
2129     (float[250], histogram, pfhrgb)
2130 )
2131 
2132 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFSignature,
2133     (float, f1, f1)
2134     (float, f2, f2)
2135     (float, f3, f3)
2136     (float, f4, f4)
2137     (float, alpha_m, alpha_m)
2138 )
2139 
2140 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::CPPFSignature,
2141     (float, f1, f1)
2142     (float, f2, f2)
2143     (float, f3, f3)
2144     (float, f4, f4)
2145     (float, f5, f5)
2146     (float, f6, f6)
2147     (float, f7, f7)
2148     (float, f8, f8)
2149     (float, f9, f9)
2150     (float, f10, f10)
2151     (float, alpha_m, alpha_m)
2152 )
2153 
2154 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PPFRGBSignature,
2155     (float, f1, f1)
2156     (float, f2, f2)
2157     (float, f3, f3)
2158     (float, f4, f4)
2159     (float, r_ratio, r_ratio)
2160     (float, g_ratio, g_ratio)
2161     (float, b_ratio, b_ratio)
2162     (float, alpha_m, alpha_m)
2163 )
2164 
2165 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::NormalBasedSignature12,
2166     (float[12], values, values)
2167 )
2168 
2169 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::ShapeContext1980,
2170     (float[1980], descriptor, shape_context)
2171     (float[9], rf, rf)
2172 )
2173 
2174 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::UniqueShapeContext1960,
2175     (float[1960], descriptor, shape_context)
2176     (float[9], rf, rf)
2177 )
2178 
2179 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::SHOT352,
2180     (float[352], descriptor, shot)
2181     (float[9], rf, rf)
2182 )
2183 
2184 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::SHOT1344,
2185     (float[1344], descriptor, shot)
2186     (float[9], rf, rf)
2187 )
2188 
2189 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::FPFHSignature33,
2190     (float[33], histogram, fpfh)
2191 )
2192 
2193 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::BRISKSignature512,
2194     (float, scale, brisk_scale)
2195     (float, orientation, brisk_orientation)
2196     (unsigned char[64], descriptor, brisk_descriptor512)
2197 )
2198 
2199 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::VFHSignature308,
2200     (float[308], histogram, vfh)
2201 )
2202 
2203 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::GRSDSignature21,
2204     (float[21], histogram, grsd)
2205 )
2206 
2207 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::ESFSignature640,
2208     (float[640], histogram, esf)
2209 )
2210 
2211 POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::GASDSignature512,
2212     (float[512], histogram, gasd)
2213 )
2214 
2215 POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::GASDSignature984,
2216     (float[984], histogram, gasd)
2217 )
2218 
2219 POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::GASDSignature7992,
2220     (float[7992], histogram, gasd)
2221 )
2222 
2223 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::Narf36,
2224     (float[36], descriptor, descriptor)
2225 )
2226 
2227 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::GFPFHSignature16,
2228     (float[16], histogram, gfpfh)
2229 )
2230 
2231 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::IntensityGradient,
2232     (float, gradient_x, gradient_x)
2233     (float, gradient_y, gradient_y)
2234     (float, gradient_z, gradient_z)
2235 )
2236 
2237 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::PointWithScale,
2238     (float, x, x)
2239     (float, y, y)
2240     (float, z, z)
2241     (float, scale, scale)
2242 )
2243 
2244 POINT_CLOUD_REGISTER_POINT_STRUCT(pcl::PointSurfel,
2245     (float, x, x)
2246     (float, y, y)
2247     (float, z, z)
2248     (float, normal_x, normal_x)
2249     (float, normal_y, normal_y)
2250     (float, normal_z, normal_z)
2251     (std::uint32_t, rgba, rgba)
2252     (float, radius, radius)
2253     (float, confidence, confidence)
2254     (float, curvature, curvature)
2255 )
2256 
2257 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_ReferenceFrame,
2258     (float[3], x_axis, x_axis)
2259     (float[3], y_axis, y_axis)
2260     (float[3], z_axis, z_axis)
2261 )
2262 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::ReferenceFrame, pcl::_ReferenceFrame)
2263 
2264 POINT_CLOUD_REGISTER_POINT_STRUCT (pcl::_PointDEM,
2265     (float, x, x)
2266     (float, y, y)
2267     (float, z, z)
2268     (float, intensity, intensity)
2269     (float, intensity_variance, intensity_variance)
2270     (float, height_variance, height_variance)
2271 )
2272 POINT_CLOUD_REGISTER_POINT_WRAPPER(pcl::PointDEM, pcl::_PointDEM)
2273 
2274 namespace pcl
2275 {
2276 
2277 // Allow float 'rgb' data to match to the newer uint32 'rgba' tag. This is so
2278 // you can load old 'rgb' PCD files into e.g. a PointCloud<PointXYZRGBA>.
2279 template<typename PointT>
2280 struct FieldMatches<PointT, ::pcl::fields::rgba>
2281 {
operator ()pcl::FieldMatches2282   bool operator() (const pcl::PCLPointField& field)
2283   {
2284     if (field.name == "rgb")
2285     {
2286       // For fixing the alpha value bug #1141, the rgb field can also match
2287       // uint32.
2288       return ((field.datatype == pcl::PCLPointField::FLOAT32 ||
2289                field.datatype == pcl::PCLPointField::UINT32) &&
2290               field.count == 1);
2291     }
2292     else
2293     {
2294       return (field.name == traits::name<PointT, fields::rgba>::value &&
2295               field.datatype == traits::datatype<PointT, fields::rgba>::value &&
2296               field.count == traits::datatype<PointT, fields::rgba>::size);
2297     }
2298   }
2299 };
2300 template<typename PointT>
2301 struct FieldMatches<PointT, fields::rgb>
2302 {
operator ()pcl::FieldMatches2303   bool operator() (const pcl::PCLPointField& field)
2304   {
2305     if (field.name == "rgba")
2306     {
2307       return (field.datatype == pcl::PCLPointField::UINT32 &&
2308               field.count == 1);
2309     }
2310     else
2311     {
2312       // For fixing the alpha value bug #1141, rgb can also match uint32
2313       return (field.name == traits::name<PointT, fields::rgb>::value &&
2314               (field.datatype == traits::datatype<PointT, fields::rgb>::value ||
2315                field.datatype == pcl::PCLPointField::UINT32) &&
2316               field.count == traits::datatype<PointT, fields::rgb>::size);
2317     }
2318   }
2319 };
2320 
2321 
2322 // We're doing a lot of black magic with Boost here, so disable warnings in Maintainer mode, as we will never
2323 // be able to fix them anyway
2324 #if defined _MSC_VER
2325   #pragma warning(disable: 4201)
2326 #endif
2327 
2328 namespace traits
2329 {
2330 
2331   /** \brief Metafunction to check if a given point type has a given field.
2332    *
2333    *  Example usage at run-time:
2334    *
2335    *  \code
2336    *  bool curvature_available = pcl::traits::has_field<PointT, pcl::fields::curvature>::value;
2337    *  \endcode
2338    *
2339    *  Example usage at compile-time:
2340    *
2341    *  \code
2342    *  BOOST_MPL_ASSERT_MSG ((pcl::traits::has_field<PointT, pcl::fields::label>::value),
2343    *                        POINT_TYPE_SHOULD_HAVE_LABEL_FIELD,
2344    *                        (PointT));
2345    *  \endcode
2346    */
2347   template <typename PointT, typename Field>
2348   struct has_field : boost::mpl::contains<typename pcl::traits::fieldList<PointT>::type, Field>::type
2349   { };
2350 
2351   /** Metafunction to check if a given point type has all given fields. */
2352   template <typename PointT, typename Field>
2353   struct has_all_fields : boost::mpl::fold<Field,
2354                                            boost::mpl::bool_<true>,
2355                                            boost::mpl::and_<boost::mpl::_1,
2356                                                             has_field<PointT, boost::mpl::_2> > >::type
2357   { };
2358 
2359   /** Metafunction to check if a given point type has any of the given fields. */
2360   template <typename PointT, typename Field>
2361   struct has_any_field : boost::mpl::fold<Field,
2362                                           boost::mpl::bool_<false>,
2363                                           boost::mpl::or_<boost::mpl::_1,
2364                                                           has_field<PointT, boost::mpl::_2> > >::type
2365   { };
2366 
2367   /** \brief Traits defined for ease of use with fields already registered before
2368    *
2369    * has_<fields to be detected>: struct with `value` datamember defined at compiletime
2370    * has_<fields to be detected>_v: constexpr boolean
2371    * Has<Fields to be detected>: concept modelling name alias for `enable_if`
2372    */
2373 
2374   /** Metafunction to check if a given point type has x and y fields. */
2375   template <typename PointT>
2376   struct has_xy : has_all_fields<PointT, boost::mpl::vector<pcl::fields::x,
2377                                                             pcl::fields::y> >
2378   { };
2379 
2380   template <typename PointT>
2381   constexpr auto has_xy_v = has_xy<PointT>::value;
2382 
2383   template <typename PointT>
2384   using HasXY = std::enable_if_t<has_xy_v<PointT>, bool>;
2385 
2386   template <typename PointT>
2387   using HasNoXY = std::enable_if_t<!has_xy_v<PointT>, bool>;
2388 
2389   /** Metafunction to check if a given point type has x, y, and z fields. */
2390   template <typename PointT>
2391   struct has_xyz : has_all_fields<PointT, boost::mpl::vector<pcl::fields::x,
2392                                                              pcl::fields::y,
2393                                                              pcl::fields::z> >
2394   { };
2395 
2396   template <typename PointT>
2397   constexpr auto has_xyz_v = has_xyz<PointT>::value;
2398 
2399   template <typename PointT>
2400   using HasXYZ = std::enable_if_t<has_xyz_v<PointT>, bool>;
2401 
2402   template <typename PointT>
2403   using HasNoXYZ = std::enable_if_t<!has_xyz_v<PointT>, bool>;
2404 
2405   /** Metafunction to check if a given point type has normal_x, normal_y, and
2406     * normal_z fields. */
2407   template <typename PointT>
2408   struct has_normal : has_all_fields<PointT, boost::mpl::vector<pcl::fields::normal_x,
2409                                                                 pcl::fields::normal_y,
2410                                                                 pcl::fields::normal_z> >
2411   { };
2412 
2413   template <typename PointT>
2414   constexpr auto has_normal_v = has_normal<PointT>::value;
2415 
2416   template <typename PointT>
2417   using HasNormal = std::enable_if_t<has_normal_v<PointT>, bool>;
2418 
2419   template <typename PointT>
2420   using HasNoNormal = std::enable_if_t<!has_normal_v<PointT>, bool>;
2421 
2422   /** Metafunction to check if a given point type has curvature field. */
2423   template <typename PointT>
2424   struct has_curvature : has_field<PointT, pcl::fields::curvature>
2425   { };
2426 
2427   template <typename PointT>
2428   constexpr auto has_curvature_v = has_curvature<PointT>::value;
2429 
2430   template <typename PointT>
2431   using HasCurvature = std::enable_if_t<has_curvature_v<PointT>, bool>;
2432 
2433   template <typename PointT>
2434   using HasNoCurvature = std::enable_if_t<!has_curvature_v<PointT>, bool>;
2435 
2436   /** Metafunction to check if a given point type has intensity field. */
2437   template <typename PointT>
2438   struct has_intensity : has_field<PointT, pcl::fields::intensity>
2439   { };
2440 
2441   template <typename PointT>
2442   constexpr auto has_intensity_v = has_intensity<PointT>::value;
2443 
2444   template <typename PointT>
2445   using HasIntensity = std::enable_if_t<has_intensity_v<PointT>, bool>;
2446 
2447   template <typename PointT>
2448   using HasNoIntensity = std::enable_if_t<!has_intensity_v<PointT>, bool>;
2449 
2450   /** Metafunction to check if a given point type has either rgb or rgba field. */
2451   template <typename PointT>
2452   struct has_color : has_any_field<PointT, boost::mpl::vector<pcl::fields::rgb,
2453                                                               pcl::fields::rgba> >
2454   { };
2455 
2456   template <typename PointT>
2457   constexpr auto has_color_v = has_color<PointT>::value;
2458 
2459   template <typename PointT>
2460   using HasColor = std::enable_if_t<has_color_v<PointT>, bool>;
2461 
2462   template <typename PointT>
2463   using HasNoColor = std::enable_if_t<!has_color_v<PointT>, bool>;
2464 
2465   /** Metafunction to check if a given point type has label field. */
2466   template <typename PointT>
2467   struct has_label : has_field<PointT, pcl::fields::label>
2468   { };
2469 
2470   template <typename PointT>
2471   constexpr auto has_label_v = has_label<PointT>::value;
2472 
2473   template <typename PointT>
2474   using HasLabel = std::enable_if_t<has_label_v<PointT>, bool>;
2475 
2476   template <typename PointT>
2477   using HasNoLabel = std::enable_if_t<!has_label_v<PointT>, bool>;
2478 }
2479 
2480 #if defined _MSC_VER
2481   #pragma warning(default: 4201)
2482 #endif
2483 
2484 } // namespace pcl
2485 
2486