AGX Dynamics  2.37.2.0
MergedBody.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 
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 {
49 
56  {
57  public:
58  // Interactions.
59  AGX_DECLARE_POINTER_TYPES( EdgeInteraction );
60  AGX_DECLARE_POINTER_TYPES( EmptyEdgeInteraction );
61  AGX_DECLARE_POINTER_TYPES( ContactGeneratorEdgeInteraction );
62  AGX_DECLARE_POINTER_TYPES( GeometryContactEdgeInteraction );
63  AGX_DECLARE_POINTER_TYPES( BinaryConstraintEdgeInteraction );
64  AGX_DECLARE_POINTER_TYPES( ParticleParticleInteraction );
65 
69  enum State
70  {
71  INTERACTION_GRAPH_DIRTY = 1 << 0,
72  RESTORED = 1 << 1,
73  READY_FOR_SOLVER = 1 << 2,
74  AUTO_CLEAN_WHEN_EMPTY = 1 << 3
75  };
76 
82  {
86  inline MergedBodyIndex() : index( agx::InvalidIndex ), originalIndex( agx::InvalidIndex ) {}
87 
93  : index( rb ? rb.calculateIndex() : agx::InvalidIndex ), originalIndex( orgRb ? orgRb.calculateIndex() : agx::InvalidIndex ) {}
94 
98  inline agx::Bool isMerged() const { return originalIndex != agx::InvalidIndex && index != originalIndex; }
99 
102  };
103 
104  public:
105  // Listeners and visitors.
107  typedef std::function< void( agx::RigidBody* ) > RigidBodyVisitor;
108  typedef std::function< void( EdgeInteraction* ) > EdgeInteractionVisitor;
109  typedef agx::BitState< State > InternalState;
111 
112  public:
120  static const agx::MergedBody* get( const agx::RigidBody* rb );
121 
129  static agx::MergedBody* get( agx::RigidBody* rb );
130 
136  static const agx::MergedBody* getActive( const agx::RigidBody* rb );
137 
143  static agx::MergedBody* getActive( agx::RigidBody* rb );
144 
149  static agx::Bool isRoot( const agx::RigidBody* rb );
150 
155  static MergedBodyIndex findMergedBodyIndex( agx::Physics::RigidBodyPtr rb );
156 
163  static const agx::RigidBody* filter( const agx::RigidBody* rb );
164  static agx::RigidBody* filter( agx::RigidBody* rb );
165 
170  static agx::Bool split( agx::RigidBody* rb );
171 
179  static agx::MergedBody* get( agx::Constraint* constraint );
180 
188  static const agx::MergedBody* get( const agx::Constraint* constraint );
189 
193  static BinaryConstraintEdgeInteraction* getEdge( const agx::Constraint* constraint );
194 
198  static BinaryConstraintEdgeInteraction* getEdge( const agx::HighLevelConstraintImplementation* constraint );
199 
204  static agx::Bool split( agx::Constraint* constraint );
205 
210  static agx::Bool split( agx::HighLevelConstraintImplementation* constraint );
211 
218  static agx::Bool shouldIntegratePosition( const agx::RigidBody* rb );
219 
220  public:
224  MergedBody();
225 
232  virtual MergedBodyRef clone();
233 
237  const agx::Name& getName() const;
238 
243  void setName(const agx::Name& name);
244 
248  agx::RigidBody* getRigidBody() const;
249 
256  agx::Bool add( EdgeInteraction* edge );
257 
264  agx::Bool merge( agx::MergedBody* other, EdgeInteraction* edge );
265 
271  agx::Bool remove( EdgeInteraction* edge );
272 
279  agx::Bool remove( agx::RigidBody* rb );
280 
286  agx::Bool add( Listener* listener );
287 
293  agx::Bool remove( Listener* listener );
294 
300  agx::MergedBodyRefVector splitIslands();
301 
305  agx::Bool merged( const agx::RigidBody* rb1, const agx::RigidBody* rb2 ) const;
306 
310  agx::UInt getNumPairs() const;
311 
315  agx::Bool isEmpty() const;
316 
320  agx::Bool isActive() const;
321 
325  const EdgeInteractionRefContainer* getEdges( const agx::RigidBody* rb1, const agx::RigidBody* rb2 ) const;
326 
330  const agx::RigidBodyPtrVector* getNeighbors( const agx::RigidBody* rb ) const;
331 
342  void setEnableAutomaticCleanupWhenEmpty( agx::Bool enable );
343 
347  agx::Bool getEnableAutomaticCleanupWhenEmpty() const;
348 
349 #ifndef SWIG
350 
356  void traverse( RigidBodyVisitor visitor, agx::Bool includeDisabled = false ) const;
357 
365  void traverse( EdgeInteractionVisitor visitor, agx::Bool includeDisabled = false ) const;
366 
376  void traverse( const agx::RigidBody* rb, EdgeInteractionVisitor visitor, agx::Bool includeDisabled = false ) const;
377 
386  void traverse( const agx::RigidBody* rb, RigidBodyVisitor visitor, agx::Bool includeDisabled = false ) const;
387 #endif
388 
392  const InternalState& getState() const;
393 
397  void debugPrint( const agx::RigidBody* rb ) const;
398 
402  void getDebugRenderColor( agx::Vec3& color ) const;
403 
404  public:
407 
411  virtual void updateVelocities();
412 
417  virtual void storeRelativeTransforms();
418 
422  void postIntegrate();
423 
429  void clearGeneratedInteractions();
431 
432  protected:
436  virtual ~MergedBody() throw();
437 
438  friend class agxSDK::Simulation; // Remove of bodies and constraints.
439  friend class agxCollide::Space; // Remove of geometries from space.
440  friend class agx::RigidBody; // Remove of geometries from bodies.
445  virtual void setSimulation( agxSDK::Simulation* simulation );
446 
450  virtual void onRemove( agx::RigidBody* rb );
451 
455  virtual void onRemove( agx::Constraint* constraint );
456 
460  virtual void onRemove( agxCollide::Geometry* geometry );
461 
465  virtual void preCollide();
466 
470  virtual void preStep();
471 
476  virtual void postStep();
477 
481  virtual void onCleanup();
482 
483  protected:
487  agxSDK::Simulation* getSimulation();
488 
492  const agxSDK::Simulation* getSimulation() const;
493 
498  agx::Bool updateProperties();
499 
500  private:
501  struct PairData : public agx::Referenced
502  {
503  EdgeInteractionRefContainer edges;
504 
505  protected:
506  virtual ~PairData() {}
507  };
509 
513  typedef PairInteractionsContainer::iterator PairInteractionsIterator;
514  typedef PairInteractionsContainer::const_iterator PairInteractionsConstIterator;
517 
518  private:
520 
524  struct RootBodyData : public agx::Referenced
525  {
526  RootBodyData( agx::MergedBody* mb, agx::StrongInteraction* si ) : rootBody( mb ), strongInteraction( si ) {}
527 
528  MergedBody* rootBody;
529  agx::StrongInteractionRef strongInteraction;
530  };
532 
536  struct AGXPHYSICS_EXPORT MergedData : public agx::Referenced
537  {
538  enum Flag : agx::UInt16
539  {
540  INTEGRATE_POSITIONS = 1 << 0
543  };
544  using Flags = agx::BitState<Flag, agx::UInt16>;
545 
549  MergedData()
550  : otherBodies(), relativeTransform(), mergedBody( nullptr ), id( agx::InvalidIndex ),
551  mergedWithWorldCounter( 0 ), rootBodyData( nullptr ), flags( agx::UInt16( 0 ) )
552  {
553  }
554 
555  agx::RigidBodyPtrVector otherBodies;
556  agx::AffineMatrix4x4 relativeTransform;
557  MergedBody* mergedBody;
558  agx::UInt id;
559  agx::Int32 mergedWithWorldCounter;
560  RootBodyDataRef rootBodyData;
561  Flags flags;
562 
563  protected:
564  virtual ~MergedData() {}
565  };
567 
571  struct AGXPHYSICS_EXPORT ConstraintMergedData : public agx::Referenced
572  {
573  ConstraintMergedData()
574  : mergedBody( nullptr ), edge( nullptr ) {}
575 
576  MergedBody* mergedBody;
577  EdgeInteraction* edge;
579  protected:
580  virtual ~ConstraintMergedData() {}
581  };
583 
588  void writeConnectivityGraph( std::ostream& stream ) const;
589 
590  private:
594  template<typename DataT, typename ObjT>
595  static DataT* getMergedData( const ObjT& obj );
596 
600  template<typename DataT, typename ObjT>
601  static DataT* getOrCreateMergedData( ObjT obj );
602 
606  static RootBodyData* getRootBodyData( const agx::RigidBody* rb );
607 
611  static agx::Bool isMerged( const MergedData* data );
612 
613  private:
617  Key createKey( EdgeInteraction* edge ) const;
618 
622  Key createKey( const agx::RigidBody* rb1, const agx::RigidBody* rb2 ) const;
623 
631  MergedData* add( agx::RigidBody* rb, agx::Bool fireOnAddEvent = true );
632 
639  void erase( agx::RigidBody* rb, agx::Bool fireOnRemoveEvent = true );
640 
646  void remove( agx::RigidBody* rb, MergedData* rbData, agx::Bool saveRemovedEdges );
647 
654  agx::Bool remove( EdgeInteraction* edge, agx::Bool saveRemovedEdge );
655 
661  void remove( PairInteractionsIterator it );
662 
666  void fireOnAdd( agx::RigidBody* rb ) const;
667 
671  void fireOnRemove( agx::RigidBody* rb ) const;
672 
676  void handleOnAdd( EdgeInteraction* edge );
677 
681  void handleOnRemove( const EdgeInteractionRefContainer& edges );
682 
686  void handleOnMovedTo( const EdgeInteractionRefContainer& edges, MergedBody* newMergedBody );
687 
691  void updateDynamicsProperties( agx::RigidBody::MotionControl motionControl,
692  const agx::Vec3& centerOfMassPosition,
693  agx::Real totalMass );
694 
699  void commitGeneratedInteractions();
700 
701  private:
702  RigidBodyRef m_rb;
703  PairInteractionsContainer m_pairInteractions;
704  EdgeInteractionRefContainer m_removedEdges;
705  ListenerContainer m_listeners;
706  RigidBodyContainer m_bodies;
707  agxSDK::Simulation* m_simulation;
708  mutable InternalState m_state;
709  agx::Mutex m_mutex;
710  agx::Name m_name;
711  };
712 
716  class AGXPHYSICS_EXPORT MergedBody::Listener : public agx::Referenced
717  {
718  public:
724  virtual ListenerRef clone() = 0;
725 
729  virtual void onAdd( agx::RigidBody* /*rb*/, const agx::MergedBody* /*mergedBody*/ ) const {}
730 
734  virtual void onRemove( agx::RigidBody* /*rb*/, const agx::MergedBody* /*mergedBody*/ ) const {}
735 
739  virtual void onAdded( EdgeInteraction* /*edge*/, const agx::MergedBody* /*mergedBody*/ ) const {}
740 
744  virtual void onRemoved( const MergedBody::EdgeInteractionRefContainer& /*edges*/, const agx::MergedBody* /*mergedBody*/ ) const {}
745 
749  virtual void onMovedFromTo( const MergedBody::EdgeInteractionRefContainer& /*edges*/, const agx::MergedBody* /*fromMergedBody*/, const agx::MergedBody* /*toMergedBody*/ ) const {}
750 
751  protected:
755  virtual ~Listener();
756  };
757 
761  class AGXPHYSICS_EXPORT MergedBody::EdgeInteraction : public agx::Referenced, public agxStream::Serializable
762  {
763  public:
764 #ifndef SWIG
766  {
767  NONE = 0,
768  CONTACT = 1 << 0,
769  CONTACT_GENERATOR = 1 << 1,
770  CONSTRAINT = 1 << 2,
771  BINARY_CONSTRAINT = CONSTRAINT | (1 << 3),
772  PARTICLE_GENERATOR = 1 << 4
773  };
774 #endif
775 
776  public:
780  agx::RigidBody* getRigidBody1() const;
781 
785  agx::RigidBody* getRigidBody2() const;
786 
790  agx::Bool containsDeletedBodies() const;
791 
795  agx::Bool getValid() const;
796 
797 #ifndef SWIG
798 
801  agx::Bool isTagged( InteractionTag tag ) const;
802 #endif
803 
804  public:
809  virtual void generateInteraction( agxSDK::Simulation* simulation, agxCollide::LocalGeometryContactVector& newContacts ) = 0;
810 
811  AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE( MergedBody::EdgeInteraction );
812 
816  virtual void store( agxStream::OutputArchive& out ) const override;
817 
821  virtual void restore( agxStream::InputArchive& in ) override;
822 
826  virtual void storeLightData( agxStream::StorageStream& str ) const override;
827 
831  virtual void restoreLightData( agxStream::StorageStream& str ) override;
832 
833  protected:
834 #ifndef SWIG
835 
842  EdgeInteraction( agx::RigidBody* rb1, agx::RigidBody* rb2, InteractionTag tag, agx::Bool valid = true );
843 #endif
844 
848  virtual ~EdgeInteraction();
849 
853  void setBodies( agx::RigidBody* rb1, agx::RigidBody* rb2 );
854 
855  private:
856  agx::RigidBodyObserver m_bodies[ 2 ];
857  agx::Bool m_hadValidRb[ 2 ];
858  agx::Bool m_valid;
859  agx::Int32 m_tag;
860  };
861 
867  class AGXPHYSICS_EXPORT MergedBody::EmptyEdgeInteraction : public MergedBody::EdgeInteraction
868  {
869  public:
873  EmptyEdgeInteraction( agx::RigidBody* rb1, agx::RigidBody* rb2 );
874 
875  public:
876  AGXSTREAM_DECLARE_SERIALIZABLE( MergedBody::EmptyEdgeInteraction );
877 
881  virtual void storeLightData( agxStream::StorageStream& str ) const override;
882 
886  virtual void restoreLightData( agxStream::StorageStream& str ) override;
887 
888  protected:
892  EmptyEdgeInteraction();
893 
897  virtual ~EmptyEdgeInteraction();
898 
902  virtual void generateInteraction( agxSDK::Simulation* /*simulation*/, agxCollide::LocalGeometryContactVector& /*newContacts*/ ) override {}
903  };
904 
909  class AGXPHYSICS_EXPORT MergedBody::ContactGeneratorEdgeInteraction : public MergedBody::EdgeInteraction
910  {
911  public:
915  ContactGeneratorEdgeInteraction( agx::RigidBody* rb1, agx::RigidBody* rb2 );
916 
917  public:
918  AGXSTREAM_DECLARE_SERIALIZABLE( MergedBody::ContactGeneratorEdgeInteraction );
919 
923  virtual void storeLightData( agxStream::StorageStream& str ) const override;
924 
928  virtual void restoreLightData( agxStream::StorageStream& str ) override;
929 
930  protected:
934  ContactGeneratorEdgeInteraction();
935 
939  virtual ~ContactGeneratorEdgeInteraction();
940 
944  virtual void generateInteraction( agxSDK::Simulation* simulation, agxCollide::LocalGeometryContactVector& newContacts ) override;
945  };
946 
950  class AGXPHYSICS_EXPORT MergedBody::GeometryContactEdgeInteraction : public MergedBody::EdgeInteraction
951  {
952  public:
957  {
958  enum Strength
959  {
962  TANGENT_V_DIRECTION
963  };
964 
965  Point();
966  Point( agx::Physics::ContactPointPtr pointPtr, agx::Physics::ContactMaterialPtr contactMaterial, const agx::AffineMatrix4x4& toLocal, const agx::RigidBody* rb1, const agx::RigidBody* rb2 );
967 
974  };
976 
977  public:
982  explicit GeometryContactEdgeInteraction( agx::Physics::GeometryContactPtr gcPtr );
983 
992  GeometryContactEdgeInteraction( agxCollide::Geometry* geometry1, agx::RigidBody* rb1, agxCollide::Geometry* geometry2, agx::RigidBody* rb2 );
993 
997  agxCollide::Geometry* getGeometry1() const;
998 
1002  agxCollide::Geometry* getGeometry2() const;
1003 
1007  const PointContainer& getPoints() const;
1008 
1009  public:
1010  AGXSTREAM_DECLARE_SERIALIZABLE( MergedBody::GeometryContactEdgeInteraction );
1011 
1015  virtual void storeLightData( agxStream::StorageStream& str ) const override;
1016 
1020  virtual void restoreLightData( agxStream::StorageStream& str ) override;
1021 
1023 #ifndef SWIG
1024 
1028  typedef std::function<agxCollide::Geometry*( agxCollide::Geometry*, agx::RigidBody* )> GeometryUpdateFunction;
1029 
1038  void updateGeometries( GeometryUpdateFunction geometryUpdateFunction );
1039 #endif
1041 
1042  protected:
1046  GeometryContactEdgeInteraction();
1047 
1051  virtual ~GeometryContactEdgeInteraction();
1052 
1056  virtual void generateInteraction( agxSDK::Simulation* simulation, agxCollide::LocalGeometryContactVector& newContacts ) override;
1057 
1058  private:
1059  PointContainer m_points;
1060  agxCollide::GeometryObserver m_geometries[ 2 ];
1061  };
1062 
1066  class AGXPHYSICS_EXPORT MergedBody::BinaryConstraintEdgeInteraction : public MergedBody::EdgeInteraction
1067  {
1068  public:
1073  explicit BinaryConstraintEdgeInteraction( agx::Constraint* constraint );
1074 
1079  explicit BinaryConstraintEdgeInteraction( agx::HighLevelConstraintImplementation* constraint );
1080 
1084  agx::HighLevelConstraintImplementation* getConstraint();
1085 
1089  const agx::HighLevelConstraintImplementation* getConstraint() const;
1090 
1091  public:
1092  AGXSTREAM_DECLARE_SERIALIZABLE( MergedBody::BinaryConstraintEdgeInteraction );
1093 
1097  virtual void storeLightData( agxStream::StorageStream& str ) const override;
1098 
1102  virtual void restoreLightData( agxStream::StorageStream& str ) override;
1103 
1104  protected:
1108  BinaryConstraintEdgeInteraction();
1109 
1113  virtual ~BinaryConstraintEdgeInteraction();
1114 
1118  virtual void generateInteraction( agxSDK::Simulation* simulation, agxCollide::LocalGeometryContactVector& newContacts ) override;
1119 
1120  private:
1122  };
1123 
1127  class AGXPHYSICS_EXPORT MergedBody::ParticleParticleInteraction : public MergedBody::EdgeInteraction
1128  {
1129  public:
1133  ParticleParticleInteraction(agx::RigidBody* substituteBody1, agx::RigidBody* substituteBody2);
1134 
1135  public:
1136  AGXSTREAM_DECLARE_SERIALIZABLE(MergedBody::ParticleParticleInteraction);
1137 
1141  virtual void storeLightData(agxStream::StorageStream& str) const override;
1142 
1146  virtual void restoreLightData(agxStream::StorageStream& str) override;
1147 
1148  protected:
1152  ParticleParticleInteraction();
1153 
1157  virtual ~ParticleParticleInteraction();
1158 
1162  virtual void generateInteraction(agxSDK::Simulation* /*simulation*/, agxCollide::LocalGeometryContactVector& /*newContacts*/) override;
1163  };
1164 
1165  template<typename DataT, typename ObjT>
1166  AGX_FORCE_INLINE DataT* MergedBody::getMergedData( const ObjT& obj )
1167  {
1168  return agx::InternalData::get<DataT>( obj, agx::InternalData::MERGED_BODY );
1169  }
1170 
1171  template<typename DataT, typename ObjT>
1172  AGX_FORCE_INLINE DataT* MergedBody::getOrCreateMergedData( ObjT obj )
1173  {
1174  agxAssert( obj != nullptr );
1175  return agx::InternalData::getOrCreate<DataT>( obj, agx::InternalData::MERGED_BODY );
1176  }
1177 
1178  AGX_FORCE_INLINE const MergedBody* MergedBody::get( const RigidBody* rb )
1179  {
1180  const MergedData* data = getMergedData<MergedData>( rb );
1181  return data != nullptr ? data->mergedBody : nullptr;
1182  }
1183 
1184  AGX_FORCE_INLINE MergedBody* MergedBody::get( RigidBody* rb )
1185  {
1186  MergedData* data = getMergedData<MergedData>( rb );
1187  return data != nullptr ? data->mergedBody : nullptr;
1188  }
1189 
1190  AGX_FORCE_INLINE const MergedBody* MergedBody::getActive( const RigidBody* rb )
1191  {
1192  const MergedBody* mb = MergedBody::get( rb );
1193  return mb != nullptr && mb->isActive() ? mb : nullptr;
1194  }
1195 
1196  AGX_FORCE_INLINE MergedBody* MergedBody::getActive( RigidBody* rb )
1197  {
1198  MergedBody* mb = MergedBody::get( rb );
1199  return mb != nullptr && mb->isActive() ? mb : nullptr;
1200  }
1201 
1202  inline Bool MergedBody::isRoot( const RigidBody* rb )
1203  {
1204  return rb != nullptr &&
1205  rb->getEntity().state().mergedRootBody();
1206  }
1207 
1209  {
1210  if ( !rb )
1211  return MergedBodyIndex();
1212  const MergedBody* root = getActive( rb.model() );
1213  return root != nullptr ? MergedBodyIndex( root->getRigidBody()->getEntity(), rb ) : MergedBodyIndex( rb, rb );
1214  }
1215 
1216  AGX_FORCE_INLINE const RigidBody* MergedBody::filter( const RigidBody* rb )
1217  {
1218  const MergedBody* root = getActive( rb );
1219  return root != nullptr ? root->getRigidBody() : rb;
1220  }
1221 
1222  AGX_FORCE_INLINE RigidBody* MergedBody::filter( RigidBody* rb )
1223  {
1224  MergedBody* root = getActive( rb );
1225  return root != nullptr ? root->getRigidBody() : rb;
1226  }
1227 
1228  AGX_FORCE_INLINE Bool MergedBody::isMerged( const MergedData* data )
1229  {
1230  return data != nullptr && data->mergedBody != nullptr;
1231  }
1232 
1233  AGX_FORCE_INLINE Bool MergedBody::isActive() const
1234  {
1235  return m_simulation != nullptr && m_state.Is( READY_FOR_SOLVER );
1236  }
1237 
1238  AGX_FORCE_INLINE MergedBody::RootBodyData* MergedBody::getRootBodyData( const RigidBody* rb )
1239  {
1240  MergedData* data = getMergedData<MergedData>( rb );
1241  return data != nullptr ? data->rootBodyData : nullptr;
1242  }
1243 
1245  inline Bool MergedBody::EdgeInteraction::isTagged(InteractionTag tag) const
1246  {
1247  return ( m_tag & (Int32)tag ) != 0;
1248  }
1250 }
1251 
AGXPHYSICS_EXPORT agx::RigidBody *& model()
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:81
agx::BitState< State > InternalState
Definition: MergedBody.h:109
A std::pair, with both elements of the same type, and symmetric so (a, b) == (b, a) ...
Definition: SymmetricPair.h:31
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:92
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:956
Base class for a merge split algorithm handling a set of merged bodies.
This namespace consists of a set of classes for handling geometric intersection tests including boole...
virtual void onRemoved(const MergedBody::EdgeInteractionRefContainer &, const agx::MergedBody *) const
Called when an edge is removed from the merged body.
Definition: MergedBody.h:744
agx::Physics::RigidBodyPtr getEntity() const
Internal method.
Definition: RigidBody.h:1430
Base class for a strong interaction concept where there interaction is defined in the mass matrix par...
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:749
agx::VectorPOD< Point > PointContainer
Definition: MergedBody.h:975
agx::SetVector< agx::MergedBodyRef > MergedBodyRefSetVector
Definition: MergedBody.h:48
#define AGXPHYSICS_EXPORT
agx::Bool isActive() const
Definition: MergedBody.h:1233
agx::Vector< EdgeInteractionRef > EdgeInteractionRefContainer
Definition: MergedBody.h:110
The base class for a constraint.
Definition: Constraint.h:88
virtual void generateInteraction(agxSDK::Simulation *, agxCollide::LocalGeometryContactVector &) override
Does nothing.
Definition: MergedBody.h:902
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
VectorType::iterator iterator
Definition: HashVector.h:64
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
Representation of a name string.
Definition: Name.h:32
#define AGX_FORCE_INLINE
Definition: Object.h:59
agx::Bool isMerged() const
Definition: MergedBody.h:98
AGXPHYSICS_EXPORT agx::RigidBodyState & state()
Base class providing referencing counted objects.
Definition: Referenced.h:119
The geometry representation used by the collision detection engine.
Definition: Geometry.h:92
Structure holding several "normal" rigid bodies.
Definition: MergedBody.h:55
The body fixed node is attached to a body at a given offset.
Pointer to a entity instance of type Physics.RigidBody.
virtual void onAdd(agx::RigidBody *, const agx::MergedBody *) const
Called when a body is added to the merged body.
Definition: MergedBody.h:729
uint32_t UInt
Definition: Integer.h:34
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
agx::Vector< LocalGeometryContact > LocalGeometryContactVector
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:39
State
Internal state of this merged body.
Definition: MergedBody.h:69
#define agxAssert(expr)
Definition: debug.h:143
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
A geometry contact hold contact information between two geometries.
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:108
virtual void onRemove(agx::RigidBody *, const agx::MergedBody *) const
Called when a body is removed from the merged body.
Definition: MergedBody.h:734
#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
agx::RigidBody * getRigidBody() const
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:99
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:126
#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:221
uint16_t UInt16
Definition: Integer.h:39
MergedBodyIndex()
Default constructor initializes both indices to Invalid Index.
Definition: MergedBody.h:86
double Real
Definition: Real.h:42
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: Vector.h:34
MotionControl
The MotionControl enumeration indicates what makes a RigidBody move.
Definition: RigidBody.h:65
AGXCORE_EXPORT Component * root()
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30
std::function< void(agx::RigidBody *) > RigidBodyVisitor
Definition: MergedBody.h:107
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
virtual void onAdded(EdgeInteraction *, const agx::MergedBody *) const
Called when an edge is added to the merged body.
Definition: MergedBody.h:739
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97
Pointer to a entity instance of type Physics.ContactMaterial.
agx::observer_ptr< Geometry > GeometryObserver
Definition: Geometry.h:78
VectorType::const_iterator const_iterator
Definition: HashVector.h:65
Flags
Flags for specifying what is enabled in the debug rendering system.
Definition: RenderManager.h:58