AGX Dynamics  2.37.2.0
VirtualConstraintInertia.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 without having a written signed agreement with Algoryx Simulation AB.
9 
10 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
11 from using this software, unless otherwise stated in written agreements with
12 Algoryx Simulation AB.
13 */
14 
15 #ifndef AGX_VIRTUALCONSTRAINTINERTIA_H
16 #define AGX_VIRTUALCONSTRAINTINERTIA_H
17 
18 #include <agx/StrongInteraction.h>
19 #include <agx/agx_valarray_types.h>
20 #include <agx/Constraint.h>
21 
22 namespace agx
23 {
25 
36  {
37  public:
48  agx::Real rigidBody1TranslationInertia,
49  agx::Real rigidBody1RotationalInertia,
50  agx::Real rigidBody2TranslationInertia,
51  agx::Real rigidBody2RotationalInertia);
52 
53  public:
58  void setRigidBody1TranslationalInertia(agx::Real translationalInertia);
59 
64  void setRigidBody2TranslationalInertia(agx::Real translationalInertia);
65 
71  void setRigidBody1RotationalInertia(agx::Real rotationalInertia);
72 
78  void setRigidBody2RotationalInertia(agx::Real rotationalInertia);
79 
84  agx::Real getRigidBody1TranslationalInertia() const;
85 
91  agx::Real getRigidBody1RotationalInertia() const;
92 
97  agx::Real getRigidBody2TranslationalInertia() const;
98 
104  agx::Real getRigidBody2RotationalInertia() const;
105 
109  virtual agx::RigidBody* getRigidBody1() const override;
110 
114  virtual agx::RigidBody* getRigidBody2() const override;
115 
117 
118  protected:
123 
127  virtual ~VirtualConstraintInertia();
128 
132  virtual void prepare() override;
133 
137  virtual void writeMatrixData(agx::StrongInteraction::MatrixData rb1DiagonalBlock,
138  agx::StrongInteraction::MatrixData rb2DiagonalBlock,
139  agx::StrongInteraction::MatrixData offDiagonalBlock) override;
140 
144  virtual void writeRhs(agx::Physics::RigidBodyPtr rb1,
145  agx::Real* rb1Rhs,
147  agx::Real* rb2Rhs,
148  agx::Bool isRestingSolve) override;
149 
150  protected:
151  struct Transformed
152  {
157 
158  void reset()
159  {
160  addedMassMatrix1.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );
161  addedMassMatrix2.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );
162  addedInertiaMatrix1.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );
163  addedInertiaMatrix2.set( 0, 0, 0, 0, 0, 0, 0, 0, 0 );
164  }
165  };
166 
167  protected:
174  };
175 }
176 
177 #endif /*AGX_VIRTUALINERTIAINTERACTION_H*/
bool Bool
Definition: Integer.h:48
Base class for a strong interaction concept where there interaction is defined in the mass matrix par...
#define AGXPHYSICS_EXPORT
The base class for a constraint.
Definition: Constraint.h:88
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
Pointer to a entity instance of type Physics.RigidBody.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
This class will add a virtual inertia along or around the constraint axis (N-axis), which will affect the resulting rotational or translational acceleration on the affected rigid bodies.
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
#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
double Real
Definition: Real.h:42
void set(T const *const ptr)
Definition: Matrix3x3.h:481