Point Cloud Library (PCL)  1.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
point_types.hpp
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2010, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage, Inc. nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  * $Id: point_types.hpp 6126 2012-07-03 20:19:58Z aichim $
35  *
36  */
37 
38 #ifndef PCL_IMPL_POINT_TYPES_HPP_
39 #define PCL_IMPL_POINT_TYPES_HPP_
40 
41 // Define all PCL point types
42 #define PCL_POINT_TYPES \
43  (pcl::PointXYZ) \
44  (pcl::PointXYZI) \
45  (pcl::PointXYZL) \
46  (pcl::Label) \
47  (pcl::PointXYZRGBA) \
48  (pcl::PointXYZRGB) \
49  (pcl::PointXYZRGBL) \
50  (pcl::PointXYZHSV) \
51  (pcl::PointXY) \
52  (pcl::InterestPoint) \
53  (pcl::Axis) \
54  (pcl::Normal) \
55  (pcl::PointNormal) \
56  (pcl::PointXYZRGBNormal) \
57  (pcl::PointXYZINormal) \
58  (pcl::PointWithRange) \
59  (pcl::PointWithViewpoint) \
60  (pcl::MomentInvariants) \
61  (pcl::PrincipalRadiiRSD) \
62  (pcl::Boundary) \
63  (pcl::PrincipalCurvatures) \
64  (pcl::PFHSignature125) \
65  (pcl::PFHRGBSignature250) \
66  (pcl::PPFSignature) \
67  (pcl::PPFRGBSignature) \
68  (pcl::NormalBasedSignature12) \
69  (pcl::FPFHSignature33) \
70  (pcl::VFHSignature308) \
71  (pcl::ESFSignature640) \
72  (pcl::Narf36) \
73  (pcl::IntensityGradient) \
74  (pcl::PointWithScale) \
75  (pcl::ReferenceFrame)
76 
77 // Define all point types that include XYZ data
78 #define PCL_XYZ_POINT_TYPES \
79  (pcl::PointXYZ) \
80  (pcl::PointXYZI) \
81  (pcl::PointXYZL) \
82  (pcl::PointXYZRGBA) \
83  (pcl::PointXYZRGB) \
84  (pcl::PointXYZRGBL) \
85  (pcl::PointXYZHSV) \
86  (pcl::InterestPoint) \
87  (pcl::PointNormal) \
88  (pcl::PointXYZRGBNormal) \
89  (pcl::PointXYZINormal) \
90  (pcl::PointWithRange) \
91  (pcl::PointWithViewpoint) \
92  (pcl::PointWithScale)
93 
94 // Define all point types with XYZ and label
95 #define PCL_XYZL_POINT_TYPES \
96  (pcl::PointXYZL) \
97  (pcl::PointXYZRGBL)
98 
99 
100 // Define all point types that include normal[3] data
101 #define PCL_NORMAL_POINT_TYPES \
102  (pcl::Normal) \
103  (pcl::PointNormal) \
104  (pcl::PointXYZRGBNormal) \
105  (pcl::PointXYZINormal)
106 
107 // Define all point types that represent features
108 #define PCL_FEATURE_POINT_TYPES \
109  (pcl::PFHSignature125) \
110  (pcl::PFHRGBSignature250) \
111  (pcl::PPFSignature) \
112  (pcl::PPFRGBSignature) \
113  (pcl::NormalBasedSignature12) \
114  (pcl::FPFHSignature33) \
115  (pcl::VFHSignature308) \
116  (pcl::ESFSignature640) \
117  (pcl::Narf36)
118 
119 namespace pcl
120 {
121 
122 #define PCL_ADD_POINT4D \
123  EIGEN_ALIGN16 \
124  union { \
125  float data[4]; \
126  struct { \
127  float x; \
128  float y; \
129  float z; \
130  }; \
131  }; \
132  inline Eigen::Map<Eigen::Vector3f> getVector3fMap () { return (Eigen::Vector3f::Map (data)); } \
133  inline const Eigen::Map<const Eigen::Vector3f> getVector3fMap () const { return (Eigen::Vector3f::Map (data)); } \
134  inline Eigen::Map<Eigen::Vector4f, Eigen::Aligned> getVector4fMap () { return (Eigen::Vector4f::MapAligned (data)); } \
135  inline const Eigen::Map<const Eigen::Vector4f, Eigen::Aligned> getVector4fMap () const { return (Eigen::Vector4f::MapAligned (data)); } \
136  inline Eigen::Map<Eigen::Array3f> getArray3fMap () { return (Eigen::Array3f::Map (data)); } \
137  inline const Eigen::Map<const Eigen::Array3f> getArray3fMap () const { return (Eigen::Array3f::Map (data)); } \
138  inline Eigen::Map<Eigen::Array4f, Eigen::Aligned> getArray4fMap () { return (Eigen::Array4f::MapAligned (data)); } \
139  inline const Eigen::Map<const Eigen::Array4f, Eigen::Aligned> getArray4fMap () const { return (Eigen::Array4f::MapAligned (data)); }
140 
141 #define PCL_ADD_NORMAL4D \
142  EIGEN_ALIGN16 \
143  union { \
144  float data_n[4]; \
145  float normal[3]; \
146  struct { \
147  float normal_x; \
148  float normal_y; \
149  float normal_z; \
150  }; \
151  }; \
152  inline Eigen::Map<Eigen::Vector3f> getNormalVector3fMap () { return (Eigen::Vector3f::Map (data_n)); } \
153  inline const Eigen::Map<const Eigen::Vector3f> getNormalVector3fMap () const { return (Eigen::Vector3f::Map (data_n)); } \
154  inline Eigen::Map<Eigen::Vector4f, Eigen::Aligned> getNormalVector4fMap () { return (Eigen::Vector4f::MapAligned (data_n)); } \
155  inline const Eigen::Map<const Eigen::Vector4f, Eigen::Aligned> getNormalVector4fMap () const { return (Eigen::Vector4f::MapAligned (data_n)); }
156 
157 #define PCL_ADD_RGB \
158  union \
159  { \
160  union \
161  { \
162  struct \
163  { \
164  uint8_t b; \
165  uint8_t g; \
166  uint8_t r; \
167  uint8_t a; \
168  }; \
169  float rgb; \
170  }; \
171  uint32_t rgba; \
172  };
173 
174  typedef Eigen::Map<Eigen::Array3f> Array3fMap;
175  typedef const Eigen::Map<const Eigen::Array3f> Array3fMapConst;
176  typedef Eigen::Map<Eigen::Array4f, Eigen::Aligned> Array4fMap;
177  typedef const Eigen::Map<const Eigen::Array4f, Eigen::Aligned> Array4fMapConst;
178  typedef Eigen::Map<Eigen::Vector3f> Vector3fMap;
179  typedef const Eigen::Map<const Eigen::Vector3f> Vector3fMapConst;
180  typedef Eigen::Map<Eigen::Vector4f, Eigen::Aligned> Vector4fMap;
181  typedef const Eigen::Map<const Eigen::Vector4f, Eigen::Aligned> Vector4fMapConst;
182 
183 
184 
185  struct _PointXYZ
186  {
187  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
188 
189  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
190  };
191 
196  {
197  inline PointXYZ ()
198  {
199  x = y = z = 0.0f;
200  data[3] = 1.0f;
201  }
202 
203  inline PointXYZ (float _x, float _y, float _z)
204  {
205  x = _x; y = _y; z = _z;
206  data[3] = 1.0f;
207  }
208 
209  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
210  };
211 
212  inline std::ostream& operator << (std::ostream& os, const PointXYZ& p)
213  {
214  os << "(" << p.x << "," << p.y << "," << p.z << ")";
215  return (os);
216  }
217 
218 
238  struct RGB
239  {
241  };
242 
243 
248  {
249  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
250  union
251  {
252  struct
253  {
254  float intensity;
255  };
256  float data_c[4];
257  };
258  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
259  };
260 
261  struct PointXYZI : public _PointXYZI
262  {
263  inline PointXYZI ()
264  {
265  x = y = z = 0.0f;
266  data[3] = 1.0f;
267  intensity = 0.0f;
268  }
269  inline PointXYZI (float _intensity)
270  {
271  x = y = z = 0.0f;
272  data[3] = 1.0f;
273  intensity = _intensity;
274  }
275  };
276 
277  inline std::ostream& operator << (std::ostream& os, const PointXYZI& p)
278  {
279  os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.intensity << ")";
280  return (os);
281  }
282 
283 
285  {
286  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
287  uint32_t label;
288  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
289  };
290 
291  struct PointXYZL : public _PointXYZL
292  {
293  inline PointXYZL ()
294  {
295  x = y = z = 0.0f;
296  data[3] = 1.0f;
297  label = 0;
298  }
299  };
300 
301  inline std::ostream& operator << (std::ostream& os, const PointXYZL& p)
302  {
303  os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.label << ")";
304  return (os);
305  }
306 
307  struct Label
308  {
309  uint32_t label;
310  };
311 
312  inline std::ostream& operator << (std::ostream& os, const Label& p)
313  {
314  os << "(" << p.label << ")";
315  return (os);
316  }
317 
318 
340  {
341  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
343  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
344  };
345 
347  {
348  inline PointXYZRGBA ()
349  {
350  x = y = z = 0.0f;
351  data[3] = 1.0f;
352  r = g = b = a = 0;
353  }
354  inline Eigen::Vector3i getRGBVector3i () { return (Eigen::Vector3i (r, g, b)); }
355  inline const Eigen::Vector3i getRGBVector3i () const { return (Eigen::Vector3i (r, g, b)); }
356  inline Eigen::Vector4i getRGBVector4i () { return (Eigen::Vector4i (r, g, b, 0)); }
357  inline const Eigen::Vector4i getRGBVector4i () const { return (Eigen::Vector4i (r, g, b, 0)); }
358  };
359 
360  inline std::ostream&
361  operator << (std::ostream& os, const PointXYZRGBA& p)
362  {
363  const unsigned char* rgba_ptr = reinterpret_cast<const unsigned char*>(&p.rgba);
364  os << "(" << p.x << "," << p.y << "," << p.z << " - "
365  << static_cast<int>(*rgba_ptr) << ","
366  << static_cast<int>(*(rgba_ptr+1)) << ","
367  << static_cast<int>(*(rgba_ptr+2)) << ","
368  << static_cast<int>(*(rgba_ptr+3)) << ")";
369  return (os);
370  }
371 
372 
374  {
375  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
377  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
378  };
379 
381  {
382  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
384  uint32_t label;
385  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
386  };
387 
420  {
421  inline PointXYZRGB ()
422  {
423  x = y = z = 0.0f;
424  data[3] = 1.0f;
425  r = g = b = a = 0;
426  }
427  inline PointXYZRGB (uint8_t _r, uint8_t _g, uint8_t _b)
428  {
429  x = y = z = 0.0f;
430  data[3] = 1.0f;
431  r = _r;
432  g = _g;
433  b = _b;
434  a = 0;
435  }
436 
437  inline Eigen::Vector3i getRGBVector3i () { return (Eigen::Vector3i (r, g, b)); }
438  inline const Eigen::Vector3i getRGBVector3i () const { return (Eigen::Vector3i (r, g, b)); }
439  inline Eigen::Vector4i getRGBVector4i () { return (Eigen::Vector4i (r, g, b, 0)); }
440  inline const Eigen::Vector4i getRGBVector4i () const { return (Eigen::Vector4i (r, g, b, 0)); }
441 
442  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
443  };
444  inline std::ostream& operator << (std::ostream& os, const PointXYZRGB& p)
445  {
446  os << "(" << p.x << "," << p.y << "," << p.z << " - "
447  << static_cast<int>(p.r) << ","
448  << static_cast<int>(p.g) << ","
449  << static_cast<int>(p.b) << ")";
450  return (os);
451  }
452 
454  {
455  inline PointXYZRGBL ()
456  {
457  x = y = z = 0.0f;
458  data[3] = 1.0f;
459  r = g = b = 0;
460  label = 255;
461  }
462  inline PointXYZRGBL (uint8_t _r, uint8_t _g, uint8_t _b, uint32_t _label)
463  {
464  x = y = z = 0.0f;
465  data[3] = 1.0f;
466  r = _r;
467  g = _g;
468  b = _b;
469  label = _label;
470  }
471  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
472  };
473  inline std::ostream& operator << (std::ostream& os, const PointXYZRGBL& p)
474  {
475  os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.r << "," << p.g << "," << p.b << " - " << p.label << ")";
476  return (os);
477  }
478 
480  {
481  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
482  union
483  {
484  struct
485  {
486  float h;
487  float s;
488  float v;
489  };
490  float data_c[4];
491  };
492  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
493  } EIGEN_ALIGN16;
494 
496  {
497  inline PointXYZHSV ()
498  {
499  x = y = z = 0.0f;
500  data[3] = 1.0f;
501  h = s = v = data_c[3] = 0;
502  }
503  inline PointXYZHSV (float _h, float _v, float _s)
504  {
505  x = y = z = 0.0f;
506  data[3] = 1.0f;
507  h = _h; v = _v; s = _s;
508  data_c[3] = 0;
509  }
510  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
511  };
512  inline std::ostream& operator << (std::ostream& os, const PointXYZHSV& p)
513  {
514  os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.h << " , " << p.s << " , " << p.v << ")";
515  return (os);
516  }
517 
518 
522  struct PointXY
523  {
524  float x;
525  float y;
526  };
527  inline std::ostream& operator << (std::ostream& os, const PointXY& p)
528  {
529  os << "(" << p.x << "," << p.y << ")";
530  return (os);
531  }
532 
537  {
538  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
539  union
540  {
541  struct
542  {
543  float strength;
544  };
545  float data_c[4];
546  };
547  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
548  };
549  inline std::ostream& operator << (std::ostream& os, const InterestPoint& p)
550  {
551  os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.strength << ")";
552  return (os);
553  }
554 
559  {
560  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
561  union
562  {
563  struct
564  {
565  float curvature;
566  };
567  float data_c[4];
568  };
569  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
570  };
571 
572  struct Normal : public _Normal
573  {
574  inline Normal ()
575  {
576  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
577  }
578 
579  inline Normal (float n_x, float n_y, float n_z)
580  {
581  normal_x = n_x; normal_y = n_y; normal_z = n_z;
582  data_n[3] = 0.0f;
583  }
584 
585  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
586  };
587 
588  inline std::ostream& operator << (std::ostream& os, const Normal& p)
589  {
590  os << "(" << p.normal[0] << "," << p.normal[1] << "," << p.normal[2] << " - " << p.curvature << ")";
591  return (os);
592  }
593 
598  {
600  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
601  };
602 
603  struct EIGEN_ALIGN16 Axis : public _Axis
604  {
605  inline Axis ()
606  {
607  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
608  }
609 
610  inline Axis (float n_x, float n_y, float n_z)
611  {
612  normal_x = n_x; normal_y = n_y; normal_z = n_z;
613  data_n[3] = 0.0f;
614  }
615 
616  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
617  };
618 
619  inline std::ostream& operator << (std::ostream& os, const Axis& p)
620  {
621  os << "(" << p.normal[0] << "," << p.normal[1] << "," << p.normal[2] << ")";
622  return os;
623  }
624 
625  inline std::ostream& operator << (std::ostream& os, const _Axis& p)
626  {
627  os << "(" << p.normal[0] << "," << p.normal[1] << "," << p.normal[2] << ")";
628  return os;
629  }
630 
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_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
638  union
639  {
640  struct
641  {
642  float curvature;
643  };
644  float data_c[4];
645  };
646  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
647  };
648 
649  struct PointNormal : public _PointNormal
650  {
651  inline PointNormal ()
652  {
653  x = y = z = 0.0f;
654  data[3] = 1.0f;
655  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
656  }
657  };
658 
659  inline std::ostream& operator << (std::ostream& os, const PointNormal& p)
660  {
661  os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.normal[0] << "," << p.normal[1] << "," << p.normal[2] << " - " << p.curvature << ")";
662  return (os);
663  }
664 
695  {
696  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
697  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
698  union
699  {
700  struct
701  {
702  // RGB union
703  union
704  {
705  struct
706  {
707  uint8_t b;
708  uint8_t g;
709  uint8_t r;
710  uint8_t a;
711  };
712  float rgb;
713  uint32_t rgba;
714  };
715  float curvature;
716  };
717  float data_c[4];
718  };
719  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
720  };
722  {
724  {
725  x = y = z = 0.0f;
726  data[3] = 1.0f;
727  r = g = b = a = 0;
728  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
729  }
730 
731  inline Eigen::Vector3i getRGBVector3i () { return (Eigen::Vector3i (r, g, b)); }
732  inline const Eigen::Vector3i getRGBVector3i () const { return (Eigen::Vector3i (r, g, b)); }
733  inline Eigen::Vector4i getRGBVector4i () { return (Eigen::Vector4i (r, g, b, 0)); }
734  inline const Eigen::Vector4i getRGBVector4i () const { return (Eigen::Vector4i (r, g, b, 0)); }
735  };
736  inline std::ostream& operator << (std::ostream& os, const PointXYZRGBNormal& p)
737  {
738  os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.rgb << " - " << p.normal[0] << "," << p.normal[1] << "," << p.normal[2] << " - " << p.r << ", " << p.g << ", " << p.b << " - " << p.curvature << ")";
739  return (os);
740  }
741 
746  {
747  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
748  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
749  union
750  {
751  struct
752  {
753  float intensity;
754  float curvature;
755  };
756  float data_c[4];
757  };
758  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
759  };
760 
762  {
763  inline PointXYZINormal ()
764  {
765  x = y = z = 0.0f;
766  data[3] = 1.0f;
767  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
768  intensity = 0.0f;
769  }
770  };
771 
772  inline std::ostream& operator << (std::ostream& os, const PointXYZINormal& p)
773  {
774  os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.intensity << " - " << p.normal[0] << "," << p.normal[1] << "," << p.normal[2] << " - " << p.curvature << ")";
775  return (os);
776  }
777 
782  {
783  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
784  union
785  {
786  struct
787  {
788  float range;
789  };
790  float data_c[4];
791  };
792  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
793  };
794 
796  {
797  inline PointWithRange ()
798  {
799  x = y = z = 0.0f;
800  data[3] = 1.0f;
801  range = 0.0f;
802  }
803  };
804 
805  inline std::ostream& operator << (std::ostream& os, const PointWithRange& p)
806  {
807  os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.range << ")";
808  return (os);
809  }
810 
812  {
813  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
814  union
815  {
816  struct
817  {
818  float vp_x;
819  float vp_y;
820  float vp_z;
821  };
822  float data_c[4];
823  };
824  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
825  };
826 
831  {
832  PointWithViewpoint(float _x=0.0f, float _y=0.0f, float _z=0.0f, float _vp_x=0.0f, float _vp_y=0.0f, float _vp_z=0.0f)
833  {
834  x=_x; y=_y; z=_z;
835  data[3] = 1.0f;
836  vp_x=_vp_x; vp_y=_vp_y; vp_z=_vp_z;
837  }
838  };
839  inline std::ostream& operator << (std::ostream& os, const PointWithViewpoint& p)
840  {
841  os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.vp_x << "," << p.vp_y << "," << p.vp_z << ")";
842  return (os);
843  }
844 
849  {
850  float j1, j2, j3;
851  };
852  inline std::ostream& operator << (std::ostream& os, const MomentInvariants& p)
853  {
854  os << "(" << p.j1 << "," << p.j2 << "," << p.j3 << ")";
855  return (os);
856  }
857 
862  {
863  float r_min, r_max;
864  };
865  inline std::ostream& operator << (std::ostream& os, const PrincipalRadiiRSD& p)
866  {
867  os << "(" << p.r_min << "," << p.r_max << ")";
868  return (os);
869  }
870 
874  struct Boundary
875  {
876  uint8_t boundary_point;
877  };
878  inline std::ostream& operator << (std::ostream& os, const Boundary& p)
879  {
880  os << p.boundary_point;
881  return (os);
882  }
883 
888  {
889  union
890  {
892  struct
893  {
897  };
898  };
899  float pc1;
900  float pc2;
901  };
902  inline std::ostream& operator << (std::ostream& os, const PrincipalCurvatures& p)
903  {
904  os << "(" << p.principal_curvature[0] << "," << p.principal_curvature[1] << "," << p.principal_curvature[2] << " - " << p.pc1 << "," << p.pc2 << ")";
905  return (os);
906  }
907 
912  {
913  float histogram[125];
914  };
915  inline std::ostream& operator << (std::ostream& os, const PFHSignature125& p)
916  {
917  for (int i = 0; i < 125; ++i)
918  os << (i == 0 ? "(" : "") << p.histogram[i] << (i < 124 ? ", " : ")");
919  return (os);
920  }
921 
926  {
927  float histogram[250];
928  };
929  inline std::ostream& operator << (std::ostream& os, const PFHRGBSignature250& p)
930  {
931  for (int i = 0; i < 250; ++i)
932  os << (i == 0 ? "(" : "") << p.histogram[i] << (i < 249 ? ", " : ")");
933  return (os);
934  }
935 
940  {
941  float f1, f2, f3, f4;
942  float alpha_m;
943  };
944  inline std::ostream& operator << (std::ostream& os, const PPFSignature& p)
945  {
946  os << "(" << p.f1 << ", " << p.f2 << ", " << p.f3 << ", " << p.f4 << ", " << p.alpha_m << ")";
947  return (os);
948  }
949 
954  {
955  float f1, f2, f3, f4;
957  float alpha_m;
958  };
959  inline std::ostream& operator << (std::ostream& os, const PPFRGBSignature& p)
960  {
961  os << "(" << p.f1 << ", " << p.f2 << ", " << p.f3 << ", " << p.f4 << ", " <<
962  p.r_ratio << ", " << p.g_ratio << ", " << p.b_ratio << ", " << p.alpha_m << ")";
963  return (os);
964  }
965 
971  {
972  float values[12];
973  };
974  inline std::ostream& operator << (std::ostream& os, const NormalBasedSignature12& p)
975  {
976  for (int i = 0; i < 12; ++i)
977  os << (i == 0 ? "(" : "") << p.values[i] << (i < 11 ? ", " : ")");
978  return (os);
979  }
980 
985  {
986  std::vector<float> descriptor;
987  float rf[9];
988  };
989 
990  inline std::ostream& operator << (std::ostream& os, const ShapeContext& p)
991  {
992  for (int i = 0; i < 9; ++i)
993  os << (i == 0 ? "(" : "") << p.rf[i] << (i < 8 ? ", " : ")");
994  for (size_t i = 0; i < p.descriptor.size (); ++i)
995  os << (i == 0 ? "(" : "") << p.descriptor[i] << (i < p.descriptor.size()-1 ? ", " : ")");
996  return (os);
997  }
998 
1002  struct SHOT
1003  {
1004  std::vector<float> descriptor;
1005  float rf[9];
1006  };
1007 
1008  PCL_DEPRECATED (inline std::ostream& operator << (std::ostream& os, const SHOT& p), "SHOT POINT IS DEPRECATED, USE SHOT352 FOR SHAPE AND SHOT1344 FOR SHAPE+COLOR INSTEAD");
1009  inline std::ostream& operator << (std::ostream& os, const SHOT& p)
1010  {
1011  for (int i = 0; i < 9; ++i)
1012  os << (i == 0 ? "(" : "") << p.rf[i] << (i < 8 ? ", " : ")");
1013  for (size_t i = 0; i < p.descriptor.size (); ++i)
1014  os << (i == 0 ? "(" : "") << p.descriptor[i] << (i < p.descriptor.size()-1 ? ", " : ")");
1015  return (os);
1016  }
1017 
1021  struct SHOT352
1022  {
1023  float descriptor[352];
1024  float rf[9];
1025  };
1026 
1027  inline std::ostream& operator << (std::ostream& os, const SHOT352& p)
1028  {
1029  for (int i = 0; i < 9; ++i)
1030  os << (i == 0 ? "(" : "") << p.rf[i] << (i < 8 ? ", " : ")");
1031  for (size_t i = 0; i < 352; ++i)
1032  os << (i == 0 ? "(" : "") << p.descriptor[i] << (i < 351 ? ", " : ")");
1033  return (os);
1034  }
1035 
1039  struct SHOT1344
1040  {
1041  float descriptor[1344];
1042  float rf[9];
1043  };
1044 
1045  inline std::ostream& operator << (std::ostream& os, const SHOT1344& p)
1046  {
1047  for (int i = 0; i < 9; ++i)
1048  os << (i == 0 ? "(" : "") << p.rf[i] << (i < 8 ? ", " : ")");
1049  for (size_t i = 0; i < 1344; ++i)
1050  os << (i == 0 ? "(" : "") << p.descriptor[i] << (i < 1343 ? ", " : ")");
1051  return (os);
1052  }
1053 
1058  {
1059  union
1060  {
1061  struct
1062  {
1066  };
1067  float rf[12];
1068  };
1069  //union
1070  //{
1071  //struct
1072  //{
1073  //float confidence;
1074  //};
1075  //float data_c[4];
1076  //};
1077 
1078  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
1079  };
1080 
1082  {
1084  {
1085  x_axis = y_axis = z_axis = Axis();
1086  //confidence = 0.;
1087  }
1088 
1089  ReferenceFrame (Axis const &x, Axis const &y, Axis const &z/*, float c = 1.0*/)
1090  {
1091  x_axis = x;
1092  y_axis = y;
1093  z_axis = z;
1094  //confidence = c;
1095  }
1096 
1097  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
1098  };
1099 
1100  inline std::ostream& operator << (std::ostream& os, const ReferenceFrame& p)
1101  {
1102  os << "(" << p.x_axis << "," << p.y_axis << "," << p.z_axis /*<< " - " << p.confidence*/ << ")";
1103  return (os);
1104  }
1105 
1110  {
1111  float histogram[33];
1112  };
1113  inline std::ostream& operator << (std::ostream& os, const FPFHSignature33& p)
1114  {
1115  for (int i = 0; i < 33; ++i)
1116  os << (i == 0 ? "(" : "") << p.histogram[i] << (i < 32 ? ", " : ")");
1117  return (os);
1118  }
1119 
1124  {
1125  float histogram[308];
1126  };
1127  inline std::ostream& operator << (std::ostream& os, const VFHSignature308& p)
1128  {
1129  for (int i = 0; i < 308; ++i)
1130  os << (i == 0 ? "(" : "") << p.histogram[i] << (i < 307 ? ", " : ")");
1131  return (os);
1132  }
1133 
1138  {
1139  float histogram[640];
1140  };
1141  inline std::ostream& operator << (std::ostream& os, const ESFSignature640& p)
1142  {
1143  for (int i = 0; i < 640; ++i)
1144  os << (i == 0 ? "(" : "") << p.histogram[i] << (i < 639 ? ", " : ")");
1145  return (os);
1146  }
1147 
1152  {
1153  float histogram[16];
1154  static int descriptorSize() { return 16; }
1155  };
1156  inline std::ostream& operator << (std::ostream& os, const GFPFHSignature16& p)
1157  {
1158  for (int i = 0; i < p.descriptorSize (); ++i)
1159  os << (i == 0 ? "(" : "") << p.histogram[i] << (i < (p.descriptorSize () - 1) ? ", " : ")");
1160  return (os);
1161  }
1162 
1166  struct Narf36
1167  {
1168  float x, y, z, roll, pitch, yaw;
1169  float descriptor[36];
1170  };
1171  inline std::ostream& operator << (std::ostream& os, const Narf36& p)
1172  {
1173  os << p.x<<","<<p.y<<","<<p.z<<" - "<<p.roll*360.0/M_PI<<"deg,"<<p.pitch*360.0/M_PI<<"deg,"<<p.yaw*360.0/M_PI<<"deg - ";
1174  for (int i = 0; i < 36; ++i)
1175  os << (i == 0 ? "(" : "") << p.descriptor[i] << (i < 35 ? ", " : ")");
1176  return (os);
1177  }
1178 
1183  {
1184  int x, y;
1186  //std::vector<const BorderDescription*> neighbors;
1187  };
1188 
1189  inline std::ostream& operator << (std::ostream& os, const BorderDescription& p)
1190  {
1191  os << "(" << p.x << "," << p.y << ")";
1192  return (os);
1193  }
1194 
1199  {
1200  union
1201  {
1202  float gradient[3];
1203  struct
1204  {
1205  float gradient_x;
1206  float gradient_y;
1207  float gradient_z;
1208  };
1209  };
1210  };
1211  inline std::ostream& operator << (std::ostream& os, const IntensityGradient& p)
1212  {
1213  os << "(" << p.gradient[0] << "," << p.gradient[1] << "," << p.gradient[2] << ")";
1214  return (os);
1215  }
1216 
1220  template <int N>
1221  struct Histogram
1222  {
1223  float histogram[N];
1224  };
1225  template <int N>
1226  inline std::ostream& operator << (std::ostream& os, const Histogram<N>& p)
1227  {
1228  for (int i = 0; i < N; ++i)
1229  os << (i == 0 ? "(" : "") << p.histogram[i] << (i < N-1 ? ", " : ")");
1230  return (os);
1231  }
1232 
1237  {
1238  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1239  float scale;
1240  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
1241  };
1242 
1244  {
1245  inline PointWithScale ()
1246  {
1247  x = y = z = 0.0f;
1248  data[3] = 1.0f;
1249  scale = 1.0f;
1250  }
1251  };
1252  inline std::ostream& operator << (std::ostream& os, const PointWithScale& p)
1253  {
1254  os << "(" << p.x << "," << p.y << "," << p.z << " - " << p.scale << ")";
1255  return (os);
1256  }
1257 
1262  {
1263  PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
1264  PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
1265  union
1266  {
1267  struct
1268  {
1269  uint32_t rgba;
1270  float radius;
1271  float confidence;
1272  float curvature;
1273  };
1274  float data_c[4];
1275  };
1276  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
1277  };
1278 
1279  struct PointSurfel : public _PointSurfel
1280  {
1281  inline PointSurfel ()
1282  {
1283  x = y = z = 0.0f;
1284  data[3] = 1.0f;
1285  normal_x = normal_y = normal_z = data_n[3] = 0.0f;
1286  rgba = 0;
1287  radius = confidence = curvature = 0.0f;
1288  }
1289  };
1290 
1291  inline std::ostream& operator << (std::ostream& os, const PointSurfel& p)
1292  {
1293  const unsigned char* rgba_ptr = reinterpret_cast<const unsigned char*>(&p.rgba);
1294  os <<
1295  "(" << p.x << "," << p.y << "," << p.z << " - " <<
1296  p.normal_x << "," << p.normal_y << "," << p.normal_z << " - "
1297  << static_cast<int>(*rgba_ptr) << ","
1298  << static_cast<int>(*(rgba_ptr+1)) << ","
1299  << static_cast<int>(*(rgba_ptr+2)) << ","
1300  << static_cast<int>(*(rgba_ptr+3)) << " - " <<
1301  p.radius << " - " << p.confidence << " - " << p.curvature << ")";
1302  return (os);
1303  }
1304 
1308  template <typename PointT> inline bool
1309  isFinite (const PointT &pt)
1310  {
1311  return (pcl_isfinite (pt.x) && pcl_isfinite (pt.y) && pcl_isfinite (pt.z));
1312  }
1313 
1314  // specification for pcl::Normal
1315  template <> inline bool
1316  isFinite<pcl::Normal> (const pcl::Normal &n)
1317  {
1318  return (pcl_isfinite (n.normal_x) && pcl_isfinite (n.normal_y) && pcl_isfinite (n.normal_z));
1319  }
1320 } // End namespace
1321 
1322 // Preserve API for PCL users < 1.4
1323 #include <pcl/common/distances.h>
1324 
1325 #endif