Biorbd Release_1.13.0
Loading...
Searching...
No Matches
Vector3d.h
1#ifndef BIORBD_UTILS_VECTOR3D_H
2#define BIORBD_UTILS_VECTOR3D_H
3
4#include "biorbdConfig.h"
5
6#include <memory>
7
8#include "Utils/Node.h"
9#include "Utils/Scalar.h"
10#include "rbdl/rbdl_math.h"
11
12namespace BIORBD_NAMESPACE {
13namespace utils {
14class RotoTrans;
15class String;
16class Vector;
17
21#ifdef SWIG
22class BIORBD_API Vector3d : public Node
23#else
24class BIORBD_API Vector3d : public RigidBodyDynamics::Math::Vector3d,
25 public Node
26#endif
27{
28 public:
32 Vector3d();
33
40 Vector3d(const Scalar& x, const Scalar& y, const Scalar& z);
41
51 const Scalar& x,
52 const Scalar& y,
53 const Scalar& z,
54 const String& name,
55 const String& parentName);
56
63 Vector3d(const Vector3d vec, const String& name, const String& parentName);
64
70 Vector3d(const RigidBodyDynamics::Math::Vector3d& other);
71
77 Vector3d(const RigidBodyDynamics::Math::VectorNd& other);
78
84 Vector3d(const RigidBodyDynamics::Math::Vector4d& other);
85
86#ifdef BIORBD_USE_EIGEN3_MATH
91 template <typename OtherDerived>
92 Vector3d(const Eigen::MatrixBase<OtherDerived>& other)
93 : RigidBodyDynamics::Math::Vector3d(other), Node() {}
94
101 template <typename OtherDerived>
102 Vector3d(
103 const Eigen::MatrixBase<OtherDerived>& other,
104 const String& name,
105 const String& parentName)
106 : RigidBodyDynamics::Math::Vector3d(other), Node(name, parentName) {}
107#endif
108#ifdef BIORBD_USE_CASADI_MATH
109
115 Vector3d(const RBDLCasadiMath::MX_Xd_SubMatrix& other);
116#endif
117
122 Vector3d DeepCopy() const;
123
128 void DeepCopy(const Vector3d& other);
129
134 //
135 Vector3d applyRT(const RotoTrans& rt) const;
136
141 void applyRT(const RotoTrans& rt);
142
147 void setPosition(const Vector3d& v);
148
149#ifndef SWIG
150
151#ifdef BIORBD_USE_EIGEN3_MATH
156 template <typename OtherDerived>
157 Vector3d& operator=(const Eigen::MatrixBase<OtherDerived>& other) {
158 this->Eigen::Vector3d::operator=(other);
159 return *this;
160 }
161#endif
162
163#ifdef BIORBD_USE_CASADI_MATH
164
169 Scalar x() const;
170
175 Scalar y() const;
176
181 Scalar z() const;
182
188 template <unsigned int i, unsigned int j>
189 void operator=(const MX_Xd_static<i, j>& other) {
190 this->block<3, 1>(0, 0) = other;
191 }
192
197 void operator=(const RBDLCasadiMath::MX_Xd_SubMatrix& other);
198
203 void operator=(const RigidBodyDynamics::Math::Vector4d& other);
204
205#endif
206
207#endif
208
209 protected:
213 void setType();
214};
215
216} // namespace utils
217} // namespace BIORBD_NAMESPACE
218
219#endif // BIORBD_UTILS_VECTOR3D_H
A node is an abstract element which is assigned to a parent.
Definition Node.h:17
Node()
Construct Node.
Definition Node.cpp:8
const String & name() const
Return the name of the node.
Definition Node.cpp:43
Homogenous matrix to describe translations and rotations simultaneously.
Definition RotoTrans.h:33
Wrapper around the std::string class with augmented functionality.
Definition String.h:18
Wrapper around Eigen Vector3d and attach it to a parent.
Definition Vector3d.h:27
Vector3d()
Construct 3D vector.
Definition Vector3d.cpp:9
void setPosition(const Vector3d &v)
Set a new position.
Definition Vector3d.cpp:93
Vector3d applyRT(const RotoTrans &rt) const
Apply a RotoTrans to the 3D vector.
Definition Vector3d.cpp:79
void setType()
Set the type Vector3d.
Definition Vector3d.cpp:103
Vector3d DeepCopy() const
Deep copy of a 3D vector.
Definition Vector3d.cpp:68
Wrapper of the Eigen VectorXd.
Definition Vector.h:21