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-2016 Martin Felis <martin.felis@iwr.uni-heidelberg.de>
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 #if defined(WIN32) && defined(rbdl_EXPORTS)
16 #define RBDL_TEMPLATE_DLLAPI
17 #else
18 #define RBDL_TEMPLATE_DLLAPI RBDL_DLLAPI
19 #endif
20 
22 {
23  public:
25 
26  template<typename OtherDerived>
27  Vector3_t(const Eigen::MatrixBase<OtherDerived>& other)
28  : Eigen::Vector3d(other)
29  {}
30 
31  template<typename OtherDerived>
32  Vector3_t& operator=(const Eigen::MatrixBase<OtherDerived>& other)
33  {
34  this->Base::operator=(other);
35  return *this;
36  }
37 
38  EIGEN_STRONG_INLINE Vector3_t()
39  {}
40 
41  EIGEN_STRONG_INLINE Vector3_t(
42  const double& v0, const double& v1, const double& v2
43  )
44  {
45  Base::_check_template_params();
46 
47  (*this) << v0, v1, v2;
48  }
49 
50  void set(const double& v0, const double& v1, const double& v2)
51  {
52  Base::_check_template_params();
53 
54  (*this) << v0, v1, v2;
55  }
56 };
57 
59 {
60  public:
62 
63  template<typename OtherDerived>
64  Matrix3_t(const Eigen::MatrixBase<OtherDerived>& other)
65  : Eigen::Matrix3d(other)
66  {}
67 
68  template<typename OtherDerived>
69  Matrix3_t& operator=(const Eigen::MatrixBase<OtherDerived>& other)
70  {
71  this->Base::operator=(other);
72  return *this;
73  }
74 
75  EIGEN_STRONG_INLINE Matrix3_t()
76  {}
77 
78  EIGEN_STRONG_INLINE Matrix3_t(
79  const double& m00, const double& m01, const double& m02,
80  const double& m10, const double& m11, const double& m12,
81  const double& m20, const double& m21, const double& m22
82  )
83  {
84  Base::_check_template_params();
85 
86  (*this)
87  << m00, m01, m02,
88  m10, m11, m12,
89  m20, m21, m22
90  ;
91  }
92 };
93 
95 {
96  public:
98 
99  template<typename OtherDerived>
100  Vector4_t(const Eigen::MatrixBase<OtherDerived>& other)
101  : Eigen::Vector4d(other)
102  {}
103 
104  template<typename OtherDerived>
105  Vector4_t& operator=(const Eigen::MatrixBase<OtherDerived>& other)
106  {
107  this->Base::operator=(other);
108  return *this;
109  }
110 
111  EIGEN_STRONG_INLINE Vector4_t()
112  {}
113 
114  EIGEN_STRONG_INLINE Vector4_t(
115  const double& v0, const double& v1, const double& v2, const double& v3
116  )
117  {
118  Base::_check_template_params();
119 
120  (*this) << v0, v1, v2, v3;
121  }
122 
123  void set(const double& v0, const double& v1, const double& v2, const double& v3)
124  {
125  Base::_check_template_params();
126 
127  (*this) << v0, v1, v2, v3;
128  }
129 };
130 
131 class RBDL_TEMPLATE_DLLAPI SpatialVector_t : public Eigen::Matrix<double, 6, 1>
132 {
133  public:
134  typedef Eigen::Matrix<double, 6, 1> Base;
135 
136  template<typename OtherDerived>
137  SpatialVector_t(const Eigen::MatrixBase<OtherDerived>& other)
138  : Eigen::Matrix<double, 6, 1>(other)
139  {}
140 
141  template<typename OtherDerived>
142  SpatialVector_t& operator=(const Eigen::MatrixBase<OtherDerived>& other)
143  {
144  this->Base::operator=(other);
145  return *this;
146  }
147 
148  EIGEN_STRONG_INLINE SpatialVector_t()
149  {}
150 
151  EIGEN_STRONG_INLINE SpatialVector_t(
152  const double& v0, const double& v1, const double& v2,
153  const double& v3, const double& v4, const double& v5
154  )
155  {
156  Base::_check_template_params();
157 
158  (*this) << v0, v1, v2, v3, v4, v5;
159  }
160 
161  void set(
162  const double& v0, const double& v1, const double& v2,
163  const double& v3, const double& v4, const double& v5
164  )
165  {
166  Base::_check_template_params();
167 
168  (*this) << v0, v1, v2, v3, v4, v5;
169  }
170 };
171 
172 class RBDL_TEMPLATE_DLLAPI SpatialMatrix_t : public Eigen::Matrix<double, 6, 6>
173 {
174  public:
175  typedef Eigen::Matrix<double, 6, 6> Base;
176 
177  template<typename OtherDerived>
178  SpatialMatrix_t(const Eigen::MatrixBase<OtherDerived>& other)
179  : Eigen::Matrix<double, 6, 6>(other)
180  {}
181 
182  template<typename OtherDerived>
183  SpatialMatrix_t& operator=(const Eigen::MatrixBase<OtherDerived>& other)
184  {
185  this->Base::operator=(other);
186  return *this;
187  }
188 
189  EIGEN_STRONG_INLINE SpatialMatrix_t()
190  {}
191 
192  EIGEN_STRONG_INLINE SpatialMatrix_t(
193  const Scalar& m00, const Scalar& m01, const Scalar& m02, const Scalar& m03, const Scalar& m04, const Scalar& m05,
194  const Scalar& m10, const Scalar& m11, const Scalar& m12, const Scalar& m13, const Scalar& m14, const Scalar& m15,
195  const Scalar& m20, const Scalar& m21, const Scalar& m22, const Scalar& m23, const Scalar& m24, const Scalar& m25,
196  const Scalar& m30, const Scalar& m31, const Scalar& m32, const Scalar& m33, const Scalar& m34, const Scalar& m35,
197  const Scalar& m40, const Scalar& m41, const Scalar& m42, const Scalar& m43, const Scalar& m44, const Scalar& m45,
198  const Scalar& m50, const Scalar& m51, const Scalar& m52, const Scalar& m53, const Scalar& m54, const Scalar& m55
199  )
200  {
201  Base::_check_template_params();
202 
203  (*this)
204  << m00, m01, m02, m03, m04, m05
205  , m10, m11, m12, m13, m14, m15
206  , m20, m21, m22, m23, m24, m25
207  , m30, m31, m32, m33, m34, m35
208  , m40, m41, m42, m43, m44, m45
209  , m50, m51, m52, m53, m54, m55
210  ;
211  }
212 
213  void set(
214  const Scalar& m00, const Scalar& m01, const Scalar& m02, const Scalar& m03, const Scalar& m04, const Scalar& m05,
215  const Scalar& m10, const Scalar& m11, const Scalar& m12, const Scalar& m13, const Scalar& m14, const Scalar& m15,
216  const Scalar& m20, const Scalar& m21, const Scalar& m22, const Scalar& m23, const Scalar& m24, const Scalar& m25,
217  const Scalar& m30, const Scalar& m31, const Scalar& m32, const Scalar& m33, const Scalar& m34, const Scalar& m35,
218  const Scalar& m40, const Scalar& m41, const Scalar& m42, const Scalar& m43, const Scalar& m44, const Scalar& m45,
219  const Scalar& m50, const Scalar& m51, const Scalar& m52, const Scalar& m53, const Scalar& m54, const Scalar& m55
220  )
221  {
222  Base::_check_template_params();
223 
224  (*this)
225  << m00, m01, m02, m03, m04, m05
226  , m10, m11, m12, m13, m14, m15
227  , m20, m21, m22, m23, m24, m25
228  , m30, m31, m32, m33, m34, m35
229  , m40, m41, m42, m43, m44, m45
230  , m50, m51, m52, m53, m54, m55
231  ;
232  }
233 };
234 
235 /* _RBDL_EIGENMATH_H */
236 #endif
SpatialMatrix_t & operator=(const Eigen::MatrixBase< OtherDerived > &other)
EIGEN_STRONG_INLINE Vector3_t()
SpatialVector_t & operator=(const Eigen::MatrixBase< OtherDerived > &other)
Vector3_t & operator=(const Eigen::MatrixBase< OtherDerived > &other)
EIGEN_STRONG_INLINE Vector3_t(const double &v0, const double &v1, const double &v2)
Matrix3_t(const Eigen::MatrixBase< OtherDerived > &other)
#define RBDL_TEMPLATE_DLLAPI
Vector3_t(const Eigen::MatrixBase< OtherDerived > &other)
Eigen::Vector3d Base
EIGEN_STRONG_INLINE SpatialMatrix_t()
SpatialVector_t(const Eigen::MatrixBase< OtherDerived > &other)
Vector4_t & operator=(const Eigen::MatrixBase< OtherDerived > &other)
EIGEN_STRONG_INLINE Matrix3_t()
Eigen::Matrix< double, 6, 1 > Base
Matrix3_t & operator=(const Eigen::MatrixBase< OtherDerived > &other)
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)
Vector4_t(const Eigen::MatrixBase< OtherDerived > &other)
Eigen::Vector4d Base
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)
EIGEN_STRONG_INLINE Vector4_t(const double &v0, const double &v1, const double &v2, const double &v3)
EIGEN_STRONG_INLINE SpatialVector_t(const double &v0, const double &v1, const double &v2, const double &v3, const double &v4, const double &v5)
SpatialMatrix_t(const Eigen::MatrixBase< OtherDerived > &other)
Eigen::Matrix< double, 6, 6 > Base
EIGEN_STRONG_INLINE SpatialVector_t()
Eigen::Matrix3d Base
EIGEN_STRONG_INLINE Vector4_t()