MRSL DecompUtil Library  0.1
An implementaion of convex decomposition over point cloud
data_utils.h
Go to the documentation of this file.
1 
5 #ifndef DATA_UTILS_H
6 #define DATA_UTILS_H
7 
9 
11 template <class T, class TF>
12 vec_E<T> transform_vec(const vec_E<T> &t, const TF &tf) {
13  vec_E<T> new_t;
14  for (const auto &it : t)
15  new_t.push_back(tf * it);
16  return new_t;
17 }
18 
20 template <class T>
22  decimal_t dist = 0;
23  for(unsigned int i = 1; i < vs.size(); i++)
24  dist += (vs[i] - vs[i-1]).norm();
25 
26  return dist;
27 }
28 
29 
31 #define transform_vec3 transform_vec<Vec3f, Aff3f>
32 #define total_distance3f total_distance<Vec3f>
34 #define total_distance3i total_distance<Vec3i>
36 #endif
vec_E< T > transform_vec(const vec_E< T > &t, const TF &tf)
Template for transforming a vector.
Definition: data_utils.h:12
decimal_t total_distance(const vec_E< T > &vs)
Template for calculating distance.
Definition: data_utils.h:21
double decimal_t
Rename the float type used in lib.
Definition: data_type.h:50
std::vector< T, Eigen::aligned_allocator< T >> vec_E
Pre-allocated std::vector for Eigen using vec_E.
Definition: data_type.h:54
Defines all data types used in this lib.