39 #ifndef PCL_POINT_REPRESENTATION_H_
40 #define PCL_POINT_REPRESENTATION_H_
54 template <
typename Po
intT>
61 std::vector<float> alpha_;
74 typedef boost::shared_ptr<PointRepresentation<PointT> >
Ptr;
75 typedef boost::shared_ptr<const PointRepresentation<PointT> >
ConstPtr;
96 inline bool isTrivial()
const {
return trivial_ && alpha_.empty (); }
104 bool is_valid =
true;
108 const float* temp =
reinterpret_cast<const float*
>(&p);
110 for (
int i = 0; i < nr_dimensions_; ++i)
121 float *temp =
new float[nr_dimensions_];
124 for (
int i = 0; i < nr_dimensions_; ++i)
141 template <
typename OutputType>
void
144 float *temp =
new float[nr_dimensions_];
148 for (
int i = 0; i < nr_dimensions_; ++i)
153 for (
int i = 0; i < nr_dimensions_; ++i)
154 out[i] = temp[i] * alpha_[i];
165 alpha_.resize (nr_dimensions_);
166 for (
int i = 0; i < nr_dimensions_; ++i)
167 alpha_[i] = rescale_array[i];
177 template <
typename Po
intDefault>
185 typedef boost::shared_ptr<DefaultPointRepresentation<PointDefault> >
Ptr;
186 typedef boost::shared_ptr<const DefaultPointRepresentation<PointDefault> >
ConstPtr;
191 nr_dimensions_ =
sizeof (PointDefault) /
sizeof (
float);
193 if (nr_dimensions_ > 3) nr_dimensions_ = 3;
210 const float* ptr =
reinterpret_cast<const float*
> (&p);
211 for (
int i = 0; i < nr_dimensions_; ++i)
220 template <
typename Po
intDefault>
227 struct IncrementFunctor
229 IncrementFunctor (
int &n) : n_ (n)
234 template<
typename Key>
inline void operator () ()
243 struct NdCopyPointFunctor
247 NdCopyPointFunctor (
const PointDefault &p1,
float * p2)
248 : p1_ (reinterpret_cast<const Pod&>(p1)), p2_ (p2), f_idx_ (0) { }
250 template<
typename Key>
inline void operator() ()
258 template <
typename Key,
typename FieldT,
int NrDims>
263 const uint8_t * data_ptr =
reinterpret_cast<const uint8_t *
> (&p1) +
265 p2[f_idx++] = *
reinterpret_cast<const FieldT*
> (data_ptr);
269 template <
typename Key,
typename FieldT,
int NrDims>
270 struct Helper<Key, FieldT[NrDims], NrDims>
274 const uint8_t * data_ptr =
reinterpret_cast<const uint8_t *
> (&p1) +
276 int nr_dims = NrDims;
277 const FieldT * array =
reinterpret_cast<const FieldT *
> (data_ptr);
278 for (
int i = 0; i < nr_dims; ++i)
280 p2[f_idx++] = array[i];
293 typedef typename boost::shared_ptr<DefaultFeatureRepresentation<PointDefault> >
Ptr;
294 typedef typename boost::shared_ptr<const DefaultFeatureRepresentation<PointDefault> >
ConstPtr;
300 pcl::for_each_type <FieldList> (IncrementFunctor (nr_dimensions_));
312 pcl::for_each_type <FieldList> (NdCopyPointFunctor (p, out));
430 nr_dimensions_ = 1980;
436 for (
int i = 0; i < nr_dimensions_; ++i)
444 PCL_DEPRECATED_CLASS (DefaultPointRepresentation,
"SHOT POINT IS DEPRECATED, USE SHOT352 FOR SHAPE AND SHOT1344 FOR SHAPE+COLOR INSTEAD")
446 :
public PointRepresentation<SHOT>
449 DefaultPointRepresentation ()
451 nr_dimensions_ = 352;
457 for (
int i = 0; i < nr_dimensions_; ++i)
469 nr_dimensions_ = 352;
475 for (
int i = 0; i < nr_dimensions_; ++i)
487 nr_dimensions_ = 1344;
493 for (
int i = 0; i < nr_dimensions_; ++i)
502 template <
typename Po
intDefault>
509 typedef boost::shared_ptr<CustomPointRepresentation<PointDefault> >
Ptr;
510 typedef boost::shared_ptr<const CustomPointRepresentation<PointDefault> >
ConstPtr;
517 : max_dim_(max_dim), start_dim_(start_dim)
520 nr_dimensions_ =
static_cast<int> (
sizeof (PointDefault) /
sizeof (
float)) - start_dim_;
522 if (nr_dimensions_ > max_dim_)
523 nr_dimensions_ = max_dim_;
540 const float *ptr = (
reinterpret_cast<const float*
> (&p)) + start_dim_;
541 for (
int i = 0; i < nr_dimensions_; ++i)
553 #endif // #ifndef PCL_POINT_REPRESENTATION_H_