AGX Dynamics  2.38.0.2
Space.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 <agxCollide/agxCollide.h>
20 #include <agx/HashVector.h>
21 
22 #include <agx/SetVector.h>
23 #include <agx/Vector.h>
24 #include <agx/HashSet.h>
25 #include <string>
26 
27 #include <agxCollide/Geometry.h>
29 #include <agxCollide/Contacts.h>
31 
35 #include <agxCollide/Sphere.h>
36 #include <agx/Task.h>
37 #include <agx/Timer.h>
38 #include <agx/Component.h>
39 #include <agx/HashTableComponent.h>
40 
46 
47 
48 namespace agxIO
49 {
50  class SceneExporter;
51 }
52 
53 namespace agx
54 {
55  class ParticleSystem;
56 }
57 
58 namespace agxSDK
59 {
60  class Simulation;
61 }
62 
63 namespace agxCollide
64 {
68  typedef std::pair<agx::Physics::ParticlePtr, agx::Physics::GeometryPtr> ParticleGeometryPair;
70 
73 
75 
82  {
83  public:
84 
87  INVALID_BROAD_PHASE_ALGORITHM = -1,
89  HIERARCHICAL_GRID
90  };
91 
95  Space();
96 
98  Space(agx::Device* device);
99 
104  void cleanup();
105 
110  bool setBroadPhaseAlgorithm(BroadPhaseAlgorithm algorithm);
111 
115  BroadPhaseAlgorithm getBroadPhaseAlgorithm() const;
116 
121  bool add( Geometry* geometry );
122 
128  bool remove( Geometry* geometry );
129 
135  const Geometry* getGeometry( const agx::Name& name ) const;
136 
143  Geometry* getGeometry( const agx::Name& name );
144 
151  const Geometry* getGeometry( const agx::Uuid& uuid ) const;
152 
159  Geometry* getGeometry( const agx::Uuid& uuid );
160 
169  const Geometry* getGeometryWithEntityId(agx::Index id) const;
170 
179  Geometry* getGeometryWithEntityId(agx::Index id);
180 
184  const GeometryRefVector& getGeometries() const;
185 
189  void updateBroadPhase();
190 
194  void update();
195 
200  void updateNarrowPhase();
201 
208  const GeometryContactPtrVector& getGeometryContacts() const;
209 
221  size_t getGeometryContacts(GeometryContactPtrVector& matches, const agxCollide::Geometry *geometry1, const agxCollide::Geometry *geometry2 = nullptr) const;
222 
234  size_t getGeometryContacts(GeometryContactPtrVector& matches, const agx::RigidBody *body1, const agx::RigidBody *body2 = nullptr) const;
235 
243 
254  void addGeometryContacts(const LocalGeometryContactVector& localContacts);
255 
259  void addListener(agxCollide::SpaceListener* listener);
260 
265  bool removeListener(agxCollide::SpaceListener* listener);
266 
280  bool testBoundingVolumeOverlap(
281  GeometryPtrVector& testGeometries,
282  GeometryPairVector& geometryPairs,
283  ParticleGeometryPairVector& particleGeometryPairs,
284  bool skip = true );
285 
299  bool testGeometryOverlap(
300  GeometryPtrVector& testGeometries,
301  LocalGeometryContactVector& geometryContacts,
302  LocalParticleGeometryContactVector& particleGeometryContacts,
303  bool skip = true
304  );
305 
318  GeometryContact getContact(Geometry* g1, Geometry* g2) const;
319 
334  bool intersect(
335  const agx::Vec3& point,
336  const agx::Vec3& direction,
337  LocalGeometryContactVector& geometryContacts,
338  LocalParticleGeometryContactVector& particleGeometryContacts,
339  const agx::Real length = FLT_MAX / 4
340  );
341 
346  void setEnableContactReduction( bool flag );
347 
358  void setContactReductionBinResolution(agx::UInt binResolution);
359 
361  bool getEnableContactReduction() const;
362 
364  agx::UInt getContactReductionBinResolution() const;
365 
371  void setContactReductionThreshold(agx::UInt threshold);
372 
376  agx::UInt getContactReductionThreshold() const;
377 
381  agx::UInt32 getUniqueGroupID();
382 
394  void setEnablePair( agx::UInt32 group1, agx::UInt32 group2, bool flag );
395  void setEnablePair( const agx::Name& group1, const agx::Name& group2, bool flag );
396 
403  bool getEnablePair( agx::UInt32 group1, agx::UInt32 group2 ) const;
404 
411  bool getEnablePair(const agx::Name& group1, const agx::Name& group2) const;
412 
421  template< typename F >
422  void enableForContacts(F relevantCollision)
423  {
424  // For all COMBINATIONS of geometries, check if the collision is possibly relevant
425  // and add them to broad phase if their bounding volumes are overlapping.
426  for ( agx::UInt i = 0, numGeometries = m_geometries.size(); !m_geometries.empty() && i < numGeometries - 1; ++i ) {
427  for ( agx::UInt j = i + 1; j < numGeometries; ++j ) {
428  if ( i == j )
429  continue;
430 
431  // Relevant collision:
432  // Report overlap.
433  if ( relevantCollision(m_geometries[ i ], m_geometries[ j ] ) &&
434  m_sweepAndPrune && // Only need to report overlaps to SAP, the grid will find them by itself on its next search.
435  canCollide( m_geometries[ i ], m_geometries[ j ] ) &&
436  m_geometries[ i ]->getBoundingVolume()->hasOverlap( *m_geometries[ j ]->getBoundingVolume() ) ) {
437  reportOverlap( m_geometries[ i ], m_geometries[ j ] );
438  }
439  }
440  }
441  }
442 
451  template< typename F >
452  void disableForContacts(F relevantCollision)
453  {
454  // Among the current broad phase pairs, check if we have
455  // a relevant match of geometries. If so, remove (will send
456  // separation event if someone is listening to that).
457  GeometryPairVector pairsToRemove;
458  pairsToRemove.reserve( 16 );
459 
460  const BroadPhasePairVector& broadPhasePairs = getBroadPhasePairs();
461  for ( agx::UInt i = 0, numBroadPhasePairs = broadPhasePairs.size(); i < numBroadPhasePairs; ++i ) {
462  const BroadPhasePairVector::value_type& bpPair = broadPhasePairs[ i ];
463  if ( bpPair.geometry1() && bpPair.geometry2() && relevantCollision(bpPair.geometry1().model(), bpPair.geometry2().model() ) )
464  pairsToRemove.push_back( GeometryPair( bpPair.geometry1().model(), bpPair.geometry2().model() ) );
465  }
466 
467  while ( !pairsToRemove.empty() ) {
468  if (m_sweepAndPrune)
469  m_sweepAndPrune->removePair( pairsToRemove.back().first, pairsToRemove.back().second );
470  pairsToRemove.pop_back();
471  }
472  }
473 
485  void insertDisabledGroupPair( agx::UInt32 group1, agx::UInt32 group2 );
486 
498  void eraseDisabledGroupPair( agx::UInt32 group1, agx::UInt32 group2 );
499 
513  bool canCollide( const Geometry* g1, const Geometry* g2 ) const;
514 
516  void setEnableCollisions(const Geometry* g1, const Geometry* g2, bool flag);
517 
518  // To be called for geometries that are enabled/disabled
519  void setEnableGeometry(Geometry* geometry, bool flag);
520 
524  agx::Real getOrientedBoundsThreshold() const;
525 
530  void setOrientedBoundsThreshold( agx::Real threshold );
531 
537  void removeContact(agx::Physics::GeometryContactPtr contact);
538 
542  void commitRemovedContacts();
543 
547  const BroadPhasePairVector& getBroadPhasePairs() const;
548 
552  const SeparationPairVector& getSeparationPairs() const;
553 
554 
562  size_t getSeparationPairs(agx::Physics::GeometryPairPtrVector &matches, const agxCollide::Geometry *geometry1, const agxCollide::Geometry *geometry2=nullptr) const;
563 
571  size_t getSeparationPairs(agx::Physics::GeometryPairPtrVector& matches, const agx::RigidBody *body1, const agx::RigidBody *body2=nullptr) const;
572 
573 
578  void reportOverlap( agxCollide::Geometry* geometry1, agxCollide::Geometry* geometry2 );
579 
586  void removeOverlap( agxCollide::Geometry* geometry1, agxCollide::Geometry* geometry2 );
587 
591  agxCollide::SweepAndPrune* getSweepAndPrune();
592 
594 
596  const GeometryPairHash& getDisabledPairs() const;
597 
598  void resetParticleCellAssignments();
599  void resetGeometryCellAssignments(agxCollide::Geometry* geometry);
600 
601 
605  HierarchicalGrid *getHierarchicalGrid();
606 
608  const ParticleGeometryContactVector& getParticleGeometryContacts();
609 
611  const ParticlePairContactVector& getParticleParticleContacts();
612 
614  size_t computeNumberOfEnabledContactPoints() const;
615 
621  agxCollide::DisabledCollisionsState findDisabledCollisionsState() const;
622 
623  public:
624 
626 
627 
628 
631  void synchronizeTransforms();
632 
636  void synchronizeBounds();
641  void printContacts(const agx::String& title);
642 
643  CollisionGroupManager* getCollisionGroupManager();
644  const CollisionGroupManager* getCollisionGroupManager() const;
645 
646  agxData::EntityStorage* getShapeStorage(agxData::EntityModel* shapeModel);
647 
648  agxData::EntityStorage *getGeometryStorage();
649 
650  agxData::EntityStorage* getGeometryContactStorage();
651  agxData::EntityStorage* getContactPointStorage();
652  agxData::EntityStorage* getOrientedGeometryBoundStorage();
653 
654  void setEnableParticleGridTasks(bool flag);
655  void optimizeGridCellFitting();
656 
658  agx::TaskGroup* getUpdateTask();
659 
660 
661  SpaceListener::GeometryEvent addGeometryEvent;
662  SpaceListener::GeometryEvent removeGeometryEvent;
663 
664  SpaceListener::ShapeEvent addShapeEvent;
665  SpaceListener::ShapeEvent removeShapeEvent;
666 
667  static agx::Model* ClassModel();
668 
670 
671  typedef agx::SymmetricPair<unsigned> GeometryIDPair;
672 
674  class SpaceSerializer : public agxStream::Serializable
675  {
676  public:
677  SpaceSerializer( const agxCollide::Space* space ) : m_space(space) {}
678  AGXSTREAM_DECLARE_SERIALIZABLE(agxCollide::Space::SpaceSerializer);
679 
680  const agxCollide::Space* getSpace() const {
681  return m_space;
682  }
683  void setSpace( agxCollide::Space* space ) {
684  m_space = space;
685  }
686 
687  typedef agx::Vector<GeometryIDPair> DisablePairVector;
688  DisablePairVector m_disabledGeometryIDPairs;
689  agx::UInt32 m_uniqueGroupID;
690 
691  protected:
692  SpaceSerializer( ) : m_space(nullptr) {}
693  const Space* m_space;
694 
695  };
696 
697  friend class SpaceSerializer;
698  friend class agxSDK::Simulation;
699 
701 
702  protected:
703 
705  virtual ~Space();
706 
708 
709  void clearContactData();
710 
712  void garbageCollect(bool clearGcList = true);
713 
714  void restore( const SpaceSerializer& ss );
715 
716  void commitNewOverlaps();
717 
718  friend class Geometry;
719 
721  void init();
722 
723 
725  template <typename T1, typename T2>
726  void calculateNarrowPhase(BroadPhasePair* pair, T1& contactContainer, T2& separationContainer);
727 
728  void createGeometryContacts();
729  void startUpdateTimer(agx::Task* task);
730  void stopUpdateTimerAndReport(agx::Task* task);
731  void createShapeStorage(const agx::Path& entityPath);
732  void updateContactState();
733  void createMissingContactMaterials();
734  void updateSweepAndPrune();
735 
736  void loadTasks(BroadPhaseAlgorithm algorithm);
737  agx::Task* createSynchronizeTransformsTask();
738  agx::Task* createSynchronizeBoundsTask();
739  agx::Task* createUpdateBroadPhaseTask(BroadPhaseAlgorithm algorithm);
740  agx::Task* createUpdateNarrowPhaseTask( const agx::String& implementation = "");
741  agx::Task* createUpdateContactStateTask();
742 
743  void createParticlePairContacts();
744  void createParticleGeometryContacts();
745 
746 
748 
749  private:
750  void validate();
751 
752  bool removeSweepAndPrune();
753  bool removeGrid();
754 
755  friend class agxSDK::SimulationFrameWriter;
756  void setCollisionGroupManager(CollisionGroupManager* m);
757 
758  BroadPhaseAlgorithm m_broadPhaseAlgorithm;
759 
760  HierarchicalGridRef m_grid;
761  agxCollide::SweepAndPruneRef m_sweepAndPrune;
762 
763  agx::TaskGroupRef m_updateTask;
764  agx::TaskRef m_synchronizeTransformsTask;
765  agx::TaskRef m_synchronizeBoundsTask;
766  agx::TaskRef m_updateBroadPhaseTask;
767  agx::TaskRef m_updateNarrowPhaseTask;
768  agx::TaskRef m_updateContactStateTask;
769  agx::TaskRef m_createMissingMaterialsTask;
770 
771  agx::TaskRef m_synchronizeTransformsTask2;
772  agx::TaskRef m_synchronizeBoundsTask2;
773  agx::TaskRef m_updateBroadPhaseTask2;
774  agx::TaskRef m_updateNarrowPhaseTask2;
775  agx::TaskRef m_updateContactStateTask2;
776  agx::TaskRef m_createMissingMaterialsTask2;
777 
778  GeometryRefVector m_geometries;
779  agx::Vector<GeometryObserver> m_potentialProblemGeometries;
780 
781  agxData::EntityStorageRef m_geometryStorage;
782  agxData::EntityStorageRef m_geometryContactStorage;
783  agxData::EntityStorageRef m_contactPointStorage;
784  agxData::EntityStorageRef m_broadPhasePairStorage;
785  agxData::EntityStorageRef m_geometryContactSeparations;
786  agxData::EntityStorageRef m_orientedGeometryBoundStorage;
787  agxData::BufferRef m_materialLessGeometryContacts;
788  agxData::BufferRef m_sortedGeometryContacts;
789  agxData::BufferRef m_sortedSeparationPairs;
790  agxData::BufferRef m_filteredBroadPhasePairs;
791 
792  BroadPhasePairVector m_broadPhasePairVector;
793  SeparationPairVector m_separationPairVector;
794 
795  GeometryPairHash m_disabledGeometryPairs;
796 
797  friend class agxIO::SceneExporter;
798  friend class agxCollide::SweepAndPrune;
799 
800  agxCollide::SweepAndPrune::ExternallyReportedPairsContainer m_externallyReportedPairs;
801 
802  typedef agx::HashVector< agx::Physics::GeometryPtr, GeometryRef > GeometryRemoveTable;
803  GeometryRemoveTable m_geometriesToRemove;
804 
805  agx::Timer m_updateTimer;
806  agx::Task::ExecutionEvent::CallbackType m_startUpdateTimerCallback;
807  agx::Task::ExecutionEvent::CallbackType m_stopUpdateTimerAndReportCallback;
808 
809  agxData::ValueRefT<agx::Bool> m_contactReductionEnable;
810  agxData::ValueRefT<agx::UInt> m_contactReductionBinResolution;
811  agxData::ValueRefT<agx::UInt> m_contactReductionThreshold;
812  agxData::ValueRefT<agx::UInt> m_narrowPhaseMinJobSize;
813 
814  agxData::ValueRefT<agx::Real> m_orientedBoundsThreshold;
815 
816  GeometryRef m_ray;
817  SphereRef m_proxyParticle;
818 
819  GeometryContactPtrVector m_geometryContacts;
820  agxData::BufferRef m_geometryContactInstanceBuffer;
821  agxData::BufferRef m_contactPointInstanceBuffer;
822 
823  ParticleGeometryContactVector m_particleGeometryContacts;
824  ParticlePairContactVector m_particlePairContacts;
825 
826  typedef agx::HashTable<agxData::EntityModel*, agxData::EntityStorage*> ShapeStorageTable;
827  ShapeStorageTable m_shapeStorageTable;
828 
829  typedef agx::Vector< SpaceListenerRef > SpaceListenerRefVector;
830  SpaceListenerRefVector m_listeners;
831  agxData::Buffer::Event::CallbackType m_shapeTransformReallocationCallback;
832 
833 
834  agxData::EntityStorageRef m_collisionObjectStorage;
835  agxData::BufferRef m_collisionObjectBuffer_sourceIndex;
836  agxData::BufferRef m_collisionObjectBuffer_subsystem;
837  agxData::BufferRef m_collisionObjectBuffer_position;
838  agxData::BufferRef m_collisionObjectBuffer_radius;
839  agxData::BufferRef m_collisionObjectBuffer_obbIndex;
840 
841  agxData::BufferRef m_gridOvelapBuffer_collisionObject1;
842  agxData::BufferRef m_gridOvelapBuffer_collisionObject2;
843 
844  agx::TaskRef m_overlapTestTask;
845 
846  agx::HashSet<Geometry*> m_skipTable;
847 
848  typedef agx::HashTableComponent<agxData::GeometryPair, agx::Physics::GeometryContactPtr> GridContactTableComponent;
849  typedef agx::QuadraticProbingHashTable<agxData::GeometryPair, agx::Physics::GeometryContactPtr, agx::HashFn<agxData::GeometryPair>, agxData::BufferProxyAllocator> GridContactTable;
850 
851 
852  CollisionGroupManagerRef m_collisionGroupManager;
853 
854  agxData::Value::Event::CallbackType m_gridCellSizeAlignmentCallback;
855  void gridCellSizeAlignmentCallback(agxData::Value* sizeAlignment);
856 
857  GridContactTable* m_gridContactTable;
858  };
859 
860  /* Implementation */
861  AGX_FORCE_INLINE bool Space::canCollide( const Geometry* g1, const Geometry* g2 ) const
862  {
863  if (!(g1 && g2) )
864  return false;
865 
866  // We cannot collide with ourself. TODO Not necessarily true in general case, e.g., if a deformable is defined as one geometry
867  if (g1 == g2)
868  return false;
869 
870  // One of the geometries are disabled for collision
871  if (!(g1->isEnabled() && g2->isEnabled()))
872  return false;
873 
874  if (!(g1->getEnableCollisions() && g2->getEnableCollisions()))
875  return false;
876 
877  const agx::RigidBody* rb1 = g1->getRigidBody();
878  const agx::RigidBody* rb2 = g2->getRigidBody();
879 
880  // If one is disabled, ignore overlap.
881  if ( (rb1 && !rb1->getEnable()) || (rb2 && !rb2->getEnable()) )
882  return false;
883 
884  // not same (non-null) body
885  if (rb1 && (rb1 == rb2))
886  return false;
887 
888  // Is this geometry pair disabled?
889  if (m_disabledGeometryPairs.contains( GeometryPair(const_cast<Geometry*>(g1), const_cast<Geometry*>(g2)) ))
890  return false;
891 
892  // Can these two groups collide?
893  const agx::Physics::CollisionGroupSetPtr& groupSet1 = g1->getGroupSet();
894  const agx::Physics::CollisionGroupSetPtr& groupSet2 = g2->getGroupSet();
895  if (groupSet1 && groupSet2 && g1->getSpace() == this && g2->getSpace() == this && !m_collisionGroupManager->canSetsCollide(groupSet1, groupSet2))
896  return false;
897 
898  return true;
899  }
900 
902 
903  AGX_FORCE_INLINE agxData::EntityStorage* Space::getOrientedGeometryBoundStorage()
904  {
905  return m_orientedGeometryBoundStorage;
906  }
907 
908  AGX_FORCE_INLINE agxData::EntityStorage* Space::getGeometryContactStorage()
909  {
910  return m_geometryContactStorage;
911  }
912 
913  AGX_FORCE_INLINE agxData::EntityStorage* Space::getContactPointStorage()
914  {
915  return m_contactPointStorage;
916  }
917 
918 
919  AGX_FORCE_INLINE CollisionGroupManager* Space::getCollisionGroupManager()
920  {
921  return m_collisionGroupManager;
922  }
923 
924  AGX_FORCE_INLINE const CollisionGroupManager* Space::getCollisionGroupManager() const
925  {
926  return m_collisionGroupManager;
927  }
928 
929  AGX_FORCE_INLINE agxData::EntityStorage *Space::getGeometryStorage() { return m_geometryStorage; }
930 
932 
934  {
935  return m_geometries;
936  }
937 
938  AGX_FORCE_INLINE bool Space::getEnablePair( const agx::Name& group1, const agx::Name& group2 ) const
939  {
940  return this->getEnablePair(
941  m_collisionGroupManager->getGroupId(group1),
942  m_collisionGroupManager->getGroupId(group2));
943  }
944 
946  {
947  return m_collisionGroupManager->canGroupsCollide(group1, group2);
948  }
949 
951  {
952  m_broadPhasePairVector.allocator().update();
953  return m_broadPhasePairVector;
954  }
955 
957  {
958  m_separationPairVector.allocator().update();
959  return m_separationPairVector;
960  }
961 
963  {
964  if (contact)
965  contact.enabled() = false;
966  }
967 
969  {
970  if ( geometry1 == 0L || geometry2 == 0L || !geometry1->isEnabled() || !geometry2->isEnabled() )
971  return;
972 
973  m_externallyReportedPairs.insert( SweepAndPrune::SymmetricGeometryPtrPair( geometry1, geometry2 ), SweepAndPrune::SymmetricGeometryRefPair( geometry1, geometry2 ) );
974  }
975 
977  {
978  if ( m_sweepAndPrune == 0L || geometry1 == 0L || geometry2 == 0L )
979  return;
980 
981  auto it = m_externallyReportedPairs.find( SweepAndPrune::SymmetricGeometryPtrPair( geometry1, geometry2 ) );
982  if ( it != m_externallyReportedPairs.end() )
983  m_externallyReportedPairs.erase( it );
984  else
985  m_sweepAndPrune->removePair( geometry1, geometry2 );
986  }
987 
989  {
990  return m_contactReductionEnable->get();
991  }
992 
994  {
995  return m_contactReductionBinResolution->get();
996  }
997 
999  {
1000  return m_orientedBoundsThreshold->get();
1001  }
1002 
1004 
1005 }
agxCollide::SeparationPairVector
agx::Vector< agx::Physics::GeometryPairPtr, agxData::BufferProxyAllocator > SeparationPairVector
Definition: Space.h:66
agx::SymmetricPair
A std::pair, with both elements of the same type, and symmetric so (a, b) == (b, a)
Definition: SymmetricPair.h:31
agx::UInt
uint64_t UInt
Definition: Integer.h:27
agxSDK::Simulation::garbageCollect
void garbageCollect()
Use with caution!
agx::Real
double Real
Definition: Real.h:42
agxCollide::ParticlePairContactVector
agx::Vector< agx::Physics::ParticlePairContactPtr > ParticlePairContactVector
Definition: Space.h:72
agxCollide::HierarchicalGrid
Definition: HierarchicalGrid.h:30
Vector.h
Sphere.h
agxData::GeometryPair
agx::SymmetricPair< agx::Physics::GeometryPtr > GeometryPair
Definition: Geometry.h:65
agx::Vector< agx::Physics::BroadPhasePairPtr, agxData::BufferProxyAllocator >
agxData::BufferRef
agx::ref_ptr< Buffer > BufferRef
Definition: Buffer.h:47
GeometryContactEntity.h
agx::Physics::GeometryPairPtr::geometry2
AGXPHYSICS_EXPORT agx::Physics::GeometryPtr & geometry2()
agx::Container::size
size_t size() const
Definition: Container.h:134
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:51
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
agxCollide::Space::SWEEP_AND_PRUNE
@ SWEEP_AND_PRUNE
SAP good for scenes which are semi stationary.
Definition: Space.h:88
Task.h
agxData::EntityStorageRef
agx::ref_ptr< EntityStorage > EntityStorageRef
Definition: EntityStorage.h:62
DOXYGEN_END_INTERNAL_BLOCK
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
agxSDK::Simulation::restore
bool restore(const agx::String &filename, agx::UInt selection=READ_DEFAULT)
Restore state from a serialized scene file.
agx::Vector::pop_back
void pop_back()
Definition: Vector.h:754
HashVector.h
Geometry.h
agx::Container::empty
bool empty() const
Definition: Container.h:136
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
agxCollide::Space::getOrientedBoundsThreshold
agx::Real getOrientedBoundsThreshold() const
Returns the current threshold for where oriented bounds are created for Geometries.
Definition: Space.h:998
agxCollide::Space::BroadPhaseAlgorithm
BroadPhaseAlgorithm
Enum for specifying which BroadPhase algorithm space should use.
Definition: Space.h:86
agxCollide::Space::disableForContacts
void disableForContacts(F relevantCollision)
If for some reason a geometry or several geometries collides with less geometries now than previously...
Definition: Space.h:452
ParticleGeometryContactEntity.h
agx::Vector::reserve
void reserve(size_t size)
Reserve capacity in the vector.
Definition: Vector.h:583
agx::RigidBody::getEnable
bool getEnable() const
Access the state enable flag.
Definition: RigidBody.h:1129
agxCollide::SpaceListener
Class for listening for add/remove geometry events for an associated Space.
Definition: SpaceListener.h:29
agxCollide::Space::removeContact
GeometryContactPtrVector::const_iterator removeContact(GeometryContactPtrVector::const_iterator contact)
Remove a specified GeometryContact from the list of contacts.
agxData::EntityStorage
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:72
agxCollide::CollisionGroupManager
Definition: CollisionGroupManager.h:30
agx::Object::Event
Definition: Object.h:63
agx::Physics::GeometryPairPtr::geometry1
AGXPHYSICS_EXPORT agx::Physics::GeometryPtr & geometry1()
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
agxCollide::Space::getEnableContactReduction
bool getEnableContactReduction() const
Definition: Space.h:988
agxCollide::Space::getContactReductionBinResolution
agx::UInt getContactReductionBinResolution() const
Definition: Space.h:993
agx::VectorPOD< GeometryContact * >
agx::observer_ptr< Geometry >
SpaceListener.h
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agxData
Contains classes for low level data storage for AGX.
Definition: Container.h:23
agxSDK::Simulation::getGeometries
const agxCollide::GeometryRefVector & getGeometries() const
agx::Physics::GeometryContactPtr::enabled
AGXPHYSICS_EXPORT agx::Bool & enabled()
agxData::BufferProxyAllocator::update
void update() const
agx::ref_ptr< HierarchicalGrid >
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::SetVector< GeometryPair >
Timer.h
SweepAndPrune.h
HierarchicalGrid.h
agxCollide::BroadPhasePairVector
agx::Vector< agx::Physics::BroadPhasePairPtr, agxData::BufferProxyAllocator > BroadPhasePairVector
Definition: Space.h:65
agx::Index
UInt32 Index
Definition: Integer.h:44
agxCollide::Space::reportOverlap
void reportOverlap(agxCollide::Geometry *geometry1, agxCollide::Geometry *geometry2)
Add an explicit bounding volume overlap between the two specified geometries.
Definition: Space.h:968
agx::TaskGroupRef
agx::ref_ptr< TaskGroup > TaskGroupRef
Definition: Task.h:46
agxUtil::setEnableCollisions
AGXPHYSICS_EXPORT bool setEnableCollisions(agx::RigidBody *rb1, agx::RigidBody *rb2, bool enable)
Enable or disable the collision between all geometries in RigidBody rb1 and RigidBody rb2.
agxSDK::Simulation::clearContactData
void clearContactData()
Clears contact data in the simulation.
agxCollide::ParticleGeometryContactVector
agx::Vector< agx::Physics::ParticleGeometryContactPtr > ParticleGeometryContactVector
Definition: Space.h:71
agx::LinearProbingHashTable
Inheritance with partial specialization due to bug with ref_ptr containers.
Definition: LinearProbingHashTable.h:926
agxCollide::Geometry
The geometry representation used by the collision detection engine.
Definition: Geometry.h:91
Component.h
agx::TaskRef
agx::ref_ptr< Task > TaskRef
Definition: Task.h:42
agxCollide::Space::enableForContacts
void enableForContacts(F relevantCollision)
If for some reason a geometry or several geometries collides with more geometries now than previously...
Definition: Space.h:422
agxCollide::LocalSeparationPairVector
agx::Vector< agx::Physics::GeometryPairPtr > LocalSeparationPairVector
Definition: Space.h:67
agx::Name
Representation of a name string.
Definition: Name.h:32
agxCollide::Space
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
Definition: Space.h:81
agxCollide::Space::getSeparationPairs
const SeparationPairVector & getSeparationPairs() const
Definition: Space.h:956
agx::Component
A component is an object containing other objects, enabling hierarchical structuring.
Definition: Component.h:38
GeometryPair.h
agxCollide.h
agx::Physics::BroadPhasePairPtr
Pointer to a entity instance of type Physics.BroadPhasePair.
Definition: BroadPhasePairEntity.h:172
ContactPointEntity.h
HashSet.h
agxCollide::SweepAndPrune
Definition: SweepAndPrune.h:36
ParticlePairContactEntity.h
agx::Physics::GeometryPtr::model
AGXPHYSICS_EXPORT agxCollide::Geometry *& model()
agx::HashTable
LinearProbingHashTable< KeyT, DataT, HashT, AllocatorT > HashTable
Definition: HashTable.h:24
agxCollide
This namespace consists of a set of classes for handling geometric intersection tests including boole...
Definition: ContactForceFilterParticipant.h:22
agx::Bool
bool Bool
Definition: Integer.h:40
agxCollide::Space::getBroadPhasePairs
const BroadPhasePairVector & getBroadPhasePairs() const
Definition: Space.h:950
agxCollide::GeometryContact
A contact between two geometries.
Definition: Contacts.h:270
Contacts.h
agxStream
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
Definition: ElementaryConstraint.h:31
agxCollide::AGX_DECLARE_POINTER_TYPES
AGX_DECLARE_POINTER_TYPES(SpaceListener)
CollisionGroupManager.h
agxCollide::ParticleGeometryPair
std::pair< agx::Physics::ParticlePtr, agx::Physics::GeometryPtr > ParticleGeometryPair
Definition: Space.h:68
agx::Device
An agx::Device is an abstract representation of a device on which data can be stored and processed.
Definition: Device.h:57
agx::QuadraticProbingHashTable
Inheritance with partial specialization due to bug with ref_ptr containers.
Definition: QuadraticProbingHashTable.h:698
agxSDK
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30
agx::init
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API.
agx::Vector::allocator
Allocator & allocator()
Definition: Vector.h:1001
agxCollide::Space::getEnablePair
bool getEnablePair(agx::UInt32 group1, agx::UInt32 group2) const
Get information if group1 and group2 are allowed to collide.
Definition: Space.h:945
agx::String
AgXString< std::string > String
Definition: String.h:427
agx::Vec3T< Real >
agx::Uuid
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
Definition: Uuid.h:41
DisabledCollisionsState.h
agx::Vector::back
T & back() const
Definition: Vector.h:707
agxCollide::Space::removeOverlap
void removeOverlap(agxCollide::Geometry *geometry1, agxCollide::Geometry *geometry2)
Remove a (Sweep and Prune) bounding overlap, if it exists, between geometry1 and geoemtry2.
Definition: Space.h:976
agx::UInt32
uint32_t UInt32
Definition: Integer.h:32
HashTableComponent.h
agxCollide::ParticleGeometryPairVector
agx::Vector< ParticleGeometryPair > ParticleGeometryPairVector
Definition: Space.h:69
agx::VectorPOD< GeometryContact * >::const_iterator
const typedef GeometryContact * * const_iterator
Definition: Vector.h:256
agx::HashVector< agx::Physics::GeometryPtr, GeometryRef >
agxIO
The agxIO namespace contains classes for reading, writing and finding files.
Definition: Material.h:41
agx::Physics::CollisionGroupSetPtr
Pointer to a entity instance of type Physics.CollisionGroupSet.
Definition: CollisionGroupSetEntity.h:175
agxCollide::Space::GeometryPairHash
agx::SetVector< GeometryPair > GeometryPairHash
Definition: Space.h:593
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58
agxCollide::DisabledCollisionsState
Complete disabled collisions state in a simulation including disabled given name, group id (integer) ...
Definition: DisabledCollisionsState.h:51
agxCollide::Space::getHierarchicalGrid
HierarchicalGrid * getHierarchicalGrid()
Definition: Space.h:1003
SetVector.h
agx::SetVector::contains
bool contains(const T2 &key) const
Hash search for the data in the container.
Definition: SetVector.h:225
agxCollide::Geometry::isEnabled
bool isEnabled() const
Alias for getEnable Return whether the geometry should be used in intersection tests.
Definition: Geometry.h:805
agx::Vector::push_back
void push_back(const T2 &value)
Definition: Vector.h:715