AGX Dynamics  2.35.0.1
GenericConstraint.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 #pragma once
18 
19 #include <agx/Constraint.h>
21 
22 namespace agx
23 {
24  class GenericConstraintComplianceMatrix;
25 
54  {
55  public:
63 
72 
81 
94  void setSupportComplianceMatrix( agx::Bool enable, agx::Bool isStaticSize = false );
95 
103 
112 
113  public:
117  virtual void onAddNotification();
118 
122  virtual void onRemoveNotification();
123 
131 
135  virtual void onPostSolve();
136 
143 
144  public:
145 #ifndef SWIG
146  static void onPreSolveCallback( const agxSDK::Simulation* simulation );
147  static void onPostSolveCallback( const agxSDK::Simulation* simulation );
148  static void onCleanup( const agxSDK::Simulation* simulation );
149 #endif
150 
151  public:
152  int getNumDOF() const override;
153  void render( class agxRender::RenderManager* manager, float scale ) const override;
154 
155  protected:
157 
158 #ifndef SWIG
159  virtual void addNotification() override;
160  virtual void removeNotification() override;
161 #endif
162  };
163 
173  {
174  public:
181 
187  Real get( UInt32 row, UInt32 col ) const;
188 
194  void set( UInt32 row, UInt32 col, Real value );
195 
199  UInt32 size() const;
200 
206  void reset( UInt32 size );
207 
212 
217 
218  protected:
223 
224  private:
228  UInt32 calculateIndex( UInt32 row, UInt32 col ) const;
229 
233  UInt32 arraySize() const;
234 
235  private:
236  RealVector m_data;
237  UInt32 m_size;
238  UInt32 m_maxSize;
239  Bool m_isStaticSize;
240  UInt32Vector m_diagonalUpdates;
241  };
242 
244 }
#define AGXPHYSICS_EXPORT
#define m_size
Definition: agx/Vector.h:429
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
The base class for a constraint.
Definition: Constraint.h:89
The object defining a frame of reference and providing transformations operations.
Definition: agx/Frame.h:68
Compliance matrix data containing the lower triangle (including the diagonal) of the compliance matri...
const UInt32Vector & getDiagonalUpdates() const
void reset(UInt32 size)
Reset this matrix to zero and resize.
virtual ~GenericConstraintComplianceMatrix()
Reference counted object, protected destructor.
GenericConstraintComplianceMatrix(UInt32 maxSize, Bool isStaticSize)
Construct given maximum size, i.e., when all elementary constraint rows are active and enabled,...
Real get(UInt32 row, UInt32 col) const
void set(UInt32 row, UInt32 col, Real value)
Assign value to given row and column in the matrix.
Generic constraint which by default is empty of elementary constraints.
virtual void removeNotification() override
Called when removed from a simulation.
virtual ~GenericConstraint()
void render(class agxRender::RenderManager *manager, float scale) const override
Inherited method of how to render this constraint into DebugRenderer.
GenericConstraintComplianceMatrix * getComplianceMatrix() const
If this constraint active rows doesn't vary and isStaticSize = true has been flagged when enabling su...
static void onCleanup(const agxSDK::Simulation *simulation)
virtual void onRemoveNotification()
Callback when the constraint has been removed from a simulation.
virtual agx::Bool onPreSolve()
Callback before this constraint reaches the solver (actually preSystemCallback).
GenericConstraint(agx::RigidBody *rb1)
Construct given one rigid body (second is null).
static void onPostSolveCallback(const agxSDK::Simulation *simulation)
agx::Bool setRigidBodies(agx::RigidBody *rb1, agx::RigidBody *rb2)
Assign/update rigid bodies of this constraint.
int getNumDOF() const override
virtual void onPostSolve()
Callback from after the solve and the solutions been pushed to the elementary constraints.
GenericConstraint(agx::RigidBody *rb1, agx::Frame *f1, agx::RigidBody *rb2, agx::Frame *f2)
Construct given two bodies and frames.
GenericConstraint(agx::RigidBody *rb1, agx::RigidBody *rb2)
Construct given two rigid bodies (first has to be != null).
static void onPreSolveCallback(const agxSDK::Simulation *simulation)
virtual void updateComplianceMatrix(GenericConstraintComplianceMatrix *matrix)
Callback to write data.
virtual void addNotification() override
Called when added to a simulation.
void setSupportComplianceMatrix(agx::Bool enable, agx::Bool isStaticSize=false)
Enable/disable updateComplianceMatrix callback with write access to the elements in the compliance ma...
virtual void onAddNotification()
Callback when the constraint has been added to a simulation.
Base class providing referencing counted objects.
Definition: Referenced.h:114
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
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint32_t UInt32
Definition: Integer.h:40
bool Bool
Definition: Integer.h:48
double Real
Definition: Real.h:42