AGX Dynamics  2.37.2.0
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 #ifndef AGX_BALLJOINT_H
18 #define AGX_BALLJOINT_H
19 
20 #include <agx/Constraint.h>
21 
22 namespace agx
23 {
27  class CALLABLE AGXPHYSICS_EXPORT BallJointFrame : public ConstraintFrame
28  {
29  public:
31 
35  BallJointFrame( const Vec3& center );
36 
38  ~BallJointFrame();
39 
40  void setCenter( const Vec3& center );
41  const Vec3& getCenter() const;
42  };
43 
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 
220 
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 
259 
260 } // namespace agx
261 
262 #endif // AGX_BALLJOINT_H
Vec3T< Real > Vec3
The object holding 3 dimensional vectors and providing basic arithmetic.
Definition: Vec3.h:36
Elementary secondary constraint to set a conic limit to a BallJoint.
#define AGXPHYSICS_EXPORT
ref_ptr< BallJoint > BallJointRef
Definition: BallJoint.h:219
The base class for a constraint.
Definition: Constraint.h:88
Special version of a ball joint where the spatial reference frame is world for the body/bodies...
Definition: BallJoint.h:229
Translational or rotational friction controller for Hinge, Prismatic and CylindricalJoint.
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc...
AGXMODEL_EXPORT agx::Vec3 getCenter(const agxCollide::Mesh::Triangle &triangle)
DOF
Enum used for specifying which Degree of Freedom (DOF) that should be accessed in calls to for exampl...
Definition: BallJoint.h:88
Constraint that removes the three translation DOF between two bodies (or one and the world)...
Definition: BallJoint.h:47
Twist range elementary constraint.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
#define CALLABLE
Definition: Object.h:73
The object defining a frame of reference and providing transformations operations.
Definition: Frame.h:67
#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
Class for storing the geometric information of a BallJoint.
Definition: BallJoint.h:27
ref_ptr< WorldFrameBallJoint > WorldFrameBallJointRef
Definition: BallJoint.h:258
double Real
Definition: Real.h:42
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: SetVector.h:37