Biorbd
Compound.cpp
1 #define BIORBD_API_EXPORTS
2 #include "Muscles/Compound.h"
3 
4 #include "Utils/String.h"
5 #include "Utils/Vector3d.h"
6 #include "RigidBody/GeneralizedCoordinates.h"
7 #include "Muscles/Characteristics.h"
8 #include "Muscles/PathModifiers.h"
9 #include "Muscles/State.h"
10 
12  m_name(std::make_shared<biorbd::utils::String>("")),
13  m_type(std::make_shared<biorbd::muscles::MUSCLE_TYPE>(biorbd::muscles::MUSCLE_TYPE::NO_MUSCLE_TYPE)),
14  m_pathChanger(std::make_shared<biorbd::muscles::PathModifiers>()),
15  m_force(std::make_shared<biorbd::utils::Scalar>(0))
16 {
17 
18 }
19 
21  m_name(std::make_shared<biorbd::utils::String>(name)),
22  m_type(std::make_shared<biorbd::muscles::MUSCLE_TYPE>(biorbd::muscles::MUSCLE_TYPE::NO_MUSCLE_TYPE)),
23  m_pathChanger(std::make_shared<biorbd::muscles::PathModifiers>()),
24  m_force(std::make_shared<biorbd::utils::Scalar>(0))
25 {
26 
27 }
28 
30  const biorbd::utils::String &name,
31  const biorbd::muscles::PathModifiers &pathModifiers) :
32  m_name(std::make_shared<biorbd::utils::String>(name)),
33  m_type(std::make_shared<biorbd::muscles::MUSCLE_TYPE>(biorbd::muscles::MUSCLE_TYPE::NO_MUSCLE_TYPE)),
34  m_pathChanger(std::make_shared<biorbd::muscles::PathModifiers>(pathModifiers)),
35  m_force(std::make_shared<biorbd::utils::Scalar>(0))
36 {
37 
38 }
39 
41  const biorbd::muscles::Compound &other) :
42  m_name(other.m_name),
43  m_type(other.m_type),
44  m_pathChanger(other.m_pathChanger),
45  m_force(other.m_force)
46 {
47 
48 }
49 
51  std::shared_ptr<biorbd::muscles::Compound> other) :
52  m_name(other->m_name),
53  m_type(other->m_type),
54  m_pathChanger(other->m_pathChanger),
55  m_force(other->m_force)
56 {
57 
58 }
59 
61 {
62 
63 }
64 
66 {
67  *m_name = *other.m_name;
68  *m_type = *other.m_type;
69  *m_pathChanger = other.m_pathChanger->DeepCopy();
70  *m_force = *other.m_force;
71 }
72 
74 {
75  return *m_name;
76 }
77 
79 {
80  *m_name = name;
81 }
82 
83 biorbd::muscles::MUSCLE_TYPE biorbd::muscles::Compound::type() const
84 {
85  return *m_type;
86 }
87 
89  return *m_pathChanger;
90 }
91 
93  m_pathChanger->addPathChanger(wrap);
94 }
95 
96 const biorbd::utils::Scalar& biorbd::muscles::Compound::force() {
97  return *m_force;
98 }
biorbd::muscles::Compound::pathModifier
const biorbd::muscles::PathModifiers & pathModifier()
Return the path modifier.
Definition: Compound.cpp:88
biorbd::muscles::Compound::type
biorbd::muscles::MUSCLE_TYPE type() const
Return the type of the muscle.
Definition: Compound.cpp:83
biorbd::muscles::Compound
Class compound is a very generic definition of what a muscle is. It should be the base class of every...
Definition: Compound.h:30
biorbd::utils::Vector3d
Wrapper around Eigen Vector3d and attach it to a parent.
Definition: Vector3d.h:24
biorbd::muscles::Compound::addPathObject
void addPathObject(biorbd::utils::Vector3d &wrap)
Add a path modifier object.
Definition: Compound.cpp:92
biorbd::muscles::Compound::m_name
std::shared_ptr< biorbd::utils::String > m_name
The name of the muscle.
Definition: Compound.h:155
biorbd::muscles::Compound::Compound
Compound()
Construct muscle compound.
Definition: Compound.cpp:11
biorbd::muscles::Compound::~Compound
virtual ~Compound()
Destroy class properly.
Definition: Compound.cpp:60
biorbd::muscles::Compound::name
const biorbd::utils::String & name() const
Return the name of the muscle.
Definition: Compound.cpp:73
biorbd::muscles::Compound::DeepCopy
void DeepCopy(const biorbd::muscles::Compound &other)
Deep copy of a compound.
Definition: Compound.cpp:65
biorbd::muscles::PathModifiers
Holder of all the path modifiers of a muscle.
Definition: PathModifiers.h:18
biorbd::utils::String
Wrapper around the std::string class with augmented functionality.
Definition: String.h:17
biorbd::muscles::Compound::m_type
std::shared_ptr< biorbd::muscles::MUSCLE_TYPE > m_type
The type of muscle.
Definition: Compound.h:156
biorbd::muscles::Compound::m_pathChanger
std::shared_ptr< biorbd::muscles::PathModifiers > m_pathChanger
The set of path modifiers.
Definition: Compound.h:157
biorbd::muscles::Compound::force
virtual const biorbd::utils::Scalar & force()
Return the last computed muscle force norm.
Definition: Compound.cpp:96
biorbd::muscles::Compound::setName
void setName(const biorbd::utils::String &name)
Set the name of a muscle.
Definition: Compound.cpp:78
biorbd::muscles::Compound::m_force
std::shared_ptr< biorbd::utils::Scalar > m_force
The last computed force.
Definition: Compound.h:158