AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
BallJoint.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agx/Constraint.h>
20
21namespace agx
22{
26 class CALLABLE AGXPHYSICS_EXPORT BallJointFrame : public ConstraintFrame
27 {
28 public:
30
34 BallJointFrame( const Vec3& center );
35
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
107
114 const ConeLimit* getConeLimit() const;
115
124
130 void setEnableConeLimitFriction(bool enable);
131
137 void setConeLimitFrictionCoefficients(Real frictionCoefficient);
138
144
150
156
162
168
174
180
186
191 void setRotationalFrictionCoefficients(Real frictionCoefficient);
192
198
205
207
208 protected:
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:
253
254 private:
255 class WorldFrameBallJointImplementation* m_implementation;
256 };
257
258} // namespace agx
259
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#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:27
const Vec3 & getCenter() const
BallJointFrame(const Vec3 &center)
void setCenter(const Vec3 &center)
~BallJointFrame()
Destructor.
Constraint that removes the three translation DOF between two bodies (or one and the world).
Definition: BallJoint.h:48
void setEnableConeLimitFriction(bool enable)
Enable/disable all the FrictionControllers connected to the ConeLimit, which sets friction on the lim...
FrictionController * getRotationalFrictionControllerU() const
Get the FrictionController that controls the friction around the U-axis.
FrictionController * getConeLimitFrictionControllerLimit() const
Get the FrictionController that acts along the cone limit.
void setEnableRotationalFriction(bool enable)
Enable/disable rotational friction for all rotational directions of the BallJoint.
FrictionControllerRefSetVector getRotationalFrictionControllers() const
Get all three FrictionControllers that control the rotational friction of the BallJoint.
ConeLimit * getConeLimit()
Get ConeLimit, which can limit the movement of the first body in this constraint, relative to the sec...
RealVector getRotationalFrictionCoefficients() const
Get the friction coefficients of all the rotational friction controllers.
virtual void render(agxRender::RenderManager *mgr, float scale) const override
Inherited method of how to render this constraint into DebugRenderer.
FrictionController * getRotationalFrictionControllerN() const
Get the FrictionController that controls the friction around the N-axis.
virtual ~BallJoint()
FrictionController * getConeLimitFrictionControllerRotational() const
Get the FrictionController that acts on rotations on the cone limit.
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.
RealVector getConeLimitFrictionCoefficients() const
Get the friction coefficients of all the cone limit friction controllers.
void setRotationalFrictionCoefficients(Real frictionCoefficient)
Set the friction coefficient for all rotational FrictionControllers of the BallJoint.
BallJoint(class BallJointImplementation *impl)
const ConeLimit * getConeLimit() const
Get ConeLimit, which can limit the movement of the first body in this constraint, relative to the sec...
FrictionControllerRefSetVector getConeLimitFrictionControllers() const
Get FrictionControllers that control the friction on the limit of the ConeLimit.
TwistRangeController * getTwistRangeController() const
Get TwistRange secondary constraint, making it possible to limit the twist of the first frame relativ...
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.
FrictionController * getRotationalFrictionControllerV() const
Get the FrictionController that controls the friction around the V-axis.
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.
void setConeLimitFrictionCoefficients(Real frictionCoefficient)
Set the friction coefficient for all the FrictionControllers connected to the ConeLimit.
Elementary secondary constraint to set a conic limit to a BallJoint.
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
Translational or rotational friction controller for Hinge, Prismatic and CylindricalJoint.
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:49
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: SetVector.h:38
Twist range elementary constraint.
Special version of a ball joint where the spatial reference frame is world for the body/bodies.
Definition: BallJoint.h:230
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.
#define CALLABLE
Definition: macros.h:72
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
double Real
Definition: Real.h:41