AGX Dynamics 2.40.0.0
Loading...
Searching...
No Matches
Hinge.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#pragma once
17
18#include <agx/Constraint.h>
19
20namespace agx
21{
22
27 class CALLABLE AGXPHYSICS_EXPORT HingeFrame : public agx::ConstraintFrame
28 {
29 public:
34
39 HingeFrame( const Vec3& center, const Vec3& axis );
40
42
47 void setAxis( const Vec3& axis );
48
53 void setCenter( const Vec3& center );
54
60 void setHinge( const Vec3& center, const Vec3& axis );
61
66 const Vec3& getAxis() const;
67 };
68
104 {
105 public:
110
120 Hinge( const HingeFrame& hf, RigidBody* rb1, RigidBody* rb2 = 0 );
121
135 Hinge( RigidBody* rb1, Frame* rb1AttachmentFrame, RigidBody* rb2 = nullptr, Frame* rb2AttachmentFrame = nullptr );
136
145 bool addRigidBody( RigidBody* rb, Frame* rbAttachmentFrame );
146
151 enum DOF
152 {
153 ALL_DOF=-1,
154 TRANSLATIONAL_1=0,
155 TRANSLATIONAL_2=1,
156 TRANSLATIONAL_3=2,
157 ROTATIONAL_1=3,
158 ROTATIONAL_2=4,
159 NUM_DOF=5
160 };
161
165 int getNumDOF() const override;
166
168
169 protected:
170 virtual ~Hinge();
171
175 virtual void render( class agxRender::RenderManager *mgr, float scale ) const override;
176
177 private:
178 class HingeImplementation *m_implementation;
179 };
180
181
182} //namespace agx
183
#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:208
#define AGXPHYSICS_EXPORT
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
Specialization for constraints that have only one degree of freedom such as Hinge and Prismatic.
Definition: Constraint.h:710
The object defining a frame of reference and providing transformations operations.
Definition: agx/Frame.h:68
Specialization for the constraint frame class that add convenient accessors/mutator methods for manip...
Definition: Hinge.h:28
const Vec3 & getAxis() const
Get the hinge axis.
void setHinge(const Vec3 &center, const Vec3 &axis)
Sets all parameters needed to create a hinge.
HingeFrame(const Vec3 &center, const Vec3 &axis)
void setCenter(const Vec3 &center)
Sets the center of the hinge in world coordinates.
void setAxis(const Vec3 &axis)
Sets the axis of the hinge in world coordinates.
HingeFrame()
Default constructor: rotational axis is along Z.
The hinge constraint between two rigid bodies or one rigid body and the world.
Definition: Hinge.h:104
int getNumDOF() const override
Hinge()
Default constructor.
Hinge(RigidBody *rb1, Frame *rb1AttachmentFrame, RigidBody *rb2=nullptr, Frame *rb2AttachmentFrame=nullptr)
Create hinge given attachment frames and one or two rigid bodies.
bool addRigidBody(RigidBody *rb, Frame *rbAttachmentFrame)
Create hinge given attachment frame and one body at the time.
virtual ~Hinge()
virtual void render(class agxRender::RenderManager *mgr, float scale) const override
Used internally for debug rendering.
Hinge(const HingeFrame &hf, RigidBody *rb1, RigidBody *rb2=0)
Create hinge given a hinge frame (world coordinates) and one or two rigid bodies.
DOF
Enum used for specifying which Degree of Freedom (DOF) that should be accessed in calls to for exampl...
Definition: Hinge.h:152
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:52
#define CALLABLE
Definition: macros.h:72
The agx namespace contains the dynamics/math part of the AGX Dynamics API.