Biorbd
WrappingCylinder.h
1 #ifndef BIORBD_MUSCLES_WRAPPING_CYLINDER_H
2 #define BIORBD_MUSCLES_WRAPPING_CYLINDER_H
3 
4 #include "biorbdConfig.h"
5 #include "Muscles/WrappingObject.h"
6 
7 namespace biorbd {
8 namespace muscles {
13 {
14 public:
19 
28  const biorbd::utils::RotoTrans& rt,
29  const biorbd::utils::Scalar& diameter,
30  const biorbd::utils::Scalar& length,
31  bool isCylinderPositiveSign);
32 
43  const biorbd::utils::RotoTrans& rt,
44  const biorbd::utils::Scalar& diameter,
45  const biorbd::utils::Scalar& length,
46  bool isCylinderPositiveSign,
47  const biorbd::utils::String& name,
48  const biorbd::utils::String& parentName);
49 
54  biorbd::muscles::WrappingCylinder DeepCopy() const;
55 
60  void DeepCopy(
62 
72  void wrapPoints(
73  const biorbd::utils::RotoTrans& rt,
74  const biorbd::utils::Vector3d& p1_bone,
75  const biorbd::utils::Vector3d& p2_bone,
78  biorbd::utils::Scalar* length = nullptr);
79 
90  void wrapPoints(
93  const biorbd::utils::Vector3d& p1_bone,
94  const biorbd::utils::Vector3d& p2_bone,
97  biorbd::utils::Scalar* length = nullptr) ;
98 
105  void wrapPoints(
108  biorbd::utils::Scalar* length = nullptr);
109 
117  virtual const biorbd::utils::RotoTrans& RT(
120  bool updateKin = true);
121 
126  void setDiameter(
127  const biorbd::utils::Scalar& val);
128 
133  const biorbd::utils::Scalar& diameter() const;
134 
139  biorbd::utils::Scalar radius() const;
140 
145  void setLength(
146  const biorbd::utils::Scalar& val);
147 
152  const biorbd::utils::Scalar& length() const;
153 
154 protected:
159  public:
166  const biorbd::utils::Vector3d &p1,
167  const biorbd::utils::Vector3d &p2) :
168  m_p1(std::make_shared<biorbd::utils::Vector3d>(p1)),
169  m_p2(std::make_shared<biorbd::utils::Vector3d>(p2))
170  {}
171  std::shared_ptr<biorbd::utils::Vector3d> m_p1;
172  std::shared_ptr<biorbd::utils::Vector3d> m_p2;
173  };
174 
175 
181  void findTangentToCircle(
182  const biorbd::utils::Vector3d& p,
183  biorbd::utils::Vector3d& p_tan) const;
184 
190  void selectTangents(
191  const NodeMusclePair&p,
192  biorbd::utils::Vector3d& p_tan) const;
193 
200  bool findVerticalNode(
201  const NodeMusclePair& pointsInGlobal,
202  NodeMusclePair& pointsToWrap) const;
203 
210 #ifdef BIORBD_USE_CASADI_MATH
211  biorbd::utils::Scalar checkIfWraps(
212 #else
213  bool checkIfWraps(
214 #endif
215  const NodeMusclePair &pointsInGlobal,
216  NodeMusclePair &pointsToWrap) const;
217 
223  biorbd::utils::Scalar computeLength(
224  const NodeMusclePair &p) const;
225 
226  std::shared_ptr<biorbd::utils::Scalar> m_dia;
227  std::shared_ptr<biorbd::utils::Scalar> m_length;
228  std::shared_ptr<bool> m_isCylinderPositiveSign;
229  std::shared_ptr<biorbd::utils::RotoTrans> m_RTtoParent;
230 
231  std::shared_ptr<biorbd::utils::Vector3d> m_p1Wrap;
232  std::shared_ptr<biorbd::utils::Vector3d> m_p2Wrap;
233  std::shared_ptr<biorbd::utils::Scalar> m_lengthAroundWrap ;
234 
235 };
236 
237 }}
238 
239 #endif // BIORBD_MUSCLES_WRAPPING_CYLINDER_H
240 
biorbd::muscles::WrappingCylinder::NodeMusclePair::m_p2
std::shared_ptr< biorbd::utils::Vector3d > m_p2
Point 2.
Definition: WrappingCylinder.h:172
biorbd::muscles::WrappingCylinder::m_RTtoParent
std::shared_ptr< biorbd::utils::RotoTrans > m_RTtoParent
RotoTrans matrix with the parent.
Definition: WrappingCylinder.h:229
biorbd::muscles::WrappingCylinder
Cylinder object that makes the muscle to wrap around.
Definition: WrappingCylinder.h:13
biorbd::utils::Vector3d
Wrapper around Eigen Vector3d and attach it to a parent.
Definition: Vector3d.h:24
biorbd::muscles::WrappingCylinder::m_lengthAroundWrap
std::shared_ptr< biorbd::utils::Scalar > m_lengthAroundWrap
Length between p1 and p2.
Definition: WrappingCylinder.h:233
biorbd::muscles::WrappingCylinder::NodeMusclePair::m_p1
std::shared_ptr< biorbd::utils::Vector3d > m_p1
Point 1.
Definition: WrappingCylinder.h:171
biorbd::muscles::WrappingCylinder::m_p2Wrap
std::shared_ptr< biorbd::utils::Vector3d > m_p2Wrap
Second point of contact with the wrap.
Definition: WrappingCylinder.h:232
biorbd::rigidbody::GeneralizedCoordinates
Class GeneralizedCoordinates.
Definition: GeneralizedCoordinates.h:15
biorbd::muscles::WrappingCylinder::m_p1Wrap
std::shared_ptr< biorbd::utils::Vector3d > m_p1Wrap
First point of contact with the wrap.
Definition: WrappingCylinder.h:231
biorbd::muscles::WrappingCylinder::m_length
std::shared_ptr< biorbd::utils::Scalar > m_length
Length of the cylinder.
Definition: WrappingCylinder.h:227
biorbd::rigidbody::Joints
This is the core of the musculoskeletal model in biorbd.
Definition: Joints.h:40
biorbd::utils::RotoTrans
Homogenous matrix to describe translations and rotations simultaneously.
Definition: RotoTrans.h:34
biorbd::muscles::WrappingObject
Base class for the wrapping objects.
Definition: WrappingObject.h:23
biorbd::utils::String
Wrapper around the std::string class with augmented functionality.
Definition: String.h:17
biorbd::muscles::WrappingCylinder::NodeMusclePair::NodeMusclePair
NodeMusclePair(const biorbd::utils::Vector3d &p1, const biorbd::utils::Vector3d &p2)
Construct a node muscle pair.
Definition: WrappingCylinder.h:165
biorbd::muscles::WrappingCylinder::m_isCylinderPositiveSign
std::shared_ptr< bool > m_isCylinderPositiveSign
orientation of the muscle passing
Definition: WrappingCylinder.h:228
biorbd::muscles::WrappingCylinder::m_dia
std::shared_ptr< biorbd::utils::Scalar > m_dia
Diameter of the cylinder diametre du cylindre.
Definition: WrappingCylinder.h:226
biorbd::muscles::WrappingCylinder::NodeMusclePair
Pair of 2 muscles points.
Definition: WrappingCylinder.h:158