AGX Dynamics  2.35.0.1
TranslationalDimension.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 #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 
88  virtual agx::Real getOutputLoad() const override;
89  virtual agx::Real getInputLoad() const override;
90  agx::Real getOutputForce() const;
91  agx::Real getInputForce() const;
92 
93 
97  virtual agx::Real getPowerIn() const override;
98  virtual agx::Real getPowerOut() const override;
99 
103  virtual agx::Vec3 getWorldDirection() const;
104 
112  static agxPowerLine::PhysicalDimension::Type getStaticType();
113 
117  virtual bool store(agxStream::StorageStream& out) const override;
118 
122  virtual bool restore(agxStream::StorageStream& in) override;
123 
124  AGXSTREAM_DECLARE_SERIALIZABLE(agxPowerLine::TranslationalDimension);
125 
126  protected:
127  TranslationalDimension();
128  virtual ~TranslationalDimension();
129  };
130 
131 
132  typedef agx::ref_ptr<TranslationalDimension> TranslationalDimensionRef;
133 
137  class AGXMODEL_EXPORT TranslationalConnector : public agxPowerLine::Connector
138  {
139  public:
140  TranslationalConnector();
141 
142  virtual PhysicalDimensionMultiBodyConstraintImplementation* createConstraint() override;
143  virtual agx::RegularizationParameters::VariableType calculateComplianceAndDamping( const agx::Real timeStep, agx::Real& compliance, agx::Real& damping) override;
144 
148  virtual bool store(agxStream::StorageStream& out) const override;
149 
153  virtual bool restore(agxStream::StorageStream& in) override;
154 
155  AGXSTREAM_DECLARE_SERIALIZABLE(agxPowerLine::TranslationalConnector);
156 
157  protected:
158  virtual ~TranslationalConnector() {}
159  };
160 
161  typedef agx::ref_ptr<TranslationalConnector> TranslationalConnectorRef;
162 
164 }
165 
166 #endif // AGXMODEL_TRANSLATIONAL_DIMENSION_H
#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
Links two connections together.
Definition: Connector.h:54
Pure virtual class.
Definition: Unit.h:73
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
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
agxPowerLine contains a collection of connected components that transport power across a system.
Definition: MotorUnit.h:24
DirectionReference
The DirectionReference specifies what the direction attribute of a DimensionState is relative to.
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.
double Real
Definition: Real.h:42