Biorbd
Release_1.13.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Vector2d.cpp
1
#define BIORBD_API_EXPORTS
2
#include "Utils/Vector2d.h"
3
4
#include "Utils/RotoTrans.h"
5
#include "Utils/Vector.h"
6
7
using namespace
BIORBD_NAMESPACE;
8
9
utils::Vector2d::Vector2d
()
10
: RigidBodyDynamics::Math::
Vector2d
(
11
RigidBodyDynamics::Math::
Vector2d
::Zero()),
12
utils::
Node
() {
13
setType
();
14
}
15
16
utils::Vector2d::Vector2d
(
const
utils::Scalar &x,
const
utils::Scalar &y)
17
: RigidBodyDynamics::Math::
Vector2d
(x, y), utils::
Node
() {
18
setType
();
19
}
20
21
utils::Vector2d::Vector2d
(
22
const
utils::Scalar &x,
23
const
utils::Scalar &y,
24
const
utils::String
&
name
,
25
const
utils::String
&parentName)
26
: RigidBodyDynamics::Math::
Vector2d
(x, y), utils::
Node
(
name
, parentName) {
27
setType
();
28
}
29
30
utils::Vector2d::Vector2d
(
31
const
utils::Vector2d
vec,
32
const
utils::String
&
name
,
33
const
utils::String
&parentName)
34
: RigidBodyDynamics::Math::
Vector2d
(vec),
Node
(
name
, parentName) {}
35
36
utils::Vector2d::Vector2d
(
const
RigidBodyDynamics::Math::Vector2d &other)
37
: RigidBodyDynamics::Math::
Vector2d
(other[0], other[1]), utils::
Node
() {
38
setType
();
39
}
40
41
utils::Vector2d::Vector2d
(
const
RigidBodyDynamics::Math::VectorNd &other)
42
: RigidBodyDynamics::Math::
Vector2d
(other[0], other[1]), utils::
Node
() {
43
setType
();
44
}
45
46
#ifdef BIORBD_USE_CASADI_MATH
47
48
utils::Vector2d::Vector2d
(
const
RBDLCasadiMath::MX_Xd_SubMatrix &other)
49
: RigidBodyDynamics::Math::
Vector2d
(other), utils::
Node
() {
50
setType
();
51
}
52
53
#endif
54
55
utils::Vector2d
utils::Vector2d::DeepCopy
()
const
{
56
utils::Vector2d
copy;
57
copy.
DeepCopy
(*
this
);
58
return
copy;
59
}
60
61
void
utils::Vector2d::DeepCopy
(
const
Vector2d
&other) {
62
this->RigidBodyDynamics::Math::Vector2d::operator=(other);
63
utils::Node::DeepCopy
(other);
64
}
65
66
void
utils::Vector2d::setPosition
(
const
utils::Vector2d
&v) {
67
#ifdef BIORBD_USE_CASADI_MATH
68
(*this)(0) = v(0);
69
(*this)(1) = v(1);
70
#else
71
*
this
= v;
72
#endif
73
}
74
75
void
utils::Vector2d::setType
() { *
m_typeOfNode
= utils::VECTOR2D; }
76
77
#ifdef BIORBD_USE_CASADI_MATH
78
utils::Scalar utils::Vector2d::x()
const
{
return
(*
this
)[0]; }
79
80
utils::Scalar utils::Vector2d::y()
const
{
return
(*
this
)[1]; }
81
82
void
utils::Vector2d::operator=(
const
RBDLCasadiMath::MX_Xd_SubMatrix &other) {
83
*
this
=
utils::Vector2d
(other);
84
}
85
86
#endif
BIORBD_NAMESPACE::utils::Node
A node is an abstract element which is assigned to a parent.
Definition
Node.h:17
BIORBD_NAMESPACE::utils::Node::Node
Node()
Construct Node.
Definition
Node.cpp:8
BIORBD_NAMESPACE::utils::Node::name
const String & name() const
Return the name of the node.
Definition
Node.cpp:43
BIORBD_NAMESPACE::utils::Node::m_typeOfNode
std::shared_ptr< NODE_TYPE > m_typeOfNode
The type of the node.
Definition
Node.h:92
BIORBD_NAMESPACE::utils::Node::DeepCopy
void DeepCopy(const Node &other)
Deep copy of the node in another node.
Definition
Node.cpp:35
BIORBD_NAMESPACE::utils::String
Wrapper around the std::string class with augmented functionality.
Definition
String.h:18
BIORBD_NAMESPACE::utils::Vector2d
Wrapper around Eigen Vector2d and attach it to a parent.
Definition
Vector2d.h:27
BIORBD_NAMESPACE::utils::Vector2d::setType
void setType()
Set the type Vector2d.
Definition
Vector2d.cpp:75
BIORBD_NAMESPACE::utils::Vector2d::setPosition
void setPosition(const Vector2d &v)
Set a new position.
Definition
Vector2d.cpp:66
BIORBD_NAMESPACE::utils::Vector2d::Vector2d
Vector2d()
Construct 2D vector.
Definition
Vector2d.cpp:9
BIORBD_NAMESPACE::utils::Vector2d::DeepCopy
Vector2d DeepCopy() const
Deep copy of a 2D vector.
Definition
Vector2d.cpp:55
src
Utils
Vector2d.cpp
Generated by
1.18.0