AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
ConstraintAngle.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. 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:
57 virtual void transform( const agx::AttachmentPair& );
58
63
68
72 const agx::Real& getValue() const;
73
79 virtual const agx::Vec3& getDir( const agx::AttachmentPair& ap, agx::UInt index ) const;
80
84 virtual void store( agxStream::OutputArchive& out ) const override;
85
89 virtual void restore( agxStream::InputArchive& in ) override;
90
92
96 virtual void storeLightData( agxStream::StorageStream& str ) const override;
97
101 virtual void restoreLightData( agxStream::StorageStream& str ) override;
102
103 protected:
107 Angle( agx::Angle::Axis axis, agx::Angle::Type type, agx::Real initialAngle = agx::Real( 0 ) );
108
112 virtual ~Angle();
113
114 protected:
118 };
119
122
127 {
128 public:
132 static agx::RotationalAngle* safeCast( const agx::Angle* angle );
133
134 public:
139
143 virtual void transform( const agx::AttachmentPair& ap ) override;
144
149
155 void setWindingNumber( agx::Int windingNumber );
156
161
166 void setLastAngle(agx::Real lastAngle);
167
173
175
179 virtual void storeLightData( agxStream::StorageStream& str ) const override;
180
184 virtual void restoreLightData( agxStream::StorageStream& str ) override;
185
186 protected:
191
196
197 protected:
200 };
201
203
208 {
209 public:
213 static agx::SeparationAngle* safeCast( const agx::Angle* angle );
214
215 public:
220
224 virtual void transform( const agx::AttachmentPair& ap ) override;
225
227
228 protected:
233
238 };
239
241
242
243
251 {
252 public:
257 ConeLimitAngle(bool useRotAngle);
258
263
267 virtual void transform(const AttachmentPair& ap) override;
268
276 virtual const Vec3& getDir(const AttachmentPair& ap, agx::UInt index) const override;
277
284
291
293
294 protected:
296
297 private:
298 Vec2 m_currentLimit;
299 Vec3 m_dir;
300 };
301
303
305 {
306 return m_value;
307 }
308} //namespace agx
309
310#endif
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
#define AGXPHYSICS_EXPORT
Class for reading a binary stream of serialized data.
Class for writing serialized data in binary format to a stream.
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Abstract base class for storing/restoring a line/drums with version control.
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 const agx::Vec3 & getDir(const agx::AttachmentPair &ap, agx::UInt index) const
virtual void restore(agxStream::InputArchive &in) override
Restore given stream.
virtual ~Angle()
Reference counted object, protected destructor.
agx::Angle::Type getType() const
agx::Real m_value
const agx::Real & getValue() const
virtual void transform(const agx::AttachmentPair &)
Transform method to update the value of this angle.
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::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 transform(const agx::AttachmentPair &ap) override
Update value given constraint pair.
virtual void restoreLightData(agxStream::StorageStream &str) override
Restore structural independent data from stream.
RotationalAngle()
Default constructor used during restore.
agx::Int getWindingNumber() const
void setLastAngle(agx::Real lastAngle)
Set the last angle bewteen (-pi, +pi) (winding number NOT included)
agx::Real calculateCurrentAngle(const AttachmentPair &ap) const
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.
#define AGX_FORCE_INLINE
Definition macros.h:58
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
agx::ref_ptr< RotationalAngle > RotationalAngleRef
ref_ptr< ConeLimitAngle > ConeLimitAngleRef
uint64_t UInt
Definition Integer.h:27
double Real
Definition Real.h:42
agx::Vector< AngleRef > AngleContainer
agx::ref_ptr< Angle > AngleRef
agx::ref_ptr< SeparationAngle > SeparationAngleRef
int64_t Int
Definition Integer.h:28