AGX Dynamics  2.38.0.2
BallJoint.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #pragma once
18 
19 #include <agx/Constraint.h>
20 
21 namespace agx
22 {
26  class CALLABLE AGXPHYSICS_EXPORT BallJointFrame : public ConstraintFrame
27  {
28  public:
30 
34  BallJointFrame( const Vec3& center );
35 
37  ~BallJointFrame();
38 
39  void setCenter( const Vec3& center );
40  const Vec3& getCenter() const;
41  };
42 
48  {
49  public:
56  BallJoint( const BallJointFrame& bf, RigidBody* rb1, RigidBody* rb2 = 0 );
57 
72  BallJoint( RigidBody* rb1, Frame* rb1AttachmentFrame, RigidBody* rb2 = nullptr, Frame* rb2AttachmentFrame = nullptr );
73 
82  BallJoint( RigidBody* rb1, const Vec3& rb1LocalAttachPoint, RigidBody* rb2 = nullptr, const Vec3& rb2LocalAttachPoint = Vec3() );
83 
88  enum DOF {
89  ALL_DOF = -1,
90  TRANSLATIONAL_1 = 0,
91  TRANSLATIONAL_2 = 1,
92  TRANSLATIONAL_3 = 2,
93  NUM_DOF = 3
94  };
95 
99  virtual int getNumDOF() const override;
100 
106  ConeLimit* getConeLimit();
107 
114  const ConeLimit* getConeLimit() const;
115 
123  FrictionControllerRefSetVector getConeLimitFrictionControllers() const;
124 
130  void setEnableConeLimitFriction(bool enable);
131 
137  void setConeLimitFrictionCoefficients(Real frictionCoefficient);
138 
143  RealVector getConeLimitFrictionCoefficients() const;
144 
149  FrictionController* getConeLimitFrictionControllerLimit() const;
150 
155  FrictionController* getConeLimitFrictionControllerRotational() const;
156 
161  FrictionControllerRefSetVector getRotationalFrictionControllers() const;
162 
167  void setEnableRotationalFriction(bool enable);
168 
173  FrictionController* getRotationalFrictionControllerU() const;
174 
179  FrictionController* getRotationalFrictionControllerV() const;
180 
185  FrictionController* getRotationalFrictionControllerN() const;
186 
191  void setRotationalFrictionCoefficients(Real frictionCoefficient);
192 
197  RealVector getRotationalFrictionCoefficients() const;
198 
204  TwistRangeController* getTwistRangeController() const;
205 
207 
208  protected:
209  BallJoint();
210  BallJoint( class BallJointImplementation* impl );
211  virtual ~BallJoint();
212 
213  virtual void render( agxRender::RenderManager* mgr, float scale ) const override;
214 
215  private:
216  class BallJointImplementation* m_implementation;
217  };
218 
219 
230  {
231  public:
246  WorldFrameBallJoint( RigidBody* rb1, Frame* rb1AttachmentFrame, RigidBody* rb2 = nullptr, Frame* rb2AttachmentFrame = nullptr );
247 
249 
250  protected:
252  virtual ~WorldFrameBallJoint();
253 
254  private:
255  class WorldFrameBallJointImplementation* m_implementation;
256  };
257 
258 } // namespace agx
259 
agx::Real
double Real
Definition: Real.h:42
agx::FrictionController
Translational or rotational friction controller for Hinge, Prismatic and CylindricalJoint.
Definition: ElementaryConstraint.h:812
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:51
CALLABLE
#define CALLABLE
Definition: macros.h:72
agxRender::RenderManager
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
Definition: RenderManager.h:106
Constraint.h
AGXSTREAM_DECLARE_SERIALIZABLE
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
agx::VectorPOD< Real >
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agx::SetVector
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: SetVector.h:37
agx::Vec3
Vec3T< Real > Vec3
The object holding 3 dimensional vectors and providing basic arithmetic.
Definition: Vec3.h:36
agxModel::getCenter
AGXMODEL_EXPORT agx::Vec3 getCenter(const agxCollide::Mesh::Triangle &triangle)
agx::TwistRangeController
Twist range elementary constraint.
Definition: ElementaryConstraint.h:1266
agx::ConeLimit
Elementary secondary constraint to set a conic limit to a BallJoint.
Definition: ElementaryConstraint.h:1348
agx::BallJoint
Constraint that removes the three translation DOF between two bodies (or one and the world).
Definition: BallJoint.h:47
agx::WorldFrameBallJoint
Special version of a ball joint where the spatial reference frame is world for the body/bodies.
Definition: BallJoint.h:229
agx::BallJoint::DOF
DOF
Enum used for specifying which Degree of Freedom (DOF) that should be accessed in calls to for exampl...
Definition: BallJoint.h:88
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
agx::BallJointFrame
Class for storing the geometric information of a BallJoint.
Definition: BallJoint.h:26
agx::Constraint
The base class for a constraint.
Definition: Constraint.h:88
agx::Vec3T< Real >
agx::Frame
The object defining a frame of reference and providing transformations operations.
Definition: Frame.h:67