/
point_types.hpp
1642 lines (1433 loc) · 46.8 KB
/
point_types.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2010, Willow Garage, Inc.
* Copyright (c) 2012-, Open Perception, Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the copyright holder(s) nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef PCL_IMPL_POINT_TYPES_HPP_
#define PCL_IMPL_POINT_TYPES_HPP_
#if defined __GNUC__
# pragma GCC system_header
#endif
#include <Eigen/Core>
#include <ostream>
// Define all PCL point types
#define PCL_POINT_TYPES \
(pcl::PointXYZ) \
(pcl::PointXYZI) \
(pcl::PointXYZL) \
(pcl::Label) \
(pcl::PointXYZRGBA) \
(pcl::PointXYZRGB) \
(pcl::PointXYZRGBL) \
(pcl::PointXYZHSV) \
(pcl::PointXY) \
(pcl::InterestPoint) \
(pcl::Axis) \
(pcl::Normal) \
(pcl::PointNormal) \
(pcl::PointXYZRGBNormal) \
(pcl::PointXYZINormal) \
(pcl::PointXYZLNormal) \
(pcl::PointWithRange) \
(pcl::PointWithViewpoint) \
(pcl::MomentInvariants) \
(pcl::PrincipalRadiiRSD) \
(pcl::Boundary) \
(pcl::PrincipalCurvatures) \
(pcl::PFHSignature125) \
(pcl::PFHRGBSignature250) \
(pcl::PPFSignature) \
(pcl::CPPFSignature) \
(pcl::PPFRGBSignature) \
(pcl::NormalBasedSignature12) \
(pcl::FPFHSignature33) \
(pcl::VFHSignature308) \
(pcl::GRSDSignature21) \
(pcl::ESFSignature640) \
(pcl::BRISKSignature512) \
(pcl::Narf36) \
(pcl::IntensityGradient) \
(pcl::PointWithScale) \
(pcl::PointSurfel) \
(pcl::ShapeContext1980) \
(pcl::UniqueShapeContext1960) \
(pcl::SHOT352) \
(pcl::SHOT1344) \
(pcl::PointUV) \
(pcl::ReferenceFrame) \
(pcl::PointDEM)
// Define all point types that include RGB data
#define PCL_RGB_POINT_TYPES \
(pcl::PointXYZRGBA) \
(pcl::PointXYZRGB) \
(pcl::PointXYZRGBL) \
(pcl::PointXYZRGBNormal) \
(pcl::PointSurfel) \
// Define all point types that include XYZ data
#define PCL_XYZ_POINT_TYPES \
(pcl::PointXYZ) \
(pcl::PointXYZI) \
(pcl::PointXYZL) \
(pcl::PointXYZRGBA) \
(pcl::PointXYZRGB) \
(pcl::PointXYZRGBL) \
(pcl::PointXYZHSV) \
(pcl::InterestPoint) \
(pcl::PointNormal) \
(pcl::PointXYZRGBNormal) \
(pcl::PointXYZINormal) \
(pcl::PointXYZLNormal) \
(pcl::PointWithRange) \
(pcl::PointWithViewpoint) \
(pcl::PointWithScale) \
(pcl::PointSurfel) \
(pcl::PointDEM)
// Define all point types with XYZ and label
#define PCL_XYZL_POINT_TYPES \
(pcl::PointXYZL) \
(pcl::PointXYZRGBL) \
(pcl::PointXYZLNormal)
// Define all point types that include normal[3] data
#define PCL_NORMAL_POINT_TYPES \
(pcl::Normal) \
(pcl::PointNormal) \
(pcl::PointXYZRGBNormal) \
(pcl::PointXYZINormal) \
(pcl::PointXYZLNormal) \
(pcl::PointSurfel)
// Define all point types that represent features
#define PCL_FEATURE_POINT_TYPES \
(pcl::PFHSignature125) \
(pcl::PFHRGBSignature250) \
(pcl::PPFSignature) \
(pcl::CPPFSignature) \
(pcl::PPFRGBSignature) \
(pcl::NormalBasedSignature12) \
(pcl::FPFHSignature33) \
(pcl::VFHSignature308) \
(pcl::GRSDSignature21) \
(pcl::ESFSignature640) \
(pcl::BRISKSignature512) \
(pcl::Narf36)
namespace pcl
{
typedef Eigen::Map<Eigen::Array3f> Array3fMap;
typedef const Eigen::Map<const Eigen::Array3f> Array3fMapConst;
typedef Eigen::Map<Eigen::Array4f, Eigen::Aligned> Array4fMap;
typedef const Eigen::Map<const Eigen::Array4f, Eigen::Aligned> Array4fMapConst;
typedef Eigen::Map<Eigen::Vector3f> Vector3fMap;
typedef const Eigen::Map<const Eigen::Vector3f> Vector3fMapConst;
typedef Eigen::Map<Eigen::Vector4f, Eigen::Aligned> Vector4fMap;
typedef const Eigen::Map<const Eigen::Vector4f, Eigen::Aligned> Vector4fMapConst;
typedef Eigen::Matrix<uint8_t, 3, 1> Vector3c;
typedef Eigen::Map<Vector3c> Vector3cMap;
typedef const Eigen::Map<const Vector3c> Vector3cMapConst;
typedef Eigen::Matrix<uint8_t, 4, 1> Vector4c;
typedef Eigen::Map<Vector4c, Eigen::Aligned> Vector4cMap;
typedef const Eigen::Map<const Vector4c, Eigen::Aligned> Vector4cMapConst;
#define PCL_ADD_UNION_POINT4D \
union EIGEN_ALIGN16 { \
float data[4]; \
struct { \
float x; \
float y; \
float z; \
}; \
};
#define PCL_ADD_EIGEN_MAPS_POINT4D \
inline pcl::Vector3fMap getVector3fMap () { return (pcl::Vector3fMap (data)); } \
inline pcl::Vector3fMapConst getVector3fMap () const { return (pcl::Vector3fMapConst (data)); } \
inline pcl::Vector4fMap getVector4fMap () { return (pcl::Vector4fMap (data)); } \
inline pcl::Vector4fMapConst getVector4fMap () const { return (pcl::Vector4fMapConst (data)); } \
inline pcl::Array3fMap getArray3fMap () { return (pcl::Array3fMap (data)); } \
inline pcl::Array3fMapConst getArray3fMap () const { return (pcl::Array3fMapConst (data)); } \
inline pcl::Array4fMap getArray4fMap () { return (pcl::Array4fMap (data)); } \
inline pcl::Array4fMapConst getArray4fMap () const { return (pcl::Array4fMapConst (data)); }
#define PCL_ADD_POINT4D \
PCL_ADD_UNION_POINT4D \
PCL_ADD_EIGEN_MAPS_POINT4D
#define PCL_ADD_UNION_NORMAL4D \
union EIGEN_ALIGN16 { \
float data_n[4]; \
float normal[3]; \
struct { \
float normal_x; \
float normal_y; \
float normal_z; \
}; \
};
#define PCL_ADD_EIGEN_MAPS_NORMAL4D \
inline pcl::Vector3fMap getNormalVector3fMap () { return (pcl::Vector3fMap (data_n)); } \
inline pcl::Vector3fMapConst getNormalVector3fMap () const { return (pcl::Vector3fMapConst (data_n)); } \
inline pcl::Vector4fMap getNormalVector4fMap () { return (pcl::Vector4fMap (data_n)); } \
inline pcl::Vector4fMapConst getNormalVector4fMap () const { return (pcl::Vector4fMapConst (data_n)); }
#define PCL_ADD_NORMAL4D \
PCL_ADD_UNION_NORMAL4D \
PCL_ADD_EIGEN_MAPS_NORMAL4D
#define PCL_ADD_UNION_RGB \
union \
{ \
union \
{ \
struct \
{ \
uint8_t b; \
uint8_t g; \
uint8_t r; \
uint8_t a; \
}; \
float rgb; \
}; \
uint32_t rgba; \
};
#define PCL_ADD_EIGEN_MAPS_RGB \
inline Eigen::Vector3i getRGBVector3i () { return (Eigen::Vector3i (r, g, b)); } \
inline const Eigen::Vector3i getRGBVector3i () const { return (Eigen::Vector3i (r, g, b)); } \
inline Eigen::Vector4i getRGBVector4i () { return (Eigen::Vector4i (r, g, b, a)); } \
inline const Eigen::Vector4i getRGBVector4i () const { return (Eigen::Vector4i (r, g, b, a)); } \
inline Eigen::Vector4i getRGBAVector4i () { return (Eigen::Vector4i (r, g, b, a)); } \
inline const Eigen::Vector4i getRGBAVector4i () const { return (Eigen::Vector4i (r, g, b, a)); } \
inline pcl::Vector3cMap getBGRVector3cMap () { return (pcl::Vector3cMap (reinterpret_cast<uint8_t*> (&rgba))); } \
inline pcl::Vector3cMapConst getBGRVector3cMap () const { return (pcl::Vector3cMapConst (reinterpret_cast<const uint8_t*> (&rgba))); } \
inline pcl::Vector4cMap getBGRAVector4cMap () { return (pcl::Vector4cMap (reinterpret_cast<uint8_t*> (&rgba))); } \
inline pcl::Vector4cMapConst getBGRAVector4cMap () const { return (pcl::Vector4cMapConst (reinterpret_cast<const uint8_t*> (&rgba))); }
#define PCL_ADD_RGB \
PCL_ADD_UNION_RGB \
PCL_ADD_EIGEN_MAPS_RGB
#define PCL_ADD_INTENSITY \
struct \
{ \
float intensity; \
}; \
#define PCL_ADD_INTENSITY_8U \
struct \
{ \
uint8_t intensity; \
}; \
#define PCL_ADD_INTENSITY_32U \
struct \
{ \
uint32_t intensity; \
}; \
struct _PointXYZ
{
PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZ& p);
/** \brief A point structure representing Euclidean xyz coordinates. (SSE friendly)
* \ingroup common
*/
struct EIGEN_ALIGN16 PointXYZ : public _PointXYZ
{
inline PointXYZ (const _PointXYZ &p)
{
x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
}
inline PointXYZ ()
{
x = y = z = 0.0f;
data[3] = 1.0f;
}
inline PointXYZ (float _x, float _y, float _z)
{
x = _x; y = _y; z = _z;
data[3] = 1.0f;
}
friend std::ostream& operator << (std::ostream& os, const PointXYZ& p);
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
#ifdef RGB
#undef RGB
#endif
struct _RGB
{
PCL_ADD_RGB;
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const RGB& p);
/** \brief A structure representing RGB color information.
*
* The RGBA information is available either as separate r, g, b, or as a
* packed uint32_t rgba value. To pack it, use:
*
* \code
* int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b);
* \endcode
*
* To unpack it use:
*
* \code
* int rgb = ...;
* uint8_t r = (rgb >> 16) & 0x0000ff;
* uint8_t g = (rgb >> 8) & 0x0000ff;
* uint8_t b = (rgb) & 0x0000ff;
* \endcode
*
*/
struct RGB: public _RGB
{
inline RGB (const _RGB &p)
{
rgba = p.rgba;
}
inline RGB ()
{
r = g = b = a = 0;
}
friend std::ostream& operator << (std::ostream& os, const RGB& p);
};
struct _Intensity
{
PCL_ADD_INTENSITY;
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Intensity& p);
/** \brief A point structure representing the grayscale intensity in single-channel images.
* Intensity is represented as a float value.
* \ingroup common
*/
struct Intensity: public _Intensity
{
inline Intensity (const _Intensity &p)
{
intensity = p.intensity;
}
inline Intensity ()
{
intensity = 0.0f;
}
friend std::ostream& operator << (std::ostream& os, const Intensity& p);
};
struct _Intensity8u
{
PCL_ADD_INTENSITY_8U;
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Intensity8u& p);
/** \brief A point structure representing the grayscale intensity in single-channel images.
* Intensity is represented as a uint8_t value.
* \ingroup common
*/
struct Intensity8u: public _Intensity8u
{
inline Intensity8u (const _Intensity8u &p)
{
intensity = p.intensity;
}
inline Intensity8u ()
{
intensity = 0;
}
#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 1101
operator unsigned char() const
{
return intensity;
}
#endif
friend std::ostream& operator << (std::ostream& os, const Intensity8u& p);
};
struct _Intensity32u
{
PCL_ADD_INTENSITY_32U;
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Intensity32u& p);
/** \brief A point structure representing the grayscale intensity in single-channel images.
* Intensity is represented as a uint8_t value.
* \ingroup common
*/
struct Intensity32u: public _Intensity32u
{
inline Intensity32u (const _Intensity32u &p)
{
intensity = p.intensity;
}
inline Intensity32u ()
{
intensity = 0;
}
friend std::ostream& operator << (std::ostream& os, const Intensity32u& p);
};
/** \brief A point structure representing Euclidean xyz coordinates, and the intensity value.
* \ingroup common
*/
struct EIGEN_ALIGN16 _PointXYZI
{
PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
union
{
struct
{
float intensity;
};
float data_c[4];
};
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZI& p);
struct PointXYZI : public _PointXYZI
{
inline PointXYZI (const _PointXYZI &p)
{
x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
intensity = p.intensity;
}
inline PointXYZI ()
{
x = y = z = 0.0f;
data[3] = 1.0f;
intensity = 0.0f;
}
inline PointXYZI (float _intensity)
{
x = y = z = 0.0f;
data[3] = 1.0f;
intensity = _intensity;
}
friend std::ostream& operator << (std::ostream& os, const PointXYZI& p);
};
struct EIGEN_ALIGN16 _PointXYZL
{
PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
uint32_t label;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZL& p);
struct PointXYZL : public _PointXYZL
{
inline PointXYZL (const _PointXYZL &p)
{
x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
label = p.label;
}
inline PointXYZL ()
{
x = y = z = 0.0f;
data[3] = 1.0f;
label = 0;
}
friend std::ostream& operator << (std::ostream& os, const PointXYZL& p);
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Label& p);
struct Label
{
uint32_t label;
friend std::ostream& operator << (std::ostream& os, const Label& p);
};
struct EIGEN_ALIGN16 _PointXYZRGBA
{
PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
PCL_ADD_RGB;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBA& p);
/** \brief A point structure representing Euclidean xyz coordinates, and the RGBA color.
*
* The RGBA information is available either as separate r, g, b, or as a
* packed uint32_t rgba value. To pack it, use:
*
* \code
* int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b);
* \endcode
*
* To unpack it use:
*
* \code
* int rgb = ...;
* uint8_t r = (rgb >> 16) & 0x0000ff;
* uint8_t g = (rgb >> 8) & 0x0000ff;
* uint8_t b = (rgb) & 0x0000ff;
* \endcode
*
* \ingroup common
*/
struct EIGEN_ALIGN16 PointXYZRGBA : public _PointXYZRGBA
{
inline PointXYZRGBA (const _PointXYZRGBA &p)
{
x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
rgba = p.rgba;
}
inline PointXYZRGBA ()
{
x = y = z = 0.0f;
data[3] = 1.0f;
r = g = b = 0;
a = 255;
}
friend std::ostream& operator << (std::ostream& os, const PointXYZRGBA& p);
};
struct EIGEN_ALIGN16 _PointXYZRGB
{
PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
PCL_ADD_RGB;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
struct EIGEN_ALIGN16 _PointXYZRGBL
{
PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
PCL_ADD_RGB;
uint32_t label;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGB& p);
/** \brief A point structure representing Euclidean xyz coordinates, and the RGB color.
*
* Due to historical reasons (PCL was first developed as a ROS package), the
* RGB information is packed into an integer and casted to a float. This is
* something we wish to remove in the near future, but in the meantime, the
* following code snippet should help you pack and unpack RGB colors in your
* PointXYZRGB structure:
*
* \code
* // pack r/g/b into rgb
* uint8_t r = 255, g = 0, b = 0; // Example: Red color
* uint32_t rgb = ((uint32_t)r << 16 | (uint32_t)g << 8 | (uint32_t)b);
* p.rgb = *reinterpret_cast<float*>(&rgb);
* \endcode
*
* To unpack the data into separate values, use:
*
* \code
* PointXYZRGB p;
* // unpack rgb into r/g/b
* uint32_t rgb = *reinterpret_cast<int*>(&p.rgb);
* uint8_t r = (rgb >> 16) & 0x0000ff;
* uint8_t g = (rgb >> 8) & 0x0000ff;
* uint8_t b = (rgb) & 0x0000ff;
* \endcode
*
*
* Alternatively, from 1.1.0 onwards, you can use p.r, p.g, and p.b directly.
*
* \ingroup common
*/
struct EIGEN_ALIGN16 PointXYZRGB : public _PointXYZRGB
{
inline PointXYZRGB (const _PointXYZRGB &p)
{
x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
rgb = p.rgb;
}
inline PointXYZRGB ()
{
x = y = z = 0.0f;
data[3] = 1.0f;
r = g = b = a = 0;
}
inline PointXYZRGB (uint8_t _r, uint8_t _g, uint8_t _b)
{
x = y = z = 0.0f;
data[3] = 1.0f;
r = _r;
g = _g;
b = _b;
a = 0;
}
friend std::ostream& operator << (std::ostream& os, const PointXYZRGB& p);
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBL& p);
struct EIGEN_ALIGN16 PointXYZRGBL : public _PointXYZRGBL
{
inline PointXYZRGBL (const _PointXYZRGBL &p)
{
x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
rgba = p.rgba;
label = p.label;
}
inline PointXYZRGBL ()
{
x = y = z = 0.0f;
data[3] = 1.0f;
r = g = b = 0;
a = 0;
label = 255;
}
inline PointXYZRGBL (uint8_t _r, uint8_t _g, uint8_t _b, uint32_t _label)
{
x = y = z = 0.0f;
data[3] = 1.0f;
r = _r;
g = _g;
b = _b;
a = 0;
label = _label;
}
friend std::ostream& operator << (std::ostream& os, const PointXYZRGBL& p);
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
struct _PointXYZHSV
{
PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
union
{
struct
{
float h;
float s;
float v;
};
float data_c[4];
};
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
} EIGEN_ALIGN16;
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZHSV& p);
struct EIGEN_ALIGN16 PointXYZHSV : public _PointXYZHSV
{
inline PointXYZHSV (const _PointXYZHSV &p)
{
x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
h = p.h; s = p.s; v = p.v;
}
inline PointXYZHSV ()
{
x = y = z = 0.0f;
data[3] = 1.0f;
h = s = v = data_c[3] = 0;
}
inline PointXYZHSV (float _h, float _v, float _s)
{
x = y = z = 0.0f;
data[3] = 1.0f;
h = _h; v = _v; s = _s;
data_c[3] = 0;
}
friend std::ostream& operator << (std::ostream& os, const PointXYZHSV& p);
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXY& p);
/** \brief A 2D point structure representing Euclidean xy coordinates.
* \ingroup common
*/
struct PointXY
{
float x;
float y;
friend std::ostream& operator << (std::ostream& os, const PointXY& p);
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointUV& p);
/** \brief A 2D point structure representing pixel image coordinates.
* \note We use float to be able to represent subpixels.
* \ingroup common
*/
struct PointUV
{
float u;
float v;
friend std::ostream& operator << (std::ostream& os, const PointUV& p);
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const InterestPoint& p);
/** \brief A point structure representing an interest point with Euclidean xyz coordinates, and an interest value.
* \ingroup common
*/
struct EIGEN_ALIGN16 InterestPoint
{
PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
union
{
struct
{
float strength;
};
float data_c[4];
};
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
friend std::ostream& operator << (std::ostream& os, const InterestPoint& p);
};
struct EIGEN_ALIGN16 _Normal
{
PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
union
{
struct
{
float curvature;
};
float data_c[4];
};
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Normal& p);
/** \brief A point structure representing normal coordinates and the surface curvature estimate. (SSE friendly)
* \ingroup common
*/
struct Normal : public _Normal
{
inline Normal (const _Normal &p)
{
normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z;
data_n[3] = 0.0f;
curvature = p.curvature;
}
inline Normal ()
{
normal_x = normal_y = normal_z = data_n[3] = 0.0f;
curvature = 0;
}
inline Normal (float n_x, float n_y, float n_z)
{
normal_x = n_x; normal_y = n_y; normal_z = n_z;
curvature = 0;
data_n[3] = 0.0f;
}
friend std::ostream& operator << (std::ostream& os, const Normal& p);
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
struct EIGEN_ALIGN16 _Axis
{
PCL_ADD_NORMAL4D;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const Axis& p);
/** \brief A point structure representing an Axis using its normal coordinates. (SSE friendly)
* \ingroup common
*/
struct EIGEN_ALIGN16 Axis : public _Axis
{
inline Axis (const _Axis &p)
{
normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z;
data_n[3] = 0.0f;
}
inline Axis ()
{
normal_x = normal_y = normal_z = data_n[3] = 0.0f;
}
inline Axis (float n_x, float n_y, float n_z)
{
normal_x = n_x; normal_y = n_y; normal_z = n_z;
data_n[3] = 0.0f;
}
friend std::ostream& operator << (std::ostream& os, const Axis& p);
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
struct EIGEN_ALIGN16 _PointNormal
{
PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
union
{
struct
{
float curvature;
};
float data_c[4];
};
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointNormal& p);
/** \brief A point structure representing Euclidean xyz coordinates, together with normal coordinates and the surface curvature estimate. (SSE friendly)
* \ingroup common
*/
struct PointNormal : public _PointNormal
{
inline PointNormal (const _PointNormal &p)
{
x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z; data_n[3] = 0.0f;
curvature = p.curvature;
}
inline PointNormal ()
{
x = y = z = 0.0f;
data[3] = 1.0f;
normal_x = normal_y = normal_z = data_n[3] = 0.0f;
}
friend std::ostream& operator << (std::ostream& os, const PointNormal& p);
};
struct EIGEN_ALIGN16 _PointXYZRGBNormal
{
PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
union
{
struct
{
PCL_ADD_UNION_RGB;
float curvature;
};
float data_c[4];
};
PCL_ADD_EIGEN_MAPS_RGB;
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZRGBNormal& p);
/** \brief A point structure representing Euclidean xyz coordinates, and the RGB color, together with normal coordinates and the surface curvature estimate.
* Due to historical reasons (PCL was first developed as a ROS package), the
* RGB information is packed into an integer and casted to a float. This is
* something we wish to remove in the near future, but in the meantime, the
* following code snippet should help you pack and unpack RGB colors in your
* PointXYZRGB structure:
*
* \code
* // pack r/g/b into rgb
* uint8_t r = 255, g = 0, b = 0; // Example: Red color
* uint32_t rgb = ((uint32_t)r << 16 | (uint32_t)g << 8 | (uint32_t)b);
* p.rgb = *reinterpret_cast<float*>(&rgb);
* \endcode
*
* To unpack the data into separate values, use:
*
* \code
* PointXYZRGB p;
* // unpack rgb into r/g/b
* uint32_t rgb = *reinterpret_cast<int*>(&p.rgb);
* uint8_t r = (rgb >> 16) & 0x0000ff;
* uint8_t g = (rgb >> 8) & 0x0000ff;
* uint8_t b = (rgb) & 0x0000ff;
* \endcode
*
*
* Alternatively, from 1.1.0 onwards, you can use p.r, p.g, and p.b directly.
* \ingroup common
*/
struct PointXYZRGBNormal : public _PointXYZRGBNormal
{
inline PointXYZRGBNormal (const _PointXYZRGBNormal &p)
{
x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z; data_n[3] = 0.0f;
curvature = p.curvature;
rgba = p.rgba;
}
inline PointXYZRGBNormal ()
{
x = y = z = 0.0f;
data[3] = 1.0f;
r = g = b = a = 0;
normal_x = normal_y = normal_z = data_n[3] = 0.0f;
curvature = 0;
}
friend std::ostream& operator << (std::ostream& os, const PointXYZRGBNormal& p);
};
struct EIGEN_ALIGN16 _PointXYZINormal
{
PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
union
{
struct
{
float intensity;
float curvature;
};
float data_c[4];
};
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
PCL_EXPORTS std::ostream& operator << (std::ostream& os, const PointXYZINormal& p);
/** \brief A point structure representing Euclidean xyz coordinates, intensity, together with normal coordinates and the surface curvature estimate.
* \ingroup common
*/
struct PointXYZINormal : public _PointXYZINormal
{
inline PointXYZINormal (const _PointXYZINormal &p)
{
x = p.x; y = p.y; z = p.z; data[3] = 1.0f;
normal_x = p.normal_x; normal_y = p.normal_y; normal_z = p.normal_z; data_n[3] = 0.0f;
curvature = p.curvature;
intensity = p.intensity;
}
inline PointXYZINormal ()
{
x = y = z = 0.0f;
data[3] = 1.0f;
normal_x = normal_y = normal_z = data_n[3] = 0.0f;
intensity = 0.0f;
curvature = 0;
}
friend std::ostream& operator << (std::ostream& os, const PointXYZINormal& p);
};
//----
struct EIGEN_ALIGN16 _PointXYZLNormal
{
PCL_ADD_POINT4D; // This adds the members x,y,z which can also be accessed using the point (which is float[4])
PCL_ADD_NORMAL4D; // This adds the member normal[3] which can also be accessed using the point (which is float[4])
union
{
struct
{
uint32_t label;
float curvature;
};
float data_c[4];
};