MRSL DecompUtil Library  0.1
An implementaion of convex decomposition over point cloud
data_type.h
Go to the documentation of this file.
1 
8 #include <stdio.h>
9 #include <math.h>
10 #include <limits>
11 #include <vector>
12 #include <Eigen/Geometry>
13 #include <Eigen/StdVector>
14 
16 #ifndef ANSI_COLOR_RED
17 #define ANSI_COLOR_RED "\x1b[1;31m"
18 #endif
19 #ifndef ANSI_COLOR_GREEN
21 #define ANSI_COLOR_GREEN "\x1b[1;32m"
22 #endif
23 #ifndef ANSI_COLOR_YELLOW
25 #define ANSI_COLOR_YELLOW "\x1b[1;33m"
26 #endif
27 #ifndef ANSI_COLOR_BLUE
29 #define ANSI_COLOR_BLUE "\x1b[1;34m"
30 #endif
31 #ifndef ANSI_COLOR_MAGENTA
33 #define ANSI_COLOR_MAGENTA "\x1b[1;35m"
34 #endif
35 #ifndef ANSI_COLOR_CYAN
37 #define ANSI_COLOR_CYAN "\x1b[1;36m"
38 #endif
39 #ifndef ANSI_COLOR_RESET
41 #define ANSI_COLOR_RESET "\x1b[0m"
42 #endif
43 
44 #ifndef DATA_TYPE_H
45 #define DATA_TYPE_H
46 
50 typedef double decimal_t;
51 
53 template <typename T>
54 using vec_E = std::vector<T, Eigen::aligned_allocator<T>>;
56 template <int N>
57 using Vecf = Eigen::Matrix<decimal_t, N, 1>;
59 template <int N>
60 using Veci = Eigen::Matrix<int, N, 1>;
62 template <int M, int N>
63 using Matf = Eigen::Matrix<decimal_t, M, N>;
65 template <int N>
66 using MatDNf = Eigen::Matrix<decimal_t, Eigen::Dynamic, N>;
68 template <int N>
71 template <int N>
73 
75 typedef Vecf<2> Vec2f;
77 typedef Veci<2> Vec2i;
79 typedef Vecf<3> Vec3f;
81 typedef Veci<3> Vec3i;
83 typedef Vecf<4> Vec4f;
85 typedef Vecf<6> Vec6f;
86 
95 
97 typedef Matf<2, 2> Mat2f;
99 typedef Matf<3, 3> Mat3f;
104 
113 
115 typedef Eigen::Transform<decimal_t, 2, Eigen::Affine> Aff2f;
117 typedef Eigen::Transform<decimal_t, 3, Eigen::Affine> Aff3f;
118 
120 typedef Eigen::Quaternion<decimal_t> Quatf;
121 #endif
122 
123 #ifndef EIGEN_EPSILON
124 #define EIGEN_EPSILON
125 constexpr decimal_t epsilon_ = 1e-10; // numerical calculation error
127 #endif
Matf< Eigen::Dynamic, Eigen::Dynamic > MatDf
Dynamic MxN Eigen float matrix.
Definition: data_type.h:112
vec_E< Vecf< N >> vec_Vecf
Vector of Eigen 1D float vector.
Definition: data_type.h:69
Matf< 3, 3 > Mat3f
3x3 Matrix in float
Definition: data_type.h:99
MatDNf< 2 > MatD2f
Nx2 Eigen float matrix.
Definition: data_type.h:108
MatDNf< 3 > MatD3f
Nx3 Eigen float matrix.
Definition: data_type.h:110
constexpr decimal_t epsilon_
Compensate for numerical error.
Definition: data_type.h:126
Vecf< Eigen::Dynamic > VecDf
Dynamic Nx1 Eigen float vector.
Definition: data_type.h:106
Eigen::Matrix< decimal_t, Eigen::Dynamic, N > MatDNf
MxN Eigen matrix with M unknown.
Definition: data_type.h:66
Vecf< 3 > Vec3f
Eigen 1D float vector of size 3.
Definition: data_type.h:79
Matf< 2, 2 > Mat2f
2x2 Matrix in float
Definition: data_type.h:97
Matf< 4, 4 > Mat4f
4x4 Matrix in float
Definition: data_type.h:101
Eigen::Matrix< decimal_t, M, N > Matf
MxN Eigen matrix.
Definition: data_type.h:63
Eigen::Matrix< int, N, 1 > Veci
Eigen 1D int vector.
Definition: data_type.h:60
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
Matf< 6, 6 > Mat6f
6x6 Matrix in float
Definition: data_type.h:103
Eigen::Transform< decimal_t, 3, Eigen::Affine > Aff3f
Allias of Eigen::Affine3d.
Definition: data_type.h:117
Vecf< 2 > Vec2f
Eigen 1D float vector of size 2.
Definition: data_type.h:75
Vecf< 6 > Vec6f
Column vector in float of size 6.
Definition: data_type.h:85
vec_E< Vec3i > vec_Vec3i
Vector of type Vec3i.
Definition: data_type.h:94
Eigen::Quaternion< decimal_t > Quatf
Allias of Eigen::Quaterniond.
Definition: data_type.h:120
Eigen::Matrix< decimal_t, N, 1 > Vecf
Eigen 1D float vector.
Definition: data_type.h:57
Vecf< 4 > Vec4f
Eigen 1D float vector of size 4.
Definition: data_type.h:83
vec_E< Vec3f > vec_Vec3f
Vector of type Vec3f.
Definition: data_type.h:92
vec_E< Vec2i > vec_Vec2i
Vector of type Vec2i.
Definition: data_type.h:90
Veci< 3 > Vec3i
Eigen 1D int vector of size 3.
Definition: data_type.h:81
Eigen::Transform< decimal_t, 2, Eigen::Affine > Aff2f
Allias of Eigen::Affine2d.
Definition: data_type.h:115
Veci< 2 > Vec2i
Eigen 1D int vector of size 2.
Definition: data_type.h:77
vec_E< Vec2f > vec_Vec2f
Vector of type Vec2f.
Definition: data_type.h:88
vec_E< Veci< N >> vec_Veci
Vector of Eigen 1D int vector.
Definition: data_type.h:72