Biorbd Release_1.13.0
Loading...
Searching...
No Matches
WrappingHalfCylinder.h
1#ifndef BIORBD_MUSCLES_WRAPPING_HALF_CYLINDER_H
2#define BIORBD_MUSCLES_WRAPPING_HALF_CYLINDER_H
3
4#include "biorbdConfig.h"
5
6#include "InternalForces/WrappingObject.h"
7
8namespace BIORBD_NAMESPACE {
9namespace internal_forces {
18class BIORBD_API WrappingHalfCylinder : public WrappingObject {
19 public:
24
30
31#ifndef SWIG
37#endif
38
46 const utils::RotoTrans& rt,
47 const utils::Scalar& radius,
48 const utils::Scalar& length);
49
59 const utils::RotoTrans& rt,
60 const utils::Scalar& radius,
61 const utils::Scalar& length,
62 const utils::String& name,
63 const utils::String& parentName);
64
70
76 void DeepCopy(const WrappingHalfCylinder& other);
77
88 void wrapPoints(
89 const utils::RotoTrans& rt,
90 const utils::Vector3d& p1_bone,
91 const utils::Vector3d& p2_bone,
94 utils::Scalar* length = nullptr);
95
107 void wrapPoints(
108 rigidbody::Joints& model,
110 const utils::Vector3d& p1_bone,
111 const utils::Vector3d& p2_bone,
112 utils::Vector3d& p1,
113 utils::Vector3d& p2,
114 utils::Scalar* length = nullptr);
115
123 void wrapPoints(
124 utils::Vector3d& p1,
125 utils::Vector3d& p2,
126 utils::Scalar* length = nullptr);
127
135 virtual const utils::RotoTrans& RT(
136 rigidbody::Joints& model,
138 bool updateKin = true);
139
144 void setRadius(const utils::Scalar& val);
145
150 utils::Scalar radius() const;
151
156 utils::Scalar diameter() const;
157
162 void setLength(const utils::Scalar& val);
163
168 const utils::Scalar& length() const;
169
170 protected:
171#ifndef SWIG
176 public:
183 : m_p1(std::make_shared<utils::Vector3d>(p1)),
184 m_p2(std::make_shared<utils::Vector3d>(p2)) {}
185 std::shared_ptr<utils::Vector3d> m_p1;
186 std::shared_ptr<utils::Vector3d> m_p2;
187 };
188#endif
189
196 const;
197
203 void selectTangents(const NodeMusclePair& p, utils::Vector3d& p_tan) const;
204
212 bool findVerticalNode(
213 const NodeMusclePair& pointsInGlobal,
214 NodeMusclePair& pointsToWrap) const;
215
216#ifndef BIORBD_USE_CASADI_MATH
224 bool checkIfWraps(
225 const NodeMusclePair& pointsInGlobal,
226 NodeMusclePair& pointsToWrap) const;
227#endif
228
234 utils::Scalar computeLength(const NodeMusclePair& p) const;
235
236 std::shared_ptr<utils::Scalar>
238 std::shared_ptr<utils::Scalar> m_length;
239 std::shared_ptr<utils::RotoTrans>
241
242 std::shared_ptr<utils::Vector3d>
244 std::shared_ptr<utils::Vector3d>
246 std::shared_ptr<utils::Scalar>
248};
249
250} // namespace internal_forces
251} // namespace BIORBD_NAMESPACE
252
253#endif // BIORBD_MUSCLES_WRAPPING_HALF_CYLINDER_H
NodeMusclePair(const utils::Vector3d &p1, const utils::Vector3d &p2)
Construct a node muscle pair.
bool findVerticalNode(const NodeMusclePair &pointsInGlobal, NodeMusclePair &pointsToWrap) const
Find the height of both points.
std::shared_ptr< utils::Scalar > m_length
Length of the half cylinder.
void wrapPoints(const utils::RotoTrans &rt, const utils::Vector3d &p1_bone, const utils::Vector3d &p2_bone, utils::Vector3d &p1, utils::Vector3d &p2, utils::Scalar *length=nullptr)
From the position of the half cylinder, return the 2 locations where the muscle leaves the wrapping o...
virtual const utils::RotoTrans & RT(rigidbody::Joints &model, const rigidbody::GeneralizedCoordinates &Q, bool updateKin=true)
Return the RotoTrans matrix of the half cylinder.
void setRadius(const utils::Scalar &val)
Set the diameter of the wrapping half cylinder.
utils::Scalar radius() const
Return the radius of the half cylinder.
std::shared_ptr< utils::Vector3d > m_p2Wrap
Second point of contact with the wrap.
void setLength(const utils::Scalar &val)
Set the length of the half cylinder.
utils::Scalar diameter() const
Return the diamter of the half cylinder.
WrappingHalfCylinder DeepCopy() const
Deep copy of the wrapping half cylinder.
const utils::Scalar & length() const
Return the length of the half cylinder.
bool checkIfWraps(const NodeMusclePair &pointsInGlobal, NodeMusclePair &pointsToWrap) const
Check if a wrapper has to be done.
std::shared_ptr< utils::Scalar > m_lengthAroundWrap
Length between p1 and p2.
std::shared_ptr< utils::Vector3d > m_p1Wrap
First point of contact with the wrap.
std::shared_ptr< utils::RotoTrans > m_RTtoParent
RotoTrans matrix with the parent.
std::shared_ptr< utils::Scalar > m_radius
Diameter of the half cylinder diametre du cylindre.
void findTangentToCircle(const utils::Vector3d &p, utils::Vector3d &p_tan) const
Find the two tangents of a point with a circle.
void selectTangents(const NodeMusclePair &p, utils::Vector3d &p_tan) const
Select between a set of nodes which ones to keep.
utils::Scalar computeLength(const NodeMusclePair &p) const
Compute the muscle length on the half cylinder.
This is the core of the musculoskeletal model in biorbd.
Definition Joints.h:48
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