AGX Dynamics  2.37.3.2
GenericConstraint.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 #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 
102  GenericConstraintComplianceMatrix* getComplianceMatrix() const;
103 
111  agx::Bool setRigidBodies( agx::RigidBody* rb1, agx::RigidBody* rb2 );
112 
113  public:
117  virtual void onAddNotification();
118 
122  virtual void onRemoveNotification();
123 
130  virtual agx::Bool onPreSolve();
131 
135  virtual void onPostSolve();
136 
142  virtual void updateComplianceMatrix( GenericConstraintComplianceMatrix* matrix );
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:
156  virtual ~GenericConstraint();
157 
158 #ifndef SWIG
159  virtual void addNotification() override;
160  virtual void removeNotification() override;
161 #endif
162  };
163 
173  {
174  public:
180  GenericConstraintComplianceMatrix( UInt32 maxSize, Bool isStaticSize );
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 
211  const UInt32Vector& getDiagonalUpdates() const;
212 
216  Bool isStaticSize() const;
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 }
bool Bool
Definition: Integer.h:48
#define m_size
Definition: Vector.h:429
#define AGXPHYSICS_EXPORT
The base class for a constraint.
Definition: Constraint.h:88
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc...
Base class providing referencing counted objects.
Definition: Referenced.h:119
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
Generic constraint which by default is empty of elementary constraints.
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
The object defining a frame of reference and providing transformations operations.
Definition: Frame.h:67
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:126
Compliance matrix data containing the lower triangle (including the diagonal) of the compliance matri...
double Real
Definition: Real.h:42
uint32_t UInt32
Definition: Integer.h:40