AGX Dynamics  2.37.3.2
TranslationalDimension.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 AGXPOWERLINE_TRANSLATIONAL_DIMENSION_H
18 #define AGXPOWERLINE_TRANSLATIONAL_DIMENSION_H
19 
20 #include <agxModel/export.h>
22 #include <agxPowerLine/Connector.h>
24 
26 
27 #include <agxUtil/agxUtil.h>
28 
29 #include <agx/RigidBody.h>
31 
32 namespace agxPowerLine
33 {
34 
36 
37  #define DEFAULT_TRANSLATIONAL_DIRECTION agx::Vec3(0, 1, 0)
38 
39  class TranslationalUnit;
40 
47  class AGXMODEL_EXPORT TranslationalDimension : public agxPowerLine::PhysicalDimension
48  {
49  public:
55  TranslationalDimension(agxPowerLine::Unit* unit);
56 
62  TranslationalDimension(
63  agxPowerLine::Unit* unit,
64  agx::RigidBody* body,
65  const agx::Vec3& direction,
66  agxPowerLine::DirectionReference directionReference,
67  bool externalBody = false);
68 
73  static std::string getStaticTypeName();
74 
78  virtual std::string getTypeName() const override;
79 
83  virtual void renderDebug() override;
84 
85  void setVelocity(agx::Real velocity);
86  agx::Real getVelocity() const;
87 
91  virtual agx::Real getOutputLoad() const override;
92  virtual agx::Real getInputLoad() const override;
93  agx::Real getOutputForce() const;
94  agx::Real getInputForce() const;
95 
96 
100  virtual agx::Real getPowerIn() const override;
101  virtual agx::Real getPowerOut() const override;
102 
106  virtual agx::Vec3 getWorldDirection() const;
107 
115  static agxPowerLine::PhysicalDimension::Type getStaticType();
116 
120  virtual bool store(agxStream::StorageStream& out) const override;
121 
125  virtual bool restore(agxStream::StorageStream& in) override;
126 
127  AGXSTREAM_DECLARE_SERIALIZABLE(agxPowerLine::TranslationalDimension);
128 
129  protected:
130  TranslationalDimension();
131  virtual ~TranslationalDimension();
132  };
133 
134 
135  typedef agx::ref_ptr<TranslationalDimension> TranslationalDimensionRef;
136 
140  class AGXMODEL_EXPORT TranslationalConnector : public agxPowerLine::Connector
141  {
142  public:
143  TranslationalConnector();
144 
145  virtual PhysicalDimensionMultiBodyConstraintImplementation* createConstraint() override;
146  virtual agx::RegularizationParameters::VariableType calculateComplianceAndDamping( const agx::Real timeStep, agx::Real& compliance, agx::Real& damping) override;
147 
151  virtual bool store(agxStream::StorageStream& out) const override;
152 
156  virtual bool restore(agxStream::StorageStream& in) override;
157 
158  AGXSTREAM_DECLARE_SERIALIZABLE(agxPowerLine::TranslationalConnector);
159 
160  protected:
161  virtual ~TranslationalConnector() {}
162  };
163 
164  typedef agx::ref_ptr<TranslationalConnector> TranslationalConnectorRef;
165 
167 }
168 
169 #endif // AGXMODEL_TRANSLATIONAL_DIMENSION_H
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
Links two connections together.
Definition: Connector.h:53
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...
Pure virtual class.
Definition: Unit.h:72
agxPowerLine contains a collection of connected components that transport power across a system...
Definition: MotorUnit.h:23
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:48
DirectionReference
The DirectionReference specifies what the direction attribute of a DimensionState is relative to...
#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 AGXMODEL_EXPORT
double Real
Definition: Real.h:42
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97