@@ -204,6 +204,8 @@ namespace pcl
204204 using Ptr = shared_ptr<DefaultPointRepresentation<PointDefault> >;
205205 using ConstPtr = shared_ptr<const DefaultPointRepresentation<PointDefault> >;
206206
207+ static constexpr const std::int32_t NR_DIMS = std::min<std::int32_t >(sizeof (PointDefault) / sizeof (float ), 3 );
208+
207209 DefaultPointRepresentation ()
208210 {
209211 // If point type is unknown, assume it's a struct/array of floats, and compute the number of dimensions
@@ -312,6 +314,8 @@ namespace pcl
312314 using ConstPtr = shared_ptr<const DefaultFeatureRepresentation<PointDefault>>;
313315 using FieldList = typename pcl::traits::fieldList<PointDefault>::type;
314316
317+ static constexpr const std::int32_t NR_DIMS = pcl::detail::traits::descriptorSize_v<PointDefault>; // TODO is this correct?
318+
315319 DefaultFeatureRepresentation ()
316320 {
317321 nr_dimensions_ = 0 ; // zero-out the nr_dimensions_ before it gets incremented
@@ -336,9 +340,11 @@ namespace pcl
336340 class DefaultPointRepresentation <PointXYZ> : public PointRepresentation <PointXYZ>
337341 {
338342 public:
343+ static constexpr const std::int32_t NR_DIMS = 3 ;
344+
339345 DefaultPointRepresentation ()
340346 {
341- nr_dimensions_ = 3 ;
347+ nr_dimensions_ = NR_DIMS ;
342348 trivial_ = true ;
343349 }
344350
@@ -356,9 +362,11 @@ namespace pcl
356362 class DefaultPointRepresentation <PointXYZI> : public PointRepresentation <PointXYZI>
357363 {
358364 public:
365+ static constexpr const std::int32_t NR_DIMS = 3 ;
366+
359367 DefaultPointRepresentation ()
360368 {
361- nr_dimensions_ = 3 ;
369+ nr_dimensions_ = NR_DIMS ;
362370 trivial_ = true ;
363371 }
364372
@@ -377,9 +385,11 @@ namespace pcl
377385 class DefaultPointRepresentation <PointNormal> : public PointRepresentation <PointNormal>
378386 {
379387 public:
388+ static constexpr const std::int32_t NR_DIMS = 3 ;
389+
380390 DefaultPointRepresentation ()
381391 {
382- nr_dimensions_ = 3 ;
392+ nr_dimensions_ = NR_DIMS ;
383393 trivial_ = true ;
384394 }
385395
@@ -404,12 +414,14 @@ namespace pcl
404414
405415 // ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
406416 template <>
407- class DefaultPointRepresentation <PPFSignature> : public DefaultFeatureRepresentation <PPFSignature>
417+ class DefaultPointRepresentation <PPFSignature> : public PointRepresentation <PPFSignature>
408418 {
409419 public:
420+ static constexpr const std::int32_t NR_DIMS = 4 ;
421+
410422 DefaultPointRepresentation ()
411423 {
412- nr_dimensions_ = 4 ;
424+ nr_dimensions_ = NR_DIMS ;
413425 trivial_ = true ;
414426 }
415427
@@ -453,9 +465,11 @@ namespace pcl
453465 class DefaultPointRepresentation <Narf36> : public PointRepresentation <Narf36>
454466 {
455467 public:
468+ static constexpr const std::int32_t NR_DIMS = 36 ;
469+
456470 DefaultPointRepresentation ()
457471 {
458- nr_dimensions_ = 36 ;
472+ nr_dimensions_ = NR_DIMS ;
459473 trivial_=false ;
460474 }
461475
@@ -476,9 +490,11 @@ namespace pcl
476490 class DefaultPointRepresentation <ShapeContext1980> : public PointRepresentation<ShapeContext1980>
477491 {
478492 public:
493+ static constexpr const std::int32_t NR_DIMS = 1980 ;
494+
479495 DefaultPointRepresentation ()
480496 {
481- nr_dimensions_ = 1980 ;
497+ nr_dimensions_ = NR_DIMS ;
482498 }
483499
484500 void
@@ -494,9 +510,11 @@ namespace pcl
494510 class DefaultPointRepresentation <UniqueShapeContext1960> : public PointRepresentation<UniqueShapeContext1960>
495511 {
496512 public:
513+ static constexpr const std::int32_t NR_DIMS = 1960 ;
514+
497515 DefaultPointRepresentation ()
498516 {
499- nr_dimensions_ = 1960 ;
517+ nr_dimensions_ = NR_DIMS ;
500518 }
501519
502520 void
@@ -512,9 +530,11 @@ namespace pcl
512530 class DefaultPointRepresentation <SHOT352> : public PointRepresentation<SHOT352>
513531 {
514532 public:
533+ static constexpr const std::int32_t NR_DIMS = 352 ;
534+
515535 DefaultPointRepresentation ()
516536 {
517- nr_dimensions_ = 352 ;
537+ nr_dimensions_ = NR_DIMS ;
518538 }
519539
520540 void
@@ -530,9 +550,11 @@ namespace pcl
530550 class DefaultPointRepresentation <SHOT1344> : public PointRepresentation<SHOT1344>
531551 {
532552 public:
553+ static constexpr const std::int32_t NR_DIMS = 1344 ;
554+
533555 DefaultPointRepresentation ()
534556 {
535- nr_dimensions_ = 1344 ;
557+ nr_dimensions_ = NR_DIMS ;
536558 }
537559
538560 void
0 commit comments