Biorbd
Vector3d.h
1 #ifndef BIORBD_UTILS_VECTOR3D_H
2 #define BIORBD_UTILS_VECTOR3D_H
3 
4 #include <memory>
5 #include "biorbdConfig.h"
6 #include "rbdl_math.h"
7 #include "Utils/Node.h"
8 #include "Utils/Scalar.h"
9 
10 namespace biorbd {
11 namespace utils {
12 class RotoTrans;
13 class String;
14 class Vector;
15 
19 #ifdef SWIG
20 class BIORBD_API Vector3d
21 #else
22 class BIORBD_API Vector3d : public RigidBodyDynamics::Math::Vector3d, public biorbd::utils::Node
23 #endif
24 {
25  public:
29  Vector3d();
30 
37  Vector3d(
38  const biorbd::utils::Scalar& x,
39  const biorbd::utils::Scalar& y,
40  const biorbd::utils::Scalar& z);
41 
50  Vector3d(
51  const biorbd::utils::Scalar& x,
52  const biorbd::utils::Scalar& y,
53  const biorbd::utils::Scalar& z,
54  const biorbd::utils::String &name,
55  const biorbd::utils::String &parentName);
56 
63  Vector3d(
64  const biorbd::utils::Vector3d vec,
65  const biorbd::utils::String &name,
66  const biorbd::utils::String &parentName);
67 
72  Vector3d(
73  const RigidBodyDynamics::Math::Vector3d& other);
74 
79  Vector3d(
80  const RigidBodyDynamics::Math::VectorNd& other);
81 
86  Vector3d(
87  const RigidBodyDynamics::Math::Vector4d& other);
88 
89 #ifdef BIORBD_USE_EIGEN3_MATH
90  template<typename OtherDerived> Vector3d(
95  const Eigen::MatrixBase<OtherDerived>& other) :
96  RigidBodyDynamics::Math::Vector3d(other), biorbd::utils::Node () {
97  }
98 
105  template<typename OtherDerived> Vector3d(
106  const Eigen::MatrixBase<OtherDerived>& other,
107  const biorbd::utils::String &name,
108  const biorbd::utils::String &parentName) :
109  RigidBodyDynamics::Math::Vector3d(other), biorbd::utils::Node (name, parentName) {
110 
111  }
112 #endif
113 #ifdef BIORBD_USE_CASADI_MATH
114 
119  Vector3d(
120  const RBDLCasadiMath::MX_Xd_SubMatrix& other);
121 
122 #endif
123 
128  biorbd::utils::Vector3d DeepCopy() const;
129 
134  void DeepCopy(const biorbd::utils::Vector3d& other);
135 
140  //
141  biorbd::utils::Vector3d applyRT(
142  const RotoTrans& rt) const;
143 
148  void applyRT(
149  const RotoTrans& rt);
150 
151 #ifndef SWIG
152 
153 #ifdef BIORBD_USE_EIGEN3_MATH
154  template<typename OtherDerived>
159  biorbd::utils::Vector3d& operator=(const Eigen::MatrixBase <OtherDerived>& other){
160  this->Eigen::Vector3d::operator=(other);
161  return *this;
162  }
163 #endif
164 
165 #ifdef BIORBD_USE_CASADI_MATH
166 
171  biorbd::utils::Scalar x() const;
172 
177  biorbd::utils::Scalar y() const;
178 
183  biorbd::utils::Scalar z() const;
184 
189  template<unsigned int i, unsigned int j>
190  void operator=(
191  const MX_Xd_static<i, j>& other){
192  this->block<3, 1>(0, 0) = other;
193  }
194 
199  void operator=(
200  const RBDLCasadiMath::MX_Xd_SubMatrix& other);
201 
206  void operator=(
207  const RigidBodyDynamics::Math::Vector4d& other);
208 
209 #endif
210 
211 #endif
212 
213 protected:
217  void setType();
218 };
219 
220 }}
221 
222 #endif // BIORBD_UTILS_VECTOR3D_H
biorbd::utils::Vector3d
Wrapper around Eigen Vector3d and attach it to a parent.
Definition: Vector3d.h:24
biorbd::utils::Node
A node is an abstract element which is assigned to a parent.
Definition: Node.h:16
biorbd::utils::RotoTrans
Homogenous matrix to describe translations and rotations simultaneously.
Definition: RotoTrans.h:34
biorbd::utils::String
Wrapper around the std::string class with augmented functionality.
Definition: String.h:17