AGX Dynamics  2.38.0.2
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 
436  agx::Bool updateProperties();
437 
438  protected:
442  virtual ~MergedBody() throw();
443 
444  friend class agxSDK::Simulation; // Remove of bodies and constraints.
445  friend class agxCollide::Space; // Remove of geometries from space.
446  friend class agx::RigidBody; // Remove of geometries from bodies.
451  virtual void setSimulation( agxSDK::Simulation* simulation );
452 
456  virtual void onRemove( agx::RigidBody* rb );
457 
461  virtual void onRemove( agx::Constraint* constraint );
462 
466  virtual void onRemove( agxCollide::Geometry* geometry );
467 
471  virtual void preCollide();
472 
476  virtual void preStep();
477 
482  virtual void postStep();
483 
487  virtual void onCleanup();
488 
489  protected:
493  agxSDK::Simulation* getSimulation();
494 
498  const agxSDK::Simulation* getSimulation() const;
499 
500  private:
501  struct PairData : public agx::Referenced
502  {
504 
505  protected:
506  virtual ~PairData() {}
507  };
508  typedef agx::ref_ptr<PairData> PairDataRef;
509 
511  typedef agx::Vector<EdgeInteractionConstRef> EdgeInteractionConstRefContainer;
512  typedef agx::HashVector<Key, PairDataRef> PairInteractionsContainer;
513  typedef PairInteractionsContainer::iterator PairInteractionsIterator;
514  typedef PairInteractionsContainer::const_iterator PairInteractionsConstIterator;
515  typedef agx::Vector<RigidBodyRef> RigidBodyContainer;
516  typedef agx::Vector<ListenerRef> ListenerContainer;
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  };
531  typedef agx::ref_ptr<RootBodyData> RootBodyDataRef;
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  };
566  typedef agx::ref_ptr<MergedData> MergedDataRef;
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  };
582  typedef agx::ref_ptr<ConstraintMergedData> ConstraintMergedDataRef;
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 
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:
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:
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:
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:
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:
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 
1179  {
1180  const MergedData* data = getMergedData<MergedData>( rb );
1181  return data != nullptr ? data->mergedBody : nullptr;
1182  }
1183 
1185  {
1186  MergedData* data = getMergedData<MergedData>( rb );
1187  return data != nullptr ? data->mergedBody : nullptr;
1188  }
1189 
1191  {
1192  const MergedBody* mb = MergedBody::get( rb );
1193  return mb != nullptr && mb->isActive() ? mb : nullptr;
1194  }
1195 
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 
1217  {
1218  const MergedBody* root = getActive( rb );
1219  return root != nullptr ? root->getRigidBody() : rb;
1220  }
1221 
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 
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 
agx::MergedBodyRefSetVector
agx::SetVector< agx::MergedBodyRef > MergedBodyRefSetVector
Definition: MergedBody.h:48
agx::MergedBody::Point::localTangentV
agx::Vec3 localTangentV
Definition: MergedBody.h:972
agx::SymmetricPair
A std::pair, with both elements of the same type, and symmetric so (a, b) == (b, a)
Definition: SymmetricPair.h:31
agx::MergedBody::InternalState
agx::BitState< State > InternalState
Definition: MergedBody.h:109
agx::UInt
uint64_t UInt
Definition: Integer.h:27
InternalData.h
agx::Real
double Real
Definition: Real.h:42
agx::MergedBody::InteractionTag
InteractionTag
Definition: MergedBody.h:765
agx::MergedBody::Point::TANGENT_U_DIRECTION
@ TANGENT_U_DIRECTION
Definition: MergedBody.h:961
agx::MergedBody::getActive
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:1190
agx::Vector< EdgeInteractionRef >
agx::RigidBody::MotionControl
MotionControl
The MotionControl enumeration indicates what makes a RigidBody move.
Definition: RigidBody.h:62
agxStream::out
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.
Definition: OutputArchive.h:412
BitState.h
agx::MergedBody::EdgeInteraction
EdgeInteraction(agx::RigidBody *rb1, agx::RigidBody *rb2, InteractionTag tag, agx::Bool valid=true)
Construct given two rigid bodies and a valid flag.
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:51
agx::MergedBody::MergedBodyIndex::originalIndex
UInt originalIndex
Definition: MergedBody.h:101
agxStream::Serializable
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
agx::StrongInteraction
Base class for a strong interaction concept where there interaction is defined in the mass matrix par...
Definition: StrongInteraction.h:42
agxRender::Flags
Flags
Flags for specifying what is enabled in the debug rendering system.
Definition: RenderManager.h:58
DOXYGEN_END_INTERNAL_BLOCK
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
agx::Physics::ContactPointPtr
Pointer to a entity instance of type Physics.ContactPoint.
Definition: ContactPointEntity.h:258
agxCollide::LocalGeometryContactVector
agx::Vector< LocalGeometryContact > LocalGeometryContactVector
Definition: LocalContactPoint.h:300
agx::AffineMatrix4x4T< Real >
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
ParticleGeometryContactEntity.h
agxAssert
#define agxAssert(expr)
Definition: debug.h:143
agx::MergedBody::Point::NORMAL_DIRECTION
@ NORMAL_DIRECTION
Definition: MergedBody.h:960
agx::MergedBody::GeometryContactEdgeInteraction
GeometryContactEdgeInteraction()
Default constructor used by serialization.
ConstraintImplementation.h
agxStream::StorageStream
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:48
agx::MergedBody::Point
Contact point data store in first rigid body local frame.
Definition: MergedBody.h:956
AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE
#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
agx::MergedBody::isActive
agx::Bool isActive() const
Definition: MergedBody.h:1233
agx::MergedBody::onRemoved
virtual void onRemoved(const MergedBody::EdgeInteractionRefContainer &, const agx::MergedBody *) const
Called when an edge is removed from the merged body.
Definition: MergedBody.h:744
AGXSTREAM_DECLARE_SERIALIZABLE
#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::VectorPOD< RigidBody * >
agx::Physics::RigidBodyPtr
Pointer to a entity instance of type Physics.RigidBody.
Definition: RigidBodyEntity.h:371
agx::observer_ptr< RigidBody >
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
agx::MergedBody::MergedBodyIndex::MergedBodyIndex
MergedBodyIndex()
Default constructor initializes both indices to Invalid Index.
Definition: MergedBody.h:86
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agx::MergedBody::onMovedFromTo
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
agxStream::in
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:399
agxSDK::MergeSplitHandler
Base class for a merge split algorithm handling a set of merged bodies.
Definition: MergeSplitHandler.h:34
agx::MergedBody::Point::localTangentU
agx::Vec3 localTangentU
Definition: MergedBody.h:971
agx::MergedBody::PointContainer
agx::VectorPOD< Point > PointContainer
Definition: MergedBody.h:975
agx::MergedBody::MergedBodyIndex
Object with index of merged body and the original index of a merged object.
Definition: MergedBody.h:81
agxCollide::GeometryObserver
agx::observer_ptr< Geometry > GeometryObserver
Definition: Geometry.h:77
agx::MergedBody::ParticleParticleInteraction
ParticleParticleInteraction()
Default constructor used by serialization.
agx::MergedBody::Point::strength
agx::Vec3 strength
Definition: MergedBody.h:973
AGX_DECLARE_VECTOR_TYPES
#define AGX_DECLARE_VECTOR_TYPES(type)
Definition: Vector.h:34
agx::MergedBody::EdgeInteractionRefContainer
agx::Vector< EdgeInteractionRef > EdgeInteractionRefContainer
Definition: MergedBody.h:110
agx::MergedBody::generateInteraction
virtual void generateInteraction(agxSDK::Simulation *, agxCollide::LocalGeometryContactVector &) override
Does nothing.
Definition: MergedBody.h:902
agx::UInt16
uint16_t UInt16
Definition: Integer.h:31
agx::MergedBody::Point::Strength
Strength
Definition: MergedBody.h:958
agx::ref_ptr< MergedBody >
agxSDK::Simulation
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:125
agx::Physics::GeometryContactPtr
A geometry contact hold contact information between two geometries.
Definition: GeometryContactEntity.h:224
agx::MergedBody::EmptyEdgeInteraction
EmptyEdgeInteraction()
Default constructor used by serialization.
agx::SetVector< agx::MergedBodyRef >
agxWire
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:39
agxWire::BodyFixedNode
The body fixed node is attached to a body at a given offset.
Definition: agxWire/Node.h:1225
LocalContactPoint.h
agx::MergedBody::MergedBodyIndex::index
UInt index
Definition: MergedBody.h:100
agx::MergedBody::onAdd
virtual void onAdd(agx::RigidBody *, const agx::MergedBody *) const
Called when a body is added to the merged body.
Definition: MergedBody.h:729
agx::Physics::RigidBodyPtr::model
AGXPHYSICS_EXPORT agx::RigidBody *& model()
agx::MergedBody::findMergedBodyIndex
static MergedBodyIndex findMergedBodyIndex(agx::Physics::RigidBodyPtr rb)
Similar to filter( const agx::RigidBody* rb ).
Definition: MergedBody.h:1208
AddedMassInteraction.h
agx::Mutex
std::mutex Mutex
Definition: Referenced.h:99
agxCollide::Geometry
The geometry representation used by the collision detection engine.
Definition: Geometry.h:91
agx::MergedBody::EdgeInteractionVisitor
std::function< void(EdgeInteraction *) > EdgeInteractionVisitor
Definition: MergedBody.h:108
agx::MergedBody::Point::localNormal
agx::Vec3 localNormal
Definition: MergedBody.h:970
agx::MergedBody::State
State
Internal state of this merged body.
Definition: MergedBody.h:69
agx::Physics::RigidBodyPtr::state
AGXPHYSICS_EXPORT agx::RigidBodyState & state()
agx::Name
Representation of a name string.
Definition: Name.h:32
agx::MergedBody::MergedBodyIndex::MergedBodyIndex
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
agxStream::OutputArchive
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
agx::root
AGXCORE_EXPORT Component * root()
agx::HighLevelConstraintImplementation
Definition: ConstraintImplementation.h:1028
agxStream::InputArchive
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:50
agx::MergedBody::BinaryConstraintEdgeInteraction
BinaryConstraintEdgeInteraction()
Default constructor used by serialization.
ParticlePairContactEntity.h
agx::MergedBody::onRemove
virtual void onRemove(agx::RigidBody *, const agx::MergedBody *) const
Called when a body is removed from the merged body.
Definition: MergedBody.h:734
agx::RigidBodyRef
agx::ref_ptr< RigidBody > RigidBodyRef
Definition: RigidBody.h:44
agx::Referenced
Base class providing referencing counted objects.
Definition: Referenced.h:119
AGX_DECLARE_POINTER_TYPES
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
agxCollide
This namespace consists of a set of classes for handling geometric intersection tests including boole...
Definition: ContactForceFilterParticipant.h:22
agx::GraphNode::BINARY_CONSTRAINT
@ BINARY_CONSTRAINT
Definition: GraphNode.h:34
agx::Bool
bool Bool
Definition: Integer.h:40
agx::Constraint
The base class for a constraint.
Definition: Constraint.h:88
agx::MergedBody::filter
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:1216
agx::MergedBody::Point::depth
agx::Real depth
Definition: MergedBody.h:968
agx::MergedBody::ContactGeneratorEdgeInteraction
ContactGeneratorEdgeInteraction()
Default constructor used by serialization.
agxSDK
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30
agx::MergedBody::get
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:1178
agx::Vec3T< Real >
agx::InvalidIndex
const AGXCORE_EXPORT InvalidIndexStruct InvalidIndex
agx::MergedBody::MergedBodyIndex::isMerged
agx::Bool isMerged() const
Definition: MergedBody.h:98
agx::InternalData::MERGED_BODY
@ MERGED_BODY
Merged states, neighbors etc.
Definition: InternalData.h:42
agx::Int32
int32_t Int32
Definition: Integer.h:37
agx::MergedBody::Point::localPoint
agx::Vec3 localPoint
Definition: MergedBody.h:969
agx::MergedBody::onAdded
virtual void onAdded(EdgeInteraction *, const agx::MergedBody *) const
Called when an edge is added to the merged body.
Definition: MergedBody.h:739
agx::RigidBody::getEntity
agx::Physics::RigidBodyPtr getEntity() const
Internal method.
Definition: RigidBody.h:1156
agx::MergedBody
Structure holding several "normal" rigid bodies.
Definition: MergedBody.h:55
agx::HashVector< Key, PairDataRef >
agx::Physics::ContactMaterialPtr
Pointer to a entity instance of type Physics.ContactMaterial.
Definition: ContactMaterialEntity.h:274
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58
agx::MergedBody::isRoot
static agx::Bool isRoot(const agx::RigidBody *rb)
Definition: MergedBody.h:1202
agx::MergedBody::RigidBodyVisitor
std::function< void(agx::RigidBody *) > RigidBodyVisitor
Definition: MergedBody.h:107