AGX Dynamics  2.38.0.2
IGenericConstraint.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>
20 
21 namespace agx
22 {
23  class GenericConstraintComplianceMatrix;
24  class GenericConstraintImplementation;
25 
27  {
28  public:
29 #ifndef SWIG
30  static void onPreSolveCallback( const agxSDK::Simulation* simulation );
31  static void onPostSolveCallback( const agxSDK::Simulation* simulation );
32  static void onCleanup( const agxSDK::Simulation* simulation );
33 #endif
34 
35  public:
48  void setSupportComplianceMatrix( Bool enable, Bool isStaticSize = false );
49 
56  GenericConstraintComplianceMatrix* getComplianceMatrix() const;
57 
65  Bool setRigidBodies( RigidBody* rb1, RigidBody* rb2 );
66 
74  Bool addChild( Constraint* constraint );
75 
81  Bool removeChild( Constraint* constraint );
82 
86  void removeAllChildren();
87 
93  Bool add( RigidBody* rb );
94 
100  Bool remove( RigidBody* rb );
101 
105  void removeAllBodies();
106 
107  public:
108  virtual ~IGenericConstraint();
109  virtual void addNotification() final override;
110  virtual void removeNotification() final override;
111 
112  virtual void onAddNotification() = 0;
113  virtual void onRemoveNotification() = 0;
114 
115  virtual bool onPreSolve() = 0;
116  virtual void onPostSolve() = 0;
117 
118  virtual void updateComplianceMatrix( GenericConstraintComplianceMatrix* matrix ) = 0;
119 
120  public:
121  int getNumDOF() const override;
122  void render( class agxRender::RenderManager* manager, float scale ) const override;
123 
124  protected:
125  IGenericConstraint( GenericConstraintImplementation* implementation );
126 
127  private:
128  ConstraintRefVector m_children;
129  };
130 }
agx::Vector< ConstraintRef >
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:51
agxRender::RenderManager
Class for managing the rendering of geometries, shapes, rigid bodies, constraints etc.
Definition: RenderManager.h:106
Constraint.h
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agx::GenericConstraintComplianceMatrix
Compliance matrix data containing the lower triangle (including the diagonal) of the compliance matri...
Definition: GenericConstraintComplianceMatrix.h:33
agxSDK::Simulation
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:125
agx::IGenericConstraint
Definition: IGenericConstraint.h:26
agx::Bool
bool Bool
Definition: Integer.h:40
agx::Constraint
The base class for a constraint.
Definition: Constraint.h:88