AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MergedBody.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. 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 AGX_MERGEDBODY_H
18 #define AGX_MERGEDBODY_H
19 
20 #include <agx/BitState.h>
23 #include <agx/InternalData.h>
24 
26 
29 
30 #define MERGED_BODY_SERIALIZATION_VERSION_1 49
31 #define MERGED_BODY_SERIALIZATION_VERSION_2 75
32 
33 namespace agxSDK
34 {
35  class Simulation;
36  class MergeSplitHandler;
37 }
38 
39 namespace agxWire
40 {
41  class BodyFixedNode;
42 }
43 
44 namespace agx
45 {
48 
55  {
56  public:
57  // Interactions.
58  AGX_DECLARE_POINTER_TYPES( EdgeInteraction );
59  AGX_DECLARE_POINTER_TYPES( EmptyEdgeInteraction );
60  AGX_DECLARE_POINTER_TYPES( ContactGeneratorEdgeInteraction );
61  AGX_DECLARE_POINTER_TYPES( GeometryContactEdgeInteraction );
62  AGX_DECLARE_POINTER_TYPES( BinaryConstraintEdgeInteraction );
63  AGX_DECLARE_POINTER_TYPES( ParticleParticleInteraction );
64 
68  enum State
69  {
70  INTERACTION_GRAPH_DIRTY = 1 << 0,
71  RESTORED = 1 << 1,
72  READY_FOR_SOLVER = 1 << 2,
73  AUTO_CLEAN_WHEN_EMPTY = 1 << 3
74  };
75 
81  {
85  inline MergedBodyIndex() : index( agx::InvalidIndex ), originalIndex( agx::InvalidIndex ) {}
86 
92  : index( rb ? rb.calculateIndex() : agx::InvalidIndex ), originalIndex( orgRb ? orgRb.calculateIndex() : agx::InvalidIndex ) {}
93 
97  inline agx::Bool isMerged() const { return originalIndex != agx::InvalidIndex && index != originalIndex; }
98 
101  };
102 
103  public:
104  // Listeners and visitors.
106  typedef std::function< void( agx::RigidBody* ) > RigidBodyVisitor;
107  typedef std::function< void( EdgeInteraction* ) > EdgeInteractionVisitor;
108  typedef agx::BitState< State > InternalState;
110 
111  public:
119  static const agx::MergedBody* get( const agx::RigidBody* rb );
120 
128  static agx::MergedBody* get( agx::RigidBody* rb );
129 
135  static const agx::MergedBody* getActive( const agx::RigidBody* rb );
136 
142  static agx::MergedBody* getActive( agx::RigidBody* rb );
143 
148  static agx::Bool isRoot( const agx::RigidBody* rb );
149 
154  static MergedBodyIndex findMergedBodyIndex( agx::Physics::RigidBodyPtr rb );
155 
162  static const agx::RigidBody* filter( const agx::RigidBody* rb );
163  static agx::RigidBody* filter( agx::RigidBody* rb );
164 
169  static agx::Bool split( agx::RigidBody* rb );
170 
178  static agx::MergedBody* get( agx::Constraint* constraint );
179 
187  static const agx::MergedBody* get( const agx::Constraint* constraint );
188 
192  static BinaryConstraintEdgeInteraction* getEdge( const agx::Constraint* constraint );
193 
197  static BinaryConstraintEdgeInteraction* getEdge( const agx::HighLevelConstraintImplementation* constraint );
198 
203  static agx::Bool split( agx::Constraint* constraint );
204 
209  static agx::Bool split( agx::HighLevelConstraintImplementation* constraint );
210 
217  static agx::Bool shouldIntegratePosition( const agx::RigidBody* rb );
218 
219  public:
223  MergedBody();
224 
231  virtual MergedBodyRef clone();
232 
236  agx::RigidBody* getRigidBody() const;
237 
244  agx::Bool add( EdgeInteraction* edge );
245 
252  agx::Bool merge( agx::MergedBody* other, EdgeInteraction* edge );
253 
259  agx::Bool remove( EdgeInteraction* edge );
260 
267  agx::Bool remove( agx::RigidBody* rb );
268 
274  agx::Bool add( Listener* listener );
275 
281  agx::Bool remove( Listener* listener );
282 
288  agx::MergedBodyRefVector splitIslands();
289 
293  agx::Bool merged( const agx::RigidBody* rb1, const agx::RigidBody* rb2 ) const;
294 
298  agx::UInt getNumPairs() const;
299 
303  agx::Bool isEmpty() const;
304 
308  agx::Bool isActive() const;
309 
313  const EdgeInteractionRefContainer* getEdges( const agx::RigidBody* rb1, const agx::RigidBody* rb2 ) const;
314 
318  const agx::RigidBodyPtrVector* getNeighbors( const agx::RigidBody* rb ) const;
319 
330  void setEnableAutomaticCleanupWhenEmpty( agx::Bool enable );
331 
335  agx::Bool getEnableAutomaticCleanupWhenEmpty() const;
336 
337 #ifndef SWIG
338 
344  void traverse( RigidBodyVisitor visitor, agx::Bool includeDisabled = false ) const;
345 
353  void traverse( EdgeInteractionVisitor visitor, agx::Bool includeDisabled = false ) const;
354 
364  void traverse( const agx::RigidBody* rb, EdgeInteractionVisitor visitor, agx::Bool includeDisabled = false ) const;
365 
374  void traverse( const agx::RigidBody* rb, RigidBodyVisitor visitor, agx::Bool includeDisabled = false ) const;
375 #endif
376 
380  const InternalState& getState() const;
381 
385  void debugPrint( const agx::RigidBody* rb ) const;
386 
390  void getDebugRenderColor( agx::Vec3& color ) const;
391 
392  public:
395 
399  virtual void updateVelocities();
400 
405  virtual void storeRelativeTransforms();
406 
410  void postIntegrate();
411 
417  void clearGeneratedInteractions();
419 
420  protected:
424  virtual ~MergedBody() throw();
425 
426  friend class agxSDK::Simulation; // Remove of bodies and constraints.
427  friend class agxCollide::Space; // Remove of geometries from space.
428  friend class agx::RigidBody; // Remove of geometries from bodies.
433  virtual void setSimulation( agxSDK::Simulation* simulation );
434 
438  virtual void onRemove( agx::RigidBody* rb );
439 
443  virtual void onRemove( agx::Constraint* constraint );
444 
448  virtual void onRemove( agxCollide::Geometry* geometry );
449 
453  virtual void preCollide();
454 
458  virtual void preStep();
459 
464  virtual void postStep();
465 
469  virtual void onCleanup();
470 
471  protected:
475  agxSDK::Simulation* getSimulation();
476 
480  const agxSDK::Simulation* getSimulation() const;
481 
486  agx::Bool updateProperties();
487 
488  private:
489  struct PairData : public agx::Referenced
490  {
492 
493  protected:
494  virtual ~PairData() {}
495  };
496  typedef agx::ref_ptr<PairData> PairDataRef;
497 
499  typedef agx::Vector<EdgeInteractionConstRef> EdgeInteractionConstRefContainer;
500  typedef agx::HashVector<Key, PairDataRef> PairInteractionsContainer;
501  typedef PairInteractionsContainer::iterator PairInteractionsIterator;
502  typedef PairInteractionsContainer::const_iterator PairInteractionsConstIterator;
503  typedef agx::Vector<RigidBodyRef> RigidBodyContainer;
504  typedef agx::Vector<ListenerRef> ListenerContainer;
505 
506  private:
508 
512  struct RootBodyData : public agx::Referenced
513  {
514  RootBodyData( agx::MergedBody* mb, agx::StrongInteraction* si ) : rootBody( mb ), strongInteraction( si ) {}
515 
516  MergedBody* rootBody;
517  agx::StrongInteractionRef strongInteraction;
518  };
519  typedef agx::ref_ptr<RootBodyData> RootBodyDataRef;
520 
524  struct AGXPHYSICS_EXPORT MergedData : public agx::Referenced
525  {
526  enum Flag : agx::UInt16
527  {
528  INTEGRATE_POSITIONS = 1 << 0
531  };
532  using Flags = agx::BitState<Flag, agx::UInt16>;
533 
537  MergedData()
538  : otherBodies(), relativeTransform(), mergedBody( nullptr ), id( agx::InvalidIndex ),
539  mergedWithWorldCounter( 0 ), rootBodyData( nullptr ), flags( agx::UInt16( 0 ) )
540  {
541  }
542 
543  agx::RigidBodyPtrVector otherBodies;
544  agx::AffineMatrix4x4 relativeTransform;
545  MergedBody* mergedBody;
546  agx::UInt id;
547  agx::Int32 mergedWithWorldCounter;
548  RootBodyDataRef rootBodyData;
549  Flags flags;
550 
551  protected:
552  virtual ~MergedData() {}
553  };
554  typedef agx::ref_ptr<MergedData> MergedDataRef;
555 
559  struct AGXPHYSICS_EXPORT ConstraintMergedData : public agx::Referenced
560  {
561  ConstraintMergedData()
562  : mergedBody( nullptr ), edge( nullptr ) {}
563 
564  MergedBody* mergedBody;
565  EdgeInteraction* edge;
567  protected:
568  virtual ~ConstraintMergedData() {}
569  };
570  typedef agx::ref_ptr<ConstraintMergedData> ConstraintMergedDataRef;
571 
576  void writeConnectivityGraph( std::ostream& stream ) const;
577 
578  private:
582  template<typename DataT, typename ObjT>
583  static DataT* getMergedData( const ObjT& obj );
584 
588  template<typename DataT, typename ObjT>
589  static DataT* getOrCreateMergedData( ObjT obj );
590 
594  static RootBodyData* getRootBodyData( const agx::RigidBody* rb );
595 
599  static agx::Bool isMerged( const MergedData* data );
600 
601  private:
605  Key createKey( EdgeInteraction* edge ) const;
606 
610  Key createKey( const agx::RigidBody* rb1, const agx::RigidBody* rb2 ) const;
611 
619  MergedData* add( agx::RigidBody* rb, agx::Bool fireOnAddEvent = true );
620 
627  void erase( agx::RigidBody* rb, agx::Bool fireOnRemoveEvent = true );
628 
634  void remove( agx::RigidBody* rb, MergedData* rbData, agx::Bool saveRemovedEdges );
635 
642  agx::Bool remove( EdgeInteraction* edge, agx::Bool saveRemovedEdge );
643 
649  void remove( PairInteractionsIterator it );
650 
654  void fireOnAdd( agx::RigidBody* rb ) const;
655 
659  void fireOnRemove( agx::RigidBody* rb ) const;
660 
664  void handleOnAdd( EdgeInteraction* edge );
665 
669  void handleOnRemove( const EdgeInteractionRefContainer& edges );
670 
674  void handleOnMovedTo( const EdgeInteractionRefContainer& edges, MergedBody* newMergedBody );
675 
679  void updateDynamicsProperties( agx::RigidBody::MotionControl motionControl,
680  const agx::Vec3& centerOfMassPosition,
681  agx::Real totalMass );
682 
687  void commitGeneratedInteractions();
688 
689  private:
690  RigidBodyRef m_rb;
691  PairInteractionsContainer m_pairInteractions;
692  EdgeInteractionRefContainer m_removedEdges;
693  ListenerContainer m_listeners;
694  RigidBodyContainer m_bodies;
695  agxSDK::Simulation* m_simulation;
696  mutable InternalState m_state;
697  agx::Mutex m_mutex;
698  };
699 
703  class AGXPHYSICS_EXPORT MergedBody::Listener : public agx::Referenced
704  {
705  public:
711  virtual ListenerRef clone() = 0;
712 
716  virtual void onAdd( agx::RigidBody* /*rb*/, const agx::MergedBody* /*mergedBody*/ ) const {}
717 
721  virtual void onRemove( agx::RigidBody* /*rb*/, const agx::MergedBody* /*mergedBody*/ ) const {}
722 
726  virtual void onAdded( EdgeInteraction* /*edge*/, const agx::MergedBody* /*mergedBody*/ ) const {}
727 
731  virtual void onRemoved( const MergedBody::EdgeInteractionRefContainer& /*edges*/, const agx::MergedBody* /*mergedBody*/ ) const {}
732 
736  virtual void onMovedFromTo( const MergedBody::EdgeInteractionRefContainer& /*edges*/, const agx::MergedBody* /*fromMergedBody*/, const agx::MergedBody* /*toMergedBody*/ ) const {}
737 
738  protected:
742  virtual ~Listener();
743  };
744 
748  class AGXPHYSICS_EXPORT MergedBody::EdgeInteraction : public agx::Referenced, public agxStream::Serializable
749  {
750  public:
751 #ifndef SWIG
753  {
754  NONE = 0,
755  CONTACT = 1 << 0,
756  CONTACT_GENERATOR = 1 << 1,
757  CONSTRAINT = 1 << 2,
758  BINARY_CONSTRAINT = CONSTRAINT | (1 << 3),
759  PARTICLE_GENERATOR = 1 << 4
760  };
761 #endif
762 
763  public:
767  agx::RigidBody* getRigidBody1() const;
768 
772  agx::RigidBody* getRigidBody2() const;
773 
777  agx::Bool containsDeletedBodies() const;
778 
782  agx::Bool getValid() const;
783 
784 #ifndef SWIG
785 
788  agx::Bool isTagged( InteractionTag tag ) const;
789 #endif
790 
791  public:
796  virtual void generateInteraction( agxSDK::Simulation* simulation, agxCollide::LocalGeometryContactVector& newContacts ) = 0;
797 
799 
803  virtual void store( agxStream::OutputArchive& out ) const override;
804 
808  virtual void restore( agxStream::InputArchive& in ) override;
809 
813  virtual void storeLightData( agxStream::StorageStream& str ) const override;
814 
818  virtual void restoreLightData( agxStream::StorageStream& str ) override;
819 
820  protected:
821 #ifndef SWIG
822 
829  EdgeInteraction( agx::RigidBody* rb1, agx::RigidBody* rb2, InteractionTag tag, agx::Bool valid = true );
830 #endif
831 
835  virtual ~EdgeInteraction();
836 
840  void setBodies( agx::RigidBody* rb1, agx::RigidBody* rb2 );
841 
842  private:
843  agx::RigidBodyObserver m_bodies[ 2 ];
844  agx::Bool m_hadValidRb[ 2 ];
845  agx::Bool m_valid;
846  agx::Int32 m_tag;
847  };
848 
854  class AGXPHYSICS_EXPORT MergedBody::EmptyEdgeInteraction : public MergedBody::EdgeInteraction
855  {
856  public:
860  EmptyEdgeInteraction( agx::RigidBody* rb1, agx::RigidBody* rb2 );
861 
862  public:
864 
868  virtual void storeLightData( agxStream::StorageStream& str ) const override;
869 
873  virtual void restoreLightData( agxStream::StorageStream& str ) override;
874 
875  protected:
879  EmptyEdgeInteraction();
880 
884  virtual ~EmptyEdgeInteraction();
885 
889  virtual void generateInteraction( agxSDK::Simulation* /*simulation*/, agxCollide::LocalGeometryContactVector& /*newContacts*/ ) override {}
890  };
891 
896  class AGXPHYSICS_EXPORT MergedBody::ContactGeneratorEdgeInteraction : public MergedBody::EdgeInteraction
897  {
898  public:
902  ContactGeneratorEdgeInteraction( agx::RigidBody* rb1, agx::RigidBody* rb2 );
903 
904  public:
906 
910  virtual void storeLightData( agxStream::StorageStream& str ) const override;
911 
915  virtual void restoreLightData( agxStream::StorageStream& str ) override;
916 
917  protected:
921  ContactGeneratorEdgeInteraction();
922 
926  virtual ~ContactGeneratorEdgeInteraction();
927 
931  virtual void generateInteraction( agxSDK::Simulation* simulation, agxCollide::LocalGeometryContactVector& newContacts ) override;
932  };
933 
937  class AGXPHYSICS_EXPORT MergedBody::GeometryContactEdgeInteraction : public MergedBody::EdgeInteraction
938  {
939  public:
944  {
945  enum Strength
946  {
949  TANGENT_V_DIRECTION
950  };
951 
952  Point();
953  Point( agx::Physics::ContactPointPtr pointPtr, agx::Physics::ContactMaterialPtr contactMaterial, const agx::AffineMatrix4x4& toLocal, const agx::RigidBody* rb1, const agx::RigidBody* rb2 );
954 
961  };
963 
964  public:
969  explicit GeometryContactEdgeInteraction( agx::Physics::GeometryContactPtr gcPtr );
970 
979  GeometryContactEdgeInteraction( agxCollide::Geometry* geometry1, agx::RigidBody* rb1, agxCollide::Geometry* geometry2, agx::RigidBody* rb2 );
980 
984  agxCollide::Geometry* getGeometry1() const;
985 
989  agxCollide::Geometry* getGeometry2() const;
990 
994  const PointContainer& getPoints() const;
995 
996  public:
998 
1002  virtual void storeLightData( agxStream::StorageStream& str ) const override;
1003 
1007  virtual void restoreLightData( agxStream::StorageStream& str ) override;
1008 
1010 #ifndef SWIG
1011 
1015  typedef std::function<agxCollide::Geometry*( agxCollide::Geometry*, agx::RigidBody* )> GeometryUpdateFunction;
1016 
1025  void updateGeometries( GeometryUpdateFunction geometryUpdateFunction );
1026 #endif
1028 
1029  protected:
1033  GeometryContactEdgeInteraction();
1034 
1038  virtual ~GeometryContactEdgeInteraction();
1039 
1043  virtual void generateInteraction( agxSDK::Simulation* simulation, agxCollide::LocalGeometryContactVector& newContacts ) override;
1044 
1045  private:
1046  PointContainer m_points;
1047  agxCollide::GeometryObserver m_geometries[ 2 ];
1048  };
1049 
1053  class AGXPHYSICS_EXPORT MergedBody::BinaryConstraintEdgeInteraction : public MergedBody::EdgeInteraction
1054  {
1055  public:
1060  explicit BinaryConstraintEdgeInteraction( agx::Constraint* constraint );
1061 
1066  explicit BinaryConstraintEdgeInteraction( agx::HighLevelConstraintImplementation* constraint );
1067 
1071  agx::HighLevelConstraintImplementation* getConstraint();
1072 
1076  const agx::HighLevelConstraintImplementation* getConstraint() const;
1077 
1078  public:
1080 
1084  virtual void storeLightData( agxStream::StorageStream& str ) const override;
1085 
1089  virtual void restoreLightData( agxStream::StorageStream& str ) override;
1090 
1091  protected:
1095  BinaryConstraintEdgeInteraction();
1096 
1100  virtual ~BinaryConstraintEdgeInteraction();
1101 
1105  virtual void generateInteraction( agxSDK::Simulation* simulation, agxCollide::LocalGeometryContactVector& newContacts ) override;
1106 
1107  private:
1109  };
1110 
1114  class AGXPHYSICS_EXPORT MergedBody::ParticleParticleInteraction : public MergedBody::EdgeInteraction
1115  {
1116  public:
1120  ParticleParticleInteraction(agx::RigidBody* substituteBody1, agx::RigidBody* substituteBody2);
1121 
1122  public:
1124 
1128  virtual void storeLightData(agxStream::StorageStream& str) const override;
1129 
1133  virtual void restoreLightData(agxStream::StorageStream& str) override;
1134 
1135  protected:
1139  ParticleParticleInteraction();
1140 
1144  virtual ~ParticleParticleInteraction();
1145 
1149  virtual void generateInteraction(agxSDK::Simulation* /*simulation*/, agxCollide::LocalGeometryContactVector& /*newContacts*/) override;
1150  };
1151 
1152  template<typename DataT, typename ObjT>
1153  AGX_FORCE_INLINE DataT* MergedBody::getMergedData( const ObjT& obj )
1154  {
1155  return agx::InternalData::get<DataT>( obj, agx::InternalData::MERGED_BODY );
1156  }
1157 
1158  template<typename DataT, typename ObjT>
1159  AGX_FORCE_INLINE DataT* MergedBody::getOrCreateMergedData( ObjT obj )
1160  {
1161  agxAssert( obj != nullptr );
1162  return agx::InternalData::getOrCreate<DataT>( obj, agx::InternalData::MERGED_BODY );
1163  }
1164 
1166  {
1167  const MergedData* data = getMergedData<MergedData>( rb );
1168  return data != nullptr ? data->mergedBody : nullptr;
1169  }
1170 
1172  {
1173  MergedData* data = getMergedData<MergedData>( rb );
1174  return data != nullptr ? data->mergedBody : nullptr;
1175  }
1176 
1178  {
1179  const MergedBody* mb = MergedBody::get( rb );
1180  return mb != nullptr && mb->isActive() ? mb : nullptr;
1181  }
1182 
1184  {
1185  MergedBody* mb = MergedBody::get( rb );
1186  return mb != nullptr && mb->isActive() ? mb : nullptr;
1187  }
1188 
1189  inline Bool MergedBody::isRoot( const RigidBody* rb )
1190  {
1191  return rb != nullptr &&
1192  rb->getEntity().state().mergedRootBody();
1193  }
1194 
1196  {
1197  if ( !rb )
1198  return MergedBodyIndex();
1199  const MergedBody* root = getActive( rb.model() );
1200  return root != nullptr ? MergedBodyIndex( root->getRigidBody()->getEntity(), rb ) : MergedBodyIndex( rb, rb );
1201  }
1202 
1204  {
1205  const MergedBody* root = getActive( rb );
1206  return root != nullptr ? root->getRigidBody() : rb;
1207  }
1208 
1210  {
1211  MergedBody* root = getActive( rb );
1212  return root != nullptr ? root->getRigidBody() : rb;
1213  }
1214 
1215  AGX_FORCE_INLINE Bool MergedBody::isMerged( const MergedData* data )
1216  {
1217  return data != nullptr && data->mergedBody != nullptr;
1218  }
1219 
1221  {
1222  return m_simulation != nullptr && m_state.Is( READY_FOR_SOLVER );
1223  }
1224 
1225  AGX_FORCE_INLINE MergedBody::RootBodyData* MergedBody::getRootBodyData( const RigidBody* rb )
1226  {
1227  MergedData* data = getMergedData<MergedData>( rb );
1228  return data != nullptr ? data->rootBodyData : nullptr;
1229  }
1230 
1232  inline Bool MergedBody::EdgeInteraction::isTagged(InteractionTag tag) const
1233  {
1234  return ( m_tag & (Int32)tag ) != 0;
1235  }
1237 }
1238 
1239 #endif
AGXPHYSICS_EXPORT agx::RigidBody *& model()
static agx::Bool isRoot(const agx::RigidBody *rb)
Definition: MergedBody.h:1189
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
Merged states, neighbors etc.
Definition: InternalData.h:42
Pointer to a entity instance of type Physics.ContactPoint.
Object with index of merged body and the original index of a merged object.
Definition: MergedBody.h:80
agx::BitState< State > InternalState
Definition: MergedBody.h:108
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...
MergedBodyIndex(agx::Physics::RigidBodyPtr rb, agx::Physics::RigidBodyPtr orgRb)
Construct given object associated to index, and an original object associated to originalIndex.
Definition: MergedBody.h:91
virtual void onMovedFromTo(const MergedBody::EdgeInteractionRefContainer &, const agx::MergedBody *, const agx::MergedBody *) const
Called when the edges between two bodies are moved from one merged body to another.
Definition: MergedBody.h:736
GeometryContactEdgeInteraction()
Default constructor used by serialization.
int32_t Int32
Definition: Integer.h:45
bool Bool
Definition: Integer.h:48
Contact point data store in first rigid body local frame.
Definition: MergedBody.h:943
Base class for a merge split algorithm handling a set of merged bodies.
static const agx::MergedBody * getActive(const agx::RigidBody *rb)
This method returns an agx::MergedBody that is active and in a simulation.
Definition: MergedBody.h:1177
Base class for a strong interaction concept where there interaction is defined in the mass matrix par...
virtual void onAdd(agx::RigidBody *, const agx::MergedBody *) const
Called when a body is added to the merged body.
Definition: MergedBody.h:716
agx::VectorPOD< Point > PointContainer
Definition: MergedBody.h:962
ParticleParticleInteraction()
Default constructor used by serialization.
virtual void onRemove(agx::RigidBody *, const agx::MergedBody *) const
Called when a body is removed from the merged body.
Definition: MergedBody.h:721
#define AGXPHYSICS_EXPORT
agx::Vector< EdgeInteractionRef > EdgeInteractionRefContainer
Definition: MergedBody.h:109
The base class for a constraint.
Definition: Constraint.h:86
virtual void generateInteraction(agxSDK::Simulation *, agxCollide::LocalGeometryContactVector &) override
Does nothing.
Definition: MergedBody.h:889
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
agx::Bool isActive() const
Definition: MergedBody.h:1220
virtual void onRemoved(const MergedBody::EdgeInteractionRefContainer &, const agx::MergedBody *) const
Called when an edge is removed from the merged body.
Definition: MergedBody.h:731
#define AGX_FORCE_INLINE
Definition: Object.h:62
GLenum GLuint id
Definition: gl.h:5539
agx::RigidBody * getRigidBody() const
agx::Bool isMerged() const
Definition: MergedBody.h:97
AGXPHYSICS_EXPORT agx::RigidBodyState & state()
Base class providing referencing counted objects.
Definition: Referenced.h:113
EmptyEdgeInteraction()
Default constructor used by serialization.
The geometry representation used by the collision detection engine.
Definition: Geometry.h:88
Structure holding several &quot;normal&quot; rigid bodies.
Definition: MergedBody.h:54
The body fixed node is attached to a body at a given offset.
Pointer to a entity instance of type Physics.RigidBody.
static MergedBodyIndex findMergedBodyIndex(agx::Physics::RigidBodyPtr rb)
Similar to filter( const agx::RigidBody* rb ).
Definition: MergedBody.h:1195
uint32_t UInt
Definition: Integer.h:34
agx::Vector< LocalGeometryContact > LocalGeometryContactVector
BinaryConstraintEdgeInteraction()
Default constructor used by serialization.
State
Internal state of this merged body.
Definition: MergedBody.h:68
#define agxAssert(expr)
Definition: debug.h:143
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:52
virtual void onAdded(EdgeInteraction *, const agx::MergedBody *) const
Called when an edge is added to the merged body.
Definition: MergedBody.h:726
agx::VectorPOD< RigidBodyPtr > RigidBodyPtrVector
A geometry contact hold contact information between two geometries.
agx::ref_ptr< RigidBody > RigidBodyRef
Definition: RigidBody.h:46
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:48
std::function< void(EdgeInteraction *) > EdgeInteractionVisitor
Definition: MergedBody.h:107
#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:206
static const agx::MergedBody * get(const agx::RigidBody *rb)
This method returns an agx::MergedBody if rb has been added to one.
Definition: MergedBody.h:1165
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
std::mutex Mutex
Definition: Referenced.h:93
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:121
#define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(T)
Use this in a pure abstract Serializable class to add the required methods Important: Use full namesp...
Definition: Serializable.h:220
uint16_t UInt16
Definition: Integer.h:39
ContactGeneratorEdgeInteraction()
Default constructor used by serialization.
MergedBodyIndex()
Default constructor initializes both indices to Invalid Index.
Definition: MergedBody.h:85
double Real
Definition: Real.h:42
MotionControl
The MotionControl enumeration indicates what makes a RigidBody move.
Definition: RigidBody.h:63
AGXCORE_EXPORT Component * root()
static const agx::RigidBody * filter(const agx::RigidBody *rb)
Filters rb and returns the merged rigid body if rb is part of one.
Definition: MergedBody.h:1203
agx::Physics::RigidBodyPtr getEntity() const
Internal method.
Definition: RigidBody.h:1450
std::function< void(agx::RigidBody *) > RigidBodyVisitor
Definition: MergedBody.h:106
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:101
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:100
Pointer to a entity instance of type Physics.ContactMaterial.
agx::observer_ptr< Geometry > GeometryObserver
Definition: Geometry.h:75
AGX_DECLARE_VECTOR_TYPES(Clock)
EdgeInteraction(agx::RigidBody *rb1, agx::RigidBody *rb2, InteractionTag tag, agx::Bool valid=true)
Construct given two rigid bodies and a valid flag.
Flags
Flags for specifying what is enabled in the debug rendering system.
Definition: RenderManager.h:64