AGX Dynamics  2.35.0.1
DimensionStateStorage.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. 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 
18 #ifndef AGXPOWERLINE_DETAIL_DIMENSION_STATE_STORAGE
19 #define AGXPOWERLINE_DETAIL_DIMENSION_STATE_STORAGE
20 
21 
22 #include <agx/Vec3.h>
23 #include <agx/Jacobian.h>
24 
25 #include <agxModel/export.h>
26 
27 
28 
29 namespace agx
30 {
31  class RigidBody;
32 }
33 
34 namespace agxStream
35 {
36  class OutputArchive;
37  class InputArchive;
38  class StorageStream;
39 }
40 
41 
42 namespace agxPowerLine
43 {
44  namespace detail
45  {
46 
53  {
55 
56  agx::Vec3 getValue(const agx::RigidBody& body) const;
57 
58  agx::Real getValue(const agx::RigidBody& body, const agx::UInt8 slot) const;
59 
60  agx::Real getValue(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
61 
62  void setValue(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real angle);
63 
64  void setValue(agx::RigidBody& body, const agx::Vec3& worldDirection, const agx::Real angle);
65 
66  agx::Vec3 getGradient(const agx::RigidBody& body) const;
67 
68  agx::Real getGradient(const agx::RigidBody& body, const agx::UInt8 slot) const;
69 
70  agx::Real getGradient(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
71 
72  void setGradient(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real angularVelocity);
73 
74  void setGradient(agx::RigidBody& body, const agx::Vec3& worldDirection, const agx::Real angularVelocity);
75 
77 
78  agx::Real getSecondGradient(const agx::RigidBody& body, const agx::UInt8 slot) const;
79 
80  agx::Real getSecondGradient(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
81 
83 
85 
86  agx::Real getMassProperty(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
87 
88  bool setMassProperty(agx::RigidBody& body, const agx::Vec3& inertia);
89 
90  bool setMassProperty(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real inertia);
91 
92  bool setMassProperty(agx::RigidBody& body, const agx::Vec3& worldDirection, const agx::Real inertia);
93 
95 
96  agx::Real getAddedLoad(const agx::RigidBody& body, const agx::UInt8 slot) const;
97 
98  agx::Real getAddedLoad(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
99 
101 
102  void setAddedLoad(agx::RigidBody& body, const agx::Vec3& worldDirection, agx::Real load);
103 
104  void addLoad(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real load);
105 
106  void addLoad(agx::RigidBody& body, const agx::Vec3& worldDirection, const agx::Real load);
107 
109 
110  float getVelocityDamping(const agx::RigidBody& body, const agx::UInt8 slot) const;
111 
112  float getVelocityDamping(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
113 
114  void setVelocityDamping(agx::RigidBody& body, const agx::UInt8 slot, const float damping);
115 
116  void setVelocityDamping(agx::RigidBody& body, const agx::Vec3& worldDirection, const float damping);
117 
118  void move(agx::RigidBody& oldBody, const agx::UInt8 oldSlot, agx::RigidBody& newBody, const agx::UInt8 newSlot);
119 
120  void writeJacobian(agx::Jacobian6DOFElement& G, const agx::Vec3& jacobian) const;
121 
122  void integrateValue(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real timeStep);
123 
126  void store(agxStream::StorageStream& out, const agx::RigidBody& body, const agx::UInt8 slot) const;
128  void store(agxStream::StorageStream& out, const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
129  void restore(agxStream::StorageStream& in, agx::RigidBody& body, const agx::Vec3& worldDirection);
130 
131  static bool getAllowPacking();
132 
133  private:
134  agx::Real m_angle;
135  };
136 
137 
144  {
145  agx::Vec3 getValue(const agx::RigidBody& body) const;
146 
147  agx::Real getValue(const agx::RigidBody& body, agx::UInt8 slot) const;
148 
149  agx::Real getValue(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
150 
151  void setValue(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real position);
152 
153  void setValue(agx::RigidBody& body, const agx::Vec3& worldDirection, const agx::Real position);
154 
156 
157  agx::Real getGradient(const agx::RigidBody& body, const agx::UInt8 slot) const;
158 
159  agx::Real getGradient(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
160 
161  void setGradient(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real velocity);
162 
163  void setGradient(agx::RigidBody& body, const agx::Vec3& worldDirection, const agx::Real velocity);
164 
166 
167  agx::Real getSecondGradient(const agx::RigidBody& body, const agx::UInt8 slot) const;
168 
169  agx::Real getSecondGradient(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
170 
172 
174 
175  agx::Real getMassProperty(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
176 
177  bool setMassProperty(agx::RigidBody& body, const agx::Vec3& mass);
178 
179  bool setMassProperty(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real mass);
180 
181  bool setMassProperty(agx::RigidBody& body, const agx::Vec3& worldDirection, const agx::Real mass);
182 
184 
185  agx::Real getAddedLoad(const agx::RigidBody& body, const agx::UInt8 slot) const;
186 
187  agx::Real getAddedLoad(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
188 
190 
191  void setAddedLoad(agx::RigidBody& body, const agx::Vec3& worldDirection, agx::Real load);
192 
193  void addLoad(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real load);
194 
195  void addLoad(agx::RigidBody& body, const agx::Vec3& worldDirection, const agx::Real load);
196 
198 
199  float getVelocityDamping(const agx::RigidBody& body, const agx::UInt8 slot) const;
200 
201  float getVelocityDamping(const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
202 
203  void setVelocityDamping(agx::RigidBody& body, const agx::UInt8 slot, const float damping);
204 
205  void setVelocityDamping(agx::RigidBody& body, const agx::Vec3& worldDirection, const float damping);
206 
207  void move(agx::RigidBody& oldBody, const agx::UInt8 oldSlot, agx::RigidBody& newBody, const agx::UInt8 newSlot);
208 
209  void writeJacobian(agx::Jacobian6DOFElement& G, const agx::Vec3& jacobian) const;
210 
211  void integrateValue(agx::RigidBody& body, const agx::UInt8 slot, const agx::Real timeStep);
212 
215  void store(agxStream::StorageStream& out, const agx::RigidBody& body, const agx::UInt8 slot) const;
217  void store(agxStream::StorageStream& out, const agx::RigidBody& body, const agx::Vec3& worldDirection) const;
218  void restore(agxStream::StorageStream& in, agx::RigidBody& body, const agx::Vec3& worldDirection);
219 
220  static bool getAllowPacking();
221  };
222 
223 
224 
225  }
226 }
227 
228 
229 #endif
#define AGXMODEL_EXPORT
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:52
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:57
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:49
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
agxPowerLine contains a collection of connected components that transport power across a system.
Definition: MotorUnit.h:24
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
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
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.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
double Real
Definition: Real.h:42
uint8_t UInt8
Definition: Integer.h:38
RigidBody accessor helper that knows how to extract rotational data from a RigidBody.
bool setMassProperty(agx::RigidBody &body, const agx::UInt8 slot, const agx::Real inertia)
void restore(agxStream::StorageStream &in, agx::RigidBody &body, const agx::Vec3 &worldDirection)
agx::Real getSecondGradient(const agx::RigidBody &body, const agx::Vec3 &worldDirection) const
agx::Real getAddedLoad(const agx::RigidBody &body, const agx::Vec3 &worldDirection) const
void setVelocityDamping(agx::RigidBody &body, const agx::UInt8 slot, const float damping)
void store(agxStream::StorageStream &out, const agx::RigidBody &body, const agx::Vec3 &worldDirection) const
agx::Real getMassProperty(const agx::RigidBody &body, agx::UInt8 slot) const
void setGradient(agx::RigidBody &body, const agx::Vec3 &worldDirection, const agx::Real angularVelocity)
agx::Vec3 getValue(const agx::RigidBody &body) const
agx::Vec3f getVelocityDamping(const agx::RigidBody &body) const
void setAddedLoad(agx::RigidBody &body, agx::UInt8 slot, agx::Real load)
float getVelocityDamping(const agx::RigidBody &body, const agx::Vec3 &worldDirection) const
void integrateValue(agx::RigidBody &body, const agx::UInt8 slot, const agx::Real timeStep)
bool setMassProperty(agx::RigidBody &body, const agx::Vec3 &inertia)
bool setMassProperty(agx::RigidBody &body, const agx::Vec3 &worldDirection, const agx::Real inertia)
void addLoad(agx::RigidBody &body, const agx::Vec3 &worldDirection, const agx::Real load)
agx::Real getMassProperty(const agx::RigidBody &body, const agx::Vec3 &worldDirection) const
agx::Vec3 getSecondGradient(const agx::RigidBody &body) const
agx::Vec3 getGradient(const agx::RigidBody &body) const
void writeJacobian(agx::Jacobian6DOFElement &G, const agx::Vec3 &jacobian) const
agx::Vec3 getMassProperty(const agx::RigidBody &body) const
void move(agx::RigidBody &oldBody, const agx::UInt8 oldSlot, agx::RigidBody &newBody, const agx::UInt8 newSlot)
void setGradient(agx::RigidBody &body, const agx::UInt8 slot, const agx::Real angularVelocity)
void setAddedLoad(agx::RigidBody &body, const agx::Vec3 &worldDirection, agx::Real load)
void setValue(agx::RigidBody &body, const agx::Vec3 &worldDirection, const agx::Real angle)
agx::Real getGradient(const agx::RigidBody &body, const agx::UInt8 slot) const
void setVelocityDamping(agx::RigidBody &body, const agx::Vec3 &worldDirection, const float damping)
float getVelocityDamping(const agx::RigidBody &body, const agx::UInt8 slot) const
void store(agxStream::OutputArchive &out) const
agx::Real getValue(const agx::RigidBody &body, const agx::Vec3 &worldDirection) const
void restore(agxStream::StorageStream &in, agx::RigidBody &body, const agx::UInt8 slot)
agx::Real getAddedLoad(const agx::RigidBody &body, const agx::UInt8 slot) const
void store(agxStream::StorageStream &out, const agx::RigidBody &body, const agx::UInt8 slot) const
void setValue(agx::RigidBody &body, const agx::UInt8 slot, const agx::Real angle)
agx::Real getSecondGradient(const agx::RigidBody &body, const agx::UInt8 slot) const
agx::Real getValue(const agx::RigidBody &body, const agx::UInt8 slot) const
void addLoad(agx::RigidBody &body, const agx::UInt8 slot, const agx::Real load)
agx::Vec3 getAddedLoad(const agx::RigidBody &body) const
agx::Real getGradient(const agx::RigidBody &body, const agx::Vec3 &worldDirection) const
void restore(agxStream::InputArchive &in)
RigidBody accessor helper that knows how to extract translational data from a RigidBody.
void setVelocityDamping(agx::RigidBody &body, const agx::UInt8 slot, const float damping)
void setVelocityDamping(agx::RigidBody &body, const agx::Vec3 &worldDirection, const float damping)
void move(agx::RigidBody &oldBody, const agx::UInt8 oldSlot, agx::RigidBody &newBody, const agx::UInt8 newSlot)
agx::Real getMassProperty(const agx::RigidBody &body, agx::UInt8 slot) const
bool setMassProperty(agx::RigidBody &body, const agx::UInt8 slot, const agx::Real mass)
void setValue(agx::RigidBody &body, const agx::Vec3 &worldDirection, const agx::Real position)
agx::Real getGradient(const agx::RigidBody &body, const agx::UInt8 slot) const
void setAddedLoad(agx::RigidBody &body, const agx::Vec3 &worldDirection, agx::Real load)
void writeJacobian(agx::Jacobian6DOFElement &G, const agx::Vec3 &jacobian) const
agx::Vec3 getGradient(const agx::RigidBody &body) const
float getVelocityDamping(const agx::RigidBody &body, const agx::Vec3 &worldDirection) const
agx::Vec3 getAddedLoad(const agx::RigidBody &body) const
bool setMassProperty(agx::RigidBody &body, const agx::Vec3 &worldDirection, const agx::Real mass)
bool setMassProperty(agx::RigidBody &body, const agx::Vec3 &mass)
void restore(agxStream::StorageStream &in, agx::RigidBody &body, const agx::UInt8 slot)
agx::Real getValue(const agx::RigidBody &body, agx::UInt8 slot) const
agx::Real getGradient(const agx::RigidBody &body, const agx::Vec3 &worldDirection) const
void setGradient(agx::RigidBody &body, const agx::Vec3 &worldDirection, const agx::Real velocity)
agx::Real getSecondGradient(const agx::RigidBody &body, const agx::Vec3 &worldDirection) const
agx::Vec3 getValue(const agx::RigidBody &body) const
agx::Real getValue(const agx::RigidBody &body, const agx::Vec3 &worldDirection) const
agx::Real getAddedLoad(const agx::RigidBody &body, const agx::Vec3 &worldDirection) const
agx::Real getAddedLoad(const agx::RigidBody &body, const agx::UInt8 slot) const
void addLoad(agx::RigidBody &body, const agx::Vec3 &worldDirection, const agx::Real load)
agx::Vec3 getSecondGradient(const agx::RigidBody &body) const
void setValue(agx::RigidBody &body, const agx::UInt8 slot, const agx::Real position)
void store(agxStream::StorageStream &out, const agx::RigidBody &body, const agx::Vec3 &worldDirection) const
agx::Real getSecondGradient(const agx::RigidBody &body, const agx::UInt8 slot) const
void addLoad(agx::RigidBody &body, const agx::UInt8 slot, const agx::Real load)
void setAddedLoad(agx::RigidBody &body, agx::UInt8 slot, agx::Real load)
agx::Real getMassProperty(const agx::RigidBody &body, const agx::Vec3 &worldDirection) const
void store(agxStream::StorageStream &out, const agx::RigidBody &body, const agx::UInt8 slot) const
void restore(agxStream::InputArchive &in)
void integrateValue(agx::RigidBody &body, const agx::UInt8 slot, const agx::Real timeStep)
agx::Vec3 getMassProperty(const agx::RigidBody &body) const
void setGradient(agx::RigidBody &body, const agx::UInt8 slot, const agx::Real velocity)
void store(agxStream::OutputArchive &out) const
float getVelocityDamping(const agx::RigidBody &body, const agx::UInt8 slot) const
agx::Vec3f getVelocityDamping(const agx::RigidBody &body) const
void restore(agxStream::StorageStream &in, agx::RigidBody &body, const agx::Vec3 &worldDirection)