Biorbd Release_1.13.0
Loading...
Searching...
No Matches
Vector2d.h
1#ifndef BIORBD_UTILS_VECTOR2D_H
2#define BIORBD_UTILS_VECTOR2D_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 Vector2d
23#else
24class BIORBD_API Vector2d : public RigidBodyDynamics::Math::Vector2d,
25 public Node
26#endif
27{
28 public:
32 Vector2d();
33
39 Vector2d(const Scalar& x, const Scalar& y);
40
49 const Scalar& x,
50 const Scalar& y,
51 const String& name,
52 const String& parentName);
53
60 Vector2d(const Vector2d vec, const String& name, const String& parentName);
61
67 Vector2d(const RigidBodyDynamics::Math::Vector2d& other);
68
74 Vector2d(const RigidBodyDynamics::Math::VectorNd& other);
75
76#ifdef BIORBD_USE_EIGEN3_MATH
81 template <typename OtherDerived>
82 Vector2d(const Eigen::MatrixBase<OtherDerived>& other)
83 : RigidBodyDynamics::Math::Vector2d(other), Node() {}
84
91 template <typename OtherDerived>
93 const Eigen::MatrixBase<OtherDerived>& other,
94 const String& name,
95 const String& parentName)
96 : RigidBodyDynamics::Math::Vector2d(other), Node(name, parentName) {}
97#endif
98#ifdef BIORBD_USE_CASADI_MATH
99
105 Vector2d(const RBDLCasadiMath::MX_Xd_SubMatrix& other);
106#endif
107
112 Vector2d DeepCopy() const;
113
118 void DeepCopy(const Vector2d& other);
119
124 void setPosition(const Vector2d& v);
125
126#ifndef SWIG
127
128#ifdef BIORBD_USE_EIGEN3_MATH
133 template <typename OtherDerived>
134 Vector2d& operator=(const Eigen::MatrixBase<OtherDerived>& other) {
135 this->Eigen::Vector2d::operator=(other);
136 return *this;
137 }
138#endif
139
140#ifdef BIORBD_USE_CASADI_MATH
141
146 Scalar x() const;
147
152 Scalar y() const;
153
159 template <unsigned int i, unsigned int j>
160 void operator=(const MX_Xd_static<i, j>& other) {
161 this->block<2, 1>(0, 0) = other;
162 }
163
168 void operator=(const RBDLCasadiMath::MX_Xd_SubMatrix& other);
169
170#endif
171
172#endif
173
174 protected:
178 void setType();
179};
180
181} // namespace utils
182} // namespace BIORBD_NAMESPACE
183
184#endif // BIORBD_UTILS_VECTOR2D_H
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 Vector2d and attach it to a parent.
Definition Vector2d.h:27
void setType()
Set the type Vector2d.
Definition Vector2d.cpp:75
void setPosition(const Vector2d &v)
Set a new position.
Definition Vector2d.cpp:66
Vector2d()
Construct 2D vector.
Definition Vector2d.cpp:9
Vector2d DeepCopy() const
Deep copy of a 2D vector.
Definition Vector2d.cpp:55
Wrapper of the Eigen VectorXd.
Definition Vector.h:21