AGX Dynamics 2.42.3.0
Loading...
Searching...
No Matches
ConstraintAngle.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#ifndef AGX_CONSTRAINTANGLE_H
18#define AGX_CONSTRAINTANGLE_H
19
20#include <agx/Vec3.h>
21
23
24namespace agx
25{
26 class AttachmentPair;
27
32 {
33 public:
37 enum Axis
38 {
39 U,
40 V,
41 N
42 };
43
47 enum Type
48 {
50 ROTATIONAL
51 };
52
53 public:
58 virtual void transform( const agx::AttachmentPair& ap );
59
65 virtual void onPostSolve( const agx::AttachmentPair& ap, agx::Real dt );
66
71
76
80 agx::Real getValue() const;
81
87 virtual const agx::Vec3& getDir( const agx::AttachmentPair& ap, agx::UInt index ) const;
88
92 virtual void store( agxStream::OutputArchive& out ) const override;
93
97 virtual void restore( agxStream::InputArchive& in ) override;
98
100
104 virtual void storeLightData( agxStream::StorageStream& str ) const override;
105
109 virtual void restoreLightData( agxStream::StorageStream& str ) override;
110
111 protected:
115 Angle( agx::Angle::Axis axis, agx::Angle::Type type, agx::Real initialAngle = agx::Real( 0 ) );
116
120 virtual ~Angle();
121
122 protected:
126 };
127
130
135 {
136 public:
140 static agx::RotationalAngle* safeCast( const agx::Angle* angle );
141
142 public:
151
155 virtual void transform( const agx::AttachmentPair& ap ) override;
156
162 virtual void onPostSolve( const agx::AttachmentPair& ap, agx::Real dt ) override;
163
168
174 void setWindingNumber( agx::Int windingNumber );
175
180
185 void setLastAngle( agx::Real lastAngle );
186
188
192 virtual void storeLightData( agxStream::StorageStream& str ) const override;
193
197 virtual void restoreLightData( agxStream::StorageStream& str ) override;
198
199 protected:
204
205 protected:
210
220 virtual void transformImpl( const agx::AttachmentPair& ap, bool firstIsReference );
221
227 virtual void stepBy( agx::Real deltaAngle );
228
236 virtual void stepAbout( const agx::Vec3& worldAxis, const AttachmentPair& ap, agx::Real dt );
237
238 protected:
241 };
242
244
249 {
250 public:
254 static agx::SeparationAngle* safeCast( const agx::Angle* angle );
255
256 public:
261
265 virtual void transform( const agx::AttachmentPair& ap ) override;
266
268
269 protected:
274
279 };
280
282
283
284
292 {
293 public:
298 ConeLimitAngle(bool useRotAngle);
299
304
308 virtual void transform(const AttachmentPair& ap) override;
309
317 virtual const Vec3& getDir(const AttachmentPair& ap, agx::UInt index) const override;
318
325
332
334
335 protected:
337
338 private:
339 Vec2 m_currentLimit;
340 Vec3 m_dir;
341 };
342
344
345 inline Real Angle::getValue() const
346 {
347 return m_value;
348 }
349} //namespace agx
350
351#endif
#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 reading a binary stream of serialized data.
Definition: InputArchive.h:51
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:57
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:49
Constraint angle class.
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(agx::Angle)
virtual void storeLightData(agxStream::StorageStream &str) const override
Store structural independent data to stream.
Angle(agx::Angle::Axis axis, agx::Angle::Type type, agx::Real initialAngle=agx::Real(0))
Construct given axis and initial angle.
virtual void transform(const agx::AttachmentPair &ap)
Transform method to update the value of this angle.
virtual const agx::Vec3 & getDir(const agx::AttachmentPair &ap, agx::UInt index) const
virtual void restore(agxStream::InputArchive &in) override
Restore given stream.
virtual void onPostSolve(const agx::AttachmentPair &ap, agx::Real dt)
Post solvers, velocity dependent variables should be updated.
virtual ~Angle()
Reference counted object, protected destructor.
agx::Angle::Type getType() const
agx::Real m_value
Type
Type, i.e., defines Axis as 'along' or 'about'.
@ TRANSLATIONAL
Axis is along U, V or N.
Axis
Axis this constraint angle is defined about or along.
@ V
Constraint y axis.
@ U
Constraint x axis.
agx::Real getValue() const
agx::Angle::Axis getAxis() const
virtual void store(agxStream::OutputArchive &out) const override
Store given stream.
virtual void restoreLightData(agxStream::StorageStream &str) override
Restore structural independent data from stream.
Constraint attachment pair class.
Implementation of angle for the cone limit.
ConeLimitAngle(bool useRotAngle)
Constructor for cone limit angle.
virtual const Vec3 & getDir(const AttachmentPair &ap, agx::UInt index) const override
Get the direction along the cone limit or of the axis given the attachment pair, depending on the cas...
void setConeLimitRange(Vec2 limit)
Set the ConeLimit range, in radians.
ConeLimitAngle()
Default constructor.
Vec2 getConeLimitRange() const
Get the ConeLimit range, in radians.
virtual void transform(const AttachmentPair &ap) override
Transform method to update the values of this Angle.
Base class providing referencing counted objects.
Definition: Referenced.h:120
Implementation of constraint angle ABOUT an axis.
virtual void storeLightData(agxStream::StorageStream &str) const override
Store structural independent data to stream.
virtual ~RotationalAngle()
Reference counted object, protected destructor.
RotationalAngle(agx::Angle::Axis axis, agx::Real initialAngle=agx::Real(0))
Construct given axis and initial angle.
void setWindingNumber(agx::Int windingNumber)
Use with caution since each values of windingNumber represent plus or minus 360 degrees of the joint ...
static agx::RotationalAngle * safeCast(const agx::Angle *angle)
Utility cast method.
agx::Real getLastAngle() const
virtual void stepBy(agx::Real deltaAngle)
Integrate/step parameters given a delta angle.
virtual void onPostSolve(const agx::AttachmentPair &ap, agx::Real dt) override
Updates winding number given angular speed about our axis.
virtual void transform(const agx::AttachmentPair &ap) override
Update value given constraint pair.
virtual void restoreLightData(agxStream::StorageStream &str) override
Restore structural independent data from stream.
virtual void stepAbout(const agx::Vec3 &worldAxis, const AttachmentPair &ap, agx::Real dt)
Integrate/step parameters given world axis.
RotationalAngle()
Default constructor used during restore.
agx::Int getWindingNumber() const
void setLastAngle(agx::Real lastAngle)
Set the last angle between (-pi, +pi) (winding number NOT included)
virtual void transformImpl(const agx::AttachmentPair &ap, bool firstIsReference)
The default behavior is that the first attachment is the reference frame.
Implementation of constraint angle ALONG an axis.
virtual ~SeparationAngle()
Reference counted object, protected destructor.
SeparationAngle()
Default constructor used during restore.
SeparationAngle(agx::Angle::Axis axis, agx::Real initialAngle=agx::Real(0))
Construct given axis and initial angle.
virtual void transform(const agx::AttachmentPair &ap) override
Update value given constraint pair.
static agx::SeparationAngle * safeCast(const agx::Angle *angle)
Utility cast method.
Templated vector class.
Definition: agx/Vector.h:53
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
agx::Vector< AngleRef > AngleContainer
agx::ref_ptr< RotationalAngle > RotationalAngleRef
uint64_t UInt
Definition: Integer.h:27
double Real
Definition: Real.h:41
agx::ref_ptr< Angle > AngleRef
agx::ref_ptr< SeparationAngle > SeparationAngleRef
ref_ptr< ConeLimitAngle > ConeLimitAngleRef
int64_t Int
Definition: Integer.h:28