AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ConstraintAngle.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. 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 
163 
167  virtual void storeLightData( agxStream::StorageStream& str ) const override;
168 
172  virtual void restoreLightData( agxStream::StorageStream& str ) override;
173 
174  protected:
178  RotationalAngle();
179 
183  virtual ~RotationalAngle();
184 
185  protected:
188  };
189 
191 
196  {
197  public:
201  static agx::SeparationAngle* safeCast( const agx::Angle* angle );
202 
203  public:
207  SeparationAngle( agx::Angle::Axis axis, agx::Real initialAngle = agx::Real( 0 ) );
208 
212  virtual void transform( const agx::AttachmentPair& ap ) override;
213 
215 
216  protected:
220  SeparationAngle();
221 
225  virtual ~SeparationAngle();
226  };
227 
229 
231  {
232  return m_value;
233  }
234 } //namespace agx
235 
236 #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
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:62
Implementation of constraint angle ALONG an axis.
Base class providing referencing counted objects.
Definition: Referenced.h:113
uint32_t UInt
Definition: Integer.h:34
Constraint attachment pair class.
Definition: Attachment.h:300
Axis is along U, V or N.
Constraint x axis.
const agx::Real & getValue() const
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
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:206
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:220
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
GLenum type
Definition: gl.h:5539