AGX Dynamics  2.37.2.0
ConstraintAngle.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. 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_CONSTRAINTANGLE_H
18 #define AGX_CONSTRAINTANGLE_H
19 
20 #include <agx/Vec3.h>
21 
22 #include <agxStream/Serializable.h>
23 
24 namespace 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 
62  agx::Angle::Axis getAxis() const;
63 
67  agx::Angle::Type getType() const;
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:
138  RotationalAngle( agx::Angle::Axis axis, agx::Real initialAngle = agx::Real( 0 ) );
139 
143  virtual void transform( const agx::AttachmentPair& ap ) override;
144 
148  agx::Int getWindingNumber() const;
149 
155  void setWindingNumber( agx::Int windingNumber );
156 
160  agx::Real getLastAngle() const;
161 
166  void setLastAngle(agx::Real lastAngle);
167 
172  agx::Real calculateCurrentAngle(const AttachmentPair& ap) const;
173 
175 
179  virtual void storeLightData( agxStream::StorageStream& str ) const override;
180 
184  virtual void restoreLightData( agxStream::StorageStream& str ) override;
185 
186  protected:
190  RotationalAngle();
191 
195  virtual ~RotationalAngle();
196 
197  protected:
200  };
201 
203 
208  {
209  public:
213  static agx::SeparationAngle* safeCast( const agx::Angle* angle );
214 
215  public:
219  SeparationAngle( agx::Angle::Axis axis, agx::Real initialAngle = agx::Real( 0 ) );
220 
224  virtual void transform( const agx::AttachmentPair& ap ) override;
225 
227 
228  protected:
232  SeparationAngle();
233 
237  virtual ~SeparationAngle();
238  };
239 
241 
242 
243 
251  {
252  public:
257  ConeLimitAngle(bool useRotAngle);
258 
262  ConeLimitAngle();
263 
267  virtual void transform(const AttachmentPair& ap) override;
268 
276  virtual const Vec3& getDir(const AttachmentPair& ap, agx::UInt index) const override;
277 
283  void setConeLimitRange(Vec2 limit);
284 
290  Vec2 getConeLimitRange() const;
291 
293 
294  protected:
295  bool m_useRotAngle;
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
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
Definition: InputArchive.h:400
AGXCORE_EXPORT Type * getType(const agx::String &name)
Constraint y axis.
agx::ref_ptr< RotationalAngle > RotationalAngleRef
Implementation of angle for the cone limit.
agx::Real m_value
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive...
agx::Vector< AngleRef > AngleContainer
void AGXCORE_EXPORT transform(void *target, const Format *targetFormat, const void *source, const Format *sourceFormat, size_t numElements)
Transform data between two buffers.
#define AGXPHYSICS_EXPORT
int32_t Int
Definition: Integer.h:35
#define AGX_FORCE_INLINE
Definition: Object.h:59
Implementation of constraint angle ALONG an axis.
const agx::Real & getValue() const
Base class providing referencing counted objects.
Definition: Referenced.h:119
uint32_t UInt
Definition: Integer.h:34
Constraint attachment pair class.
Definition: Attachment.h:300
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Axis is along U, V or N.
Constraint x axis.
ref_ptr< ConeLimitAngle > ConeLimitAngleRef
Constraint angle class.
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:48
#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
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
Axis
Axis this constraint angle is defined about or along.
#define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(T)
Use this in a pure abstract Serializable class to add the required methods Important: Use full namesp...
Definition: Serializable.h:221
Type
Type, i.e., defines Axis as &#39;along&#39; or &#39;about&#39;.
agx::ref_ptr< Angle > AngleRef
Implementation of constraint angle ABOUT an axis.
double Real
Definition: Real.h:42
agx::ref_ptr< SeparationAngle > SeparationAngleRef