AGX Dynamics  2.35.0.1
BallJoint.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. 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 
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 
102 
103  protected:
105  BallJoint( class BallJointImplementation* impl );
106  virtual ~BallJoint();
107 
108  virtual void render( agxRender::RenderManager* mgr, float scale ) const override;
109 
110  private:
111  class BallJointImplementation* m_implementation;
112  };
113 
115 
125  {
126  public:
141  WorldFrameBallJoint( RigidBody* rb1, Frame* rb1AttachmentFrame, RigidBody* rb2 = nullptr, Frame* rb2AttachmentFrame = nullptr );
142 
144 
145  protected:
148 
149  private:
150  class WorldFrameBallJointImplementation* m_implementation;
151  };
152 
154 
155 } // namespace agx
156 
157 #endif // AGX_BALLJOINT_H
#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
#define AGXPHYSICS_EXPORT
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
Class for storing the geometric information of a BallJoint.
Definition: BallJoint.h:28
BallJointFrame(const Vec3 &center)
void setCenter(const Vec3 &center)
const Vec3 & getCenter() const
~BallJointFrame()
Destructor.
Constraint that removes the three translation DOF between two bodies (or one and the world).
Definition: BallJoint.h:48
virtual void render(agxRender::RenderManager *mgr, float scale) const override
Inherited method of how to render this constraint into DebugRenderer.
virtual ~BallJoint()
BallJoint(RigidBody *rb1, Frame *rb1AttachmentFrame, RigidBody *rb2=nullptr, Frame *rb2AttachmentFrame=nullptr)
Create a Ball Joint given one or two bodies with their respective attachment frames.
BallJoint(class BallJointImplementation *impl)
BallJoint(RigidBody *rb1, const Vec3 &rb1LocalAttachPoint, RigidBody *rb2=nullptr, const Vec3 &rb2LocalAttachPoint=Vec3())
Create a Ball Joint given one or two bodies with relative attachment points.
DOF
Enum used for specifying which Degree of Freedom (DOF) that should be accessed in calls to for exampl...
Definition: BallJoint.h:88
virtual int getNumDOF() const override
BallJoint(const BallJointFrame &bf, RigidBody *rb1, RigidBody *rb2=0)
Constructor that creates a Ball Joint.
The base class for a constraint.
Definition: Constraint.h:89
The object defining a frame of reference and providing transformations operations.
Definition: agx/Frame.h:68
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
Special version of a ball joint where the spatial reference frame is world for the body/bodies.
Definition: BallJoint.h:125
WorldFrameBallJoint(RigidBody *rb1, Frame *rb1AttachmentFrame, RigidBody *rb2=nullptr, Frame *rb2AttachmentFrame=nullptr)
Create a Ball Joint given one or two bodies with their respective attachment frames.
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
#define CALLABLE
Definition: macros.h:72
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Vec3T< Real > Vec3
The object holding 3 dimensional vectors and providing basic arithmetic.
Definition: agx/Vec3.h:36
ref_ptr< WorldFrameBallJoint > WorldFrameBallJointRef
Definition: BallJoint.h:153
ref_ptr< BallJoint > BallJointRef
Definition: BallJoint.h:114