Rigid Body Dynamics Library
rbdl_eigenmath.h
Go to the documentation of this file.
1/*
2 * RBDL - Rigid Body Dynamics Library
3 * Copyright (c) 2011-2018 Martin Felis <martin@fysx.org>
4 *
5 * Licensed under the zlib license. See LICENSE for more details.
6 */
7
8#ifndef RBDL_EIGENMATH_H
9#define RBDL_EIGENMATH_H
10
11/* Exporting templated symbols is tricky when using MSVC. The following lines
12 * causes the classes in this file not to be explicitly exported. Instead
13 * they are already implicitly exported.
14 */
15#define RBDL_TEMPLATE_DLLAPI
16
17EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Eigen::Vector2d)
18EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Eigen::Vector3d)
19EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Eigen::Matrix3d)
20EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Eigen::Vector4d)
21EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Eigen::MatrixXd)
22
23class RBDL_TEMPLATE_DLLAPI Vector2_t : public Eigen::Vector2d
24{
25 public:
26 typedef Eigen::Vector2d Base;
27
28 template<typename OtherDerived>
29 Vector2_t(const Eigen::MatrixBase<OtherDerived>& other)
30 : Eigen::Vector2d(other)
31 {}
32
33 template<typename OtherDerived>
34 Vector2_t& operator=(const Eigen::MatrixBase<OtherDerived>& other)
35 {
36 this->Base::operator=(other);
37 return *this;
38 }
39
40 EIGEN_STRONG_INLINE Vector2_t()
41 {}
42
43 EIGEN_STRONG_INLINE Vector2_t(
44 const double& v0, const double& v1
45 )
46 {
47 Base::_check_template_params();
48
49 (*this) << v0, v1;
50 }
51
52 void set(const double& v0, const double& v1)
53 {
54 Base::_check_template_params();
55
56 (*this) << v0, v1;
57 }
58};
59
60class RBDL_TEMPLATE_DLLAPI Vector3_t : public Eigen::Vector3d
61{
62 public:
64
65 template<typename OtherDerived>
66 Vector3_t(const Eigen::MatrixBase<OtherDerived>& other)
67 : Eigen::Vector3d(other)
68 {}
69
70 template<typename OtherDerived>
71 Vector3_t& operator=(const Eigen::MatrixBase<OtherDerived>& other)
72 {
73 this->Base::operator=(other);
74 return *this;
75 }
76
77 EIGEN_STRONG_INLINE Vector3_t()
78 {}
79
80 EIGEN_STRONG_INLINE Vector3_t(
81 const double& v0, const double& v1, const double& v2
82 )
83 {
84 Base::_check_template_params();
85
86 (*this) << v0, v1, v2;
87 }
88
89 void set(const double& v0, const double& v1, const double& v2)
90 {
91 Base::_check_template_params();
92
93 (*this) << v0, v1, v2;
94 }
95};
96
97class RBDL_TEMPLATE_DLLAPI Matrix3_t : public Eigen::Matrix3d
98{
99 public:
101
102 template<typename OtherDerived>
103 Matrix3_t(const Eigen::MatrixBase<OtherDerived>& other)
104 : Eigen::Matrix3d(other)
105 {}
106
107 template<typename OtherDerived>
108 Matrix3_t& operator=(const Eigen::MatrixBase<OtherDerived>& other)
109 {
110 this->Base::operator=(other);
111 return *this;
112 }
113
114 EIGEN_STRONG_INLINE Matrix3_t()
115 {}
116
117 EIGEN_STRONG_INLINE Matrix3_t(
118 const double& m00, const double& m01, const double& m02,
119 const double& m10, const double& m11, const double& m12,
120 const double& m20, const double& m21, const double& m22
121 )
122 {
123 Base::_check_template_params();
124
125 (*this)
126 << m00, m01, m02,
127 m10, m11, m12,
128 m20, m21, m22
129 ;
130 }
131};
132
133class RBDL_TEMPLATE_DLLAPI Vector4_t : public Eigen::Vector4d
134{
135 public:
137
138 template<typename OtherDerived>
139 Vector4_t(const Eigen::MatrixBase<OtherDerived>& other)
140 : Eigen::Vector4d(other)
141 {}
142
143 template<typename OtherDerived>
144 Vector4_t& operator=(const Eigen::MatrixBase<OtherDerived>& other)
145 {
146 this->Base::operator=(other);
147 return *this;
148 }
149
150 EIGEN_STRONG_INLINE Vector4_t()
151 {}
152
153 EIGEN_STRONG_INLINE Vector4_t(
154 const double& v0, const double& v1, const double& v2, const double& v3
155 )
156 {
157 Base::_check_template_params();
158
159 (*this) << v0, v1, v2, v3;
160 }
161
162 void set(const double& v0, const double& v1, const double& v2, const double& v3)
163 {
164 Base::_check_template_params();
165
166 (*this) << v0, v1, v2, v3;
167 }
168};
169
170class RBDL_TEMPLATE_DLLAPI SpatialVector_t : public Eigen::Matrix<double, 6, 1>
171{
172 public:
173 typedef Eigen::Matrix<double, 6, 1> Base;
174
175 template<typename OtherDerived>
176 SpatialVector_t(const Eigen::MatrixBase<OtherDerived>& other)
177 : Eigen::Matrix<double, 6, 1>(other)
178 {}
179
180 template<typename OtherDerived>
181 SpatialVector_t& operator=(const Eigen::MatrixBase<OtherDerived>& other)
182 {
183 this->Base::operator=(other);
184 return *this;
185 }
186
187 EIGEN_STRONG_INLINE SpatialVector_t()
188 {}
189
190 EIGEN_STRONG_INLINE SpatialVector_t(
191 const double& v0, const double& v1, const double& v2,
192 const double& v3, const double& v4, const double& v5
193 )
194 {
195 Base::_check_template_params();
196
197 (*this) << v0, v1, v2, v3, v4, v5;
198 }
199
200 void set(
201 const double& v0, const double& v1, const double& v2,
202 const double& v3, const double& v4, const double& v5
203 )
204 {
205 Base::_check_template_params();
206
207 (*this) << v0, v1, v2, v3, v4, v5;
208 }
209};
210
211class RBDL_TEMPLATE_DLLAPI Matrix4_t : public Eigen::Matrix<double, 4, 4>
212{
213 public:
214 typedef Eigen::Matrix<double, 4, 4> Base;
215
216 template<typename OtherDerived>
217 Matrix4_t(const Eigen::MatrixBase<OtherDerived>& other)
218 : Eigen::Matrix<double, 4, 4>(other)
219 {}
220
221 template<typename OtherDerived>
222 Matrix4_t& operator=(const Eigen::MatrixBase<OtherDerived>& other)
223 {
224 this->Base::operator=(other);
225 return *this;
226 }
227
228 EIGEN_STRONG_INLINE Matrix4_t()
229 {}
230
231 EIGEN_STRONG_INLINE Matrix4_t(
232 const Scalar& m00, const Scalar& m01, const Scalar& m02, const Scalar& m03,
233 const Scalar& m10, const Scalar& m11, const Scalar& m12, const Scalar& m13,
234 const Scalar& m20, const Scalar& m21, const Scalar& m22, const Scalar& m23,
235 const Scalar& m30, const Scalar& m31, const Scalar& m32, const Scalar& m33
236 )
237 {
238 Base::_check_template_params();
239
240 (*this)
241 << m00, m01, m02, m03
242 , m10, m11, m12, m13
243 , m20, m21, m22, m23
244 , m30, m31, m32, m33
245 ;
246 }
247
248 void set(
249 const Scalar& m00, const Scalar& m01, const Scalar& m02, const Scalar& m03,
250 const Scalar& m10, const Scalar& m11, const Scalar& m12, const Scalar& m13,
251 const Scalar& m20, const Scalar& m21, const Scalar& m22, const Scalar& m23,
252 const Scalar& m30, const Scalar& m31, const Scalar& m32, const Scalar& m33
253 )
254 {
255 Base::_check_template_params();
256
257 (*this)
258 << m00, m01, m02, m03
259 , m10, m11, m12, m13
260 , m20, m21, m22, m23
261 , m30, m31, m32, m33
262 ;
263 }
264};
265
266class RBDL_TEMPLATE_DLLAPI SpatialMatrix_t : public Eigen::Matrix<double, 6, 6>
267{
268 public:
269 typedef Eigen::Matrix<double, 6, 6> Base;
270
271 template<typename OtherDerived>
272 SpatialMatrix_t(const Eigen::MatrixBase<OtherDerived>& other)
273 : Eigen::Matrix<double, 6, 6>(other)
274 {}
275
276 template<typename OtherDerived>
277 SpatialMatrix_t& operator=(const Eigen::MatrixBase<OtherDerived>& other)
278 {
279 this->Base::operator=(other);
280 return *this;
281 }
282
283 EIGEN_STRONG_INLINE SpatialMatrix_t()
284 {}
285
286 EIGEN_STRONG_INLINE SpatialMatrix_t(
287 const Scalar& m00, const Scalar& m01, const Scalar& m02, const Scalar& m03, const Scalar& m04, const Scalar& m05,
288 const Scalar& m10, const Scalar& m11, const Scalar& m12, const Scalar& m13, const Scalar& m14, const Scalar& m15,
289 const Scalar& m20, const Scalar& m21, const Scalar& m22, const Scalar& m23, const Scalar& m24, const Scalar& m25,
290 const Scalar& m30, const Scalar& m31, const Scalar& m32, const Scalar& m33, const Scalar& m34, const Scalar& m35,
291 const Scalar& m40, const Scalar& m41, const Scalar& m42, const Scalar& m43, const Scalar& m44, const Scalar& m45,
292 const Scalar& m50, const Scalar& m51, const Scalar& m52, const Scalar& m53, const Scalar& m54, const Scalar& m55
293 )
294 {
295 Base::_check_template_params();
296
297 (*this)
298 << m00, m01, m02, m03, m04, m05
299 , m10, m11, m12, m13, m14, m15
300 , m20, m21, m22, m23, m24, m25
301 , m30, m31, m32, m33, m34, m35
302 , m40, m41, m42, m43, m44, m45
303 , m50, m51, m52, m53, m54, m55
304 ;
305 }
306
307 void set(
308 const Scalar& m00, const Scalar& m01, const Scalar& m02, const Scalar& m03, const Scalar& m04, const Scalar& m05,
309 const Scalar& m10, const Scalar& m11, const Scalar& m12, const Scalar& m13, const Scalar& m14, const Scalar& m15,
310 const Scalar& m20, const Scalar& m21, const Scalar& m22, const Scalar& m23, const Scalar& m24, const Scalar& m25,
311 const Scalar& m30, const Scalar& m31, const Scalar& m32, const Scalar& m33, const Scalar& m34, const Scalar& m35,
312 const Scalar& m40, const Scalar& m41, const Scalar& m42, const Scalar& m43, const Scalar& m44, const Scalar& m45,
313 const Scalar& m50, const Scalar& m51, const Scalar& m52, const Scalar& m53, const Scalar& m54, const Scalar& m55
314 )
315 {
316 Base::_check_template_params();
317
318 (*this)
319 << m00, m01, m02, m03, m04, m05
320 , m10, m11, m12, m13, m14, m15
321 , m20, m21, m22, m23, m24, m25
322 , m30, m31, m32, m33, m34, m35
323 , m40, m41, m42, m43, m44, m45
324 , m50, m51, m52, m53, m54, m55
325 ;
326 }
327};
328
329/* _RBDL_EIGENMATH_H */
330#endif
Eigen::Matrix3d Base
Matrix3_t(const Eigen::MatrixBase< OtherDerived > &other)
EIGEN_STRONG_INLINE Matrix3_t(const double &m00, const double &m01, const double &m02, const double &m10, const double &m11, const double &m12, const double &m20, const double &m21, const double &m22)
Matrix3_t & operator=(const Eigen::MatrixBase< OtherDerived > &other)
EIGEN_STRONG_INLINE Matrix3_t()
void set(const Scalar &m00, const Scalar &m01, const Scalar &m02, const Scalar &m03, const Scalar &m10, const Scalar &m11, const Scalar &m12, const Scalar &m13, const Scalar &m20, const Scalar &m21, const Scalar &m22, const Scalar &m23, const Scalar &m30, const Scalar &m31, const Scalar &m32, const Scalar &m33)
Eigen::Matrix< double, 4, 4 > Base
EIGEN_STRONG_INLINE Matrix4_t()
Matrix4_t & operator=(const Eigen::MatrixBase< OtherDerived > &other)
Matrix4_t(const Eigen::MatrixBase< OtherDerived > &other)
EIGEN_STRONG_INLINE Matrix4_t(const Scalar &m00, const Scalar &m01, const Scalar &m02, const Scalar &m03, const Scalar &m10, const Scalar &m11, const Scalar &m12, const Scalar &m13, const Scalar &m20, const Scalar &m21, const Scalar &m22, const Scalar &m23, const Scalar &m30, const Scalar &m31, const Scalar &m32, const Scalar &m33)
void set(const Scalar &m00, const Scalar &m01, const Scalar &m02, const Scalar &m03, const Scalar &m04, const Scalar &m05, const Scalar &m10, const Scalar &m11, const Scalar &m12, const Scalar &m13, const Scalar &m14, const Scalar &m15, const Scalar &m20, const Scalar &m21, const Scalar &m22, const Scalar &m23, const Scalar &m24, const Scalar &m25, const Scalar &m30, const Scalar &m31, const Scalar &m32, const Scalar &m33, const Scalar &m34, const Scalar &m35, const Scalar &m40, const Scalar &m41, const Scalar &m42, const Scalar &m43, const Scalar &m44, const Scalar &m45, const Scalar &m50, const Scalar &m51, const Scalar &m52, const Scalar &m53, const Scalar &m54, const Scalar &m55)
EIGEN_STRONG_INLINE SpatialMatrix_t(const Scalar &m00, const Scalar &m01, const Scalar &m02, const Scalar &m03, const Scalar &m04, const Scalar &m05, const Scalar &m10, const Scalar &m11, const Scalar &m12, const Scalar &m13, const Scalar &m14, const Scalar &m15, const Scalar &m20, const Scalar &m21, const Scalar &m22, const Scalar &m23, const Scalar &m24, const Scalar &m25, const Scalar &m30, const Scalar &m31, const Scalar &m32, const Scalar &m33, const Scalar &m34, const Scalar &m35, const Scalar &m40, const Scalar &m41, const Scalar &m42, const Scalar &m43, const Scalar &m44, const Scalar &m45, const Scalar &m50, const Scalar &m51, const Scalar &m52, const Scalar &m53, const Scalar &m54, const Scalar &m55)
SpatialMatrix_t & operator=(const Eigen::MatrixBase< OtherDerived > &other)
EIGEN_STRONG_INLINE SpatialMatrix_t()
SpatialMatrix_t(const Eigen::MatrixBase< OtherDerived > &other)
Eigen::Matrix< double, 6, 6 > Base
SpatialVector_t(const Eigen::MatrixBase< OtherDerived > &other)
Eigen::Matrix< double, 6, 1 > Base
EIGEN_STRONG_INLINE SpatialVector_t(const double &v0, const double &v1, const double &v2, const double &v3, const double &v4, const double &v5)
SpatialVector_t & operator=(const Eigen::MatrixBase< OtherDerived > &other)
void set(const double &v0, const double &v1, const double &v2, const double &v3, const double &v4, const double &v5)
EIGEN_STRONG_INLINE SpatialVector_t()
EIGEN_STRONG_INLINE Vector3_t()
Vector3_t(const Eigen::MatrixBase< OtherDerived > &other)
EIGEN_STRONG_INLINE Vector3_t(const double &v0, const double &v1, const double &v2)
Eigen::Vector3d Base
Vector3_t & operator=(const Eigen::MatrixBase< OtherDerived > &other)
void set(const double &v0, const double &v1, const double &v2)
EIGEN_STRONG_INLINE Vector4_t(const double &v0, const double &v1, const double &v2, const double &v3)
void set(const double &v0, const double &v1, const double &v2, const double &v3)
EIGEN_STRONG_INLINE Vector4_t()
Vector4_t(const Eigen::MatrixBase< OtherDerived > &other)
Vector4_t & operator=(const Eigen::MatrixBase< OtherDerived > &other)
Eigen::Vector4d Base
RBDLCasadiMath::MX_Xd_static< 2, 1 > Vector2_t
Definition: rbdl_math.h:17