AGX Dynamics  2.37.3.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 
167  const Geometry* getGeometry(agx::Index id) const;
168 
175  Geometry* getGeometry(agx::Index id);
176 
180  const GeometryRefVector& getGeometries() const;
181 
185  void updateBroadPhase();
186 
190  void update();
191 
196  void updateNarrowPhase();
197 
204  const GeometryContactPtrVector& getGeometryContacts() const;
205 
217  size_t getGeometryContacts(GeometryContactPtrVector& matches, const agxCollide::Geometry *geometry1, const agxCollide::Geometry *geometry2 = nullptr) const;
218 
230  size_t getGeometryContacts(GeometryContactPtrVector& matches, const agx::RigidBody *body1, const agx::RigidBody *body2 = nullptr) const;
231 
239 
250  void addGeometryContacts(const LocalGeometryContactVector& localContacts);
251 
255  void addListener(agxCollide::SpaceListener* listener);
256 
261  bool removeListener(agxCollide::SpaceListener* listener);
262 
276  bool testBoundingVolumeOverlap(
277  GeometryPtrVector& testGeometries,
278  GeometryPairVector& geometryPairs,
279  ParticleGeometryPairVector& particleGeometryPairs,
280  bool skip = true );
281 
295  bool testGeometryOverlap(
296  GeometryPtrVector& testGeometries,
297  LocalGeometryContactVector& geometryContacts,
298  LocalParticleGeometryContactVector& particleGeometryContacts,
299  bool skip = true
300  );
301 
314  GeometryContact getContact(Geometry* g1, Geometry* g2) const;
315 
330  bool intersect(
331  const agx::Vec3& point,
332  const agx::Vec3& direction,
333  LocalGeometryContactVector& geometryContacts,
334  LocalParticleGeometryContactVector& particleGeometryContacts,
335  const agx::Real length = FLT_MAX / 4
336  );
337 
342  void setEnableContactReduction( bool flag );
343 
354  void setContactReductionBinResolution(agx::UInt binResolution);
355 
357  bool getEnableContactReduction() const;
358 
360  agx::UInt getContactReductionBinResolution() const;
361 
367  void setContactReductionThreshold(agx::UInt threshold);
368 
372  agx::UInt getContactReductionThreshold() const;
373 
377  agx::UInt32 getUniqueGroupID();
378 
390  void setEnablePair( agx::UInt32 group1, agx::UInt32 group2, bool flag );
391  void setEnablePair( const agx::Name& group1, const agx::Name& group2, bool flag );
392 
399  bool getEnablePair( agx::UInt32 group1, agx::UInt32 group2 ) const;
400 
407  bool getEnablePair(const agx::Name& group1, const agx::Name& group2) const;
408 
417  template< typename F >
418  void enableForContacts(F relevantCollision)
419  {
420  // For all COMBINATIONS of geometries, check if the collision is possibly relevant
421  // and add them to broad phase if their bounding volumes are overlapping.
422  for ( agx::UInt i = 0, numGeometries = m_geometries.size(); !m_geometries.empty() && i < numGeometries - 1; ++i ) {
423  for ( agx::UInt j = i + 1; j < numGeometries; ++j ) {
424  if ( i == j )
425  continue;
426 
427  // Relevant collision:
428  // Report overlap.
429  if ( relevantCollision(m_geometries[ i ], m_geometries[ j ] ) &&
430  m_sweepAndPrune && // Only need to report overlaps to SAP, the grid will find them by itself on its next search.
431  canCollide( m_geometries[ i ], m_geometries[ j ] ) &&
432  m_geometries[ i ]->getBoundingVolume()->hasOverlap( *m_geometries[ j ]->getBoundingVolume() ) ) {
433  reportOverlap( m_geometries[ i ], m_geometries[ j ] );
434  }
435  }
436  }
437  }
438 
447  template< typename F >
448  void disableForContacts(F relevantCollision)
449  {
450  // Among the current broad phase pairs, check if we have
451  // a relevant match of geometries. If so, remove (will send
452  // separation event if someone is listening to that).
453  GeometryPairVector pairsToRemove;
454  pairsToRemove.reserve( 16 );
455 
456  const BroadPhasePairVector& broadPhasePairs = getBroadPhasePairs();
457  for ( agx::UInt i = 0, numBroadPhasePairs = broadPhasePairs.size(); i < numBroadPhasePairs; ++i ) {
458  const BroadPhasePairVector::value_type& bpPair = broadPhasePairs[ i ];
459  if ( bpPair.geometry1() && bpPair.geometry2() && relevantCollision(bpPair.geometry1().model(), bpPair.geometry2().model() ) )
460  pairsToRemove.push_back( GeometryPair( bpPair.geometry1().model(), bpPair.geometry2().model() ) );
461  }
462 
463  while ( !pairsToRemove.empty() ) {
464  if (m_sweepAndPrune)
465  m_sweepAndPrune->removePair( pairsToRemove.back().first, pairsToRemove.back().second );
466  pairsToRemove.pop_back();
467  }
468  }
469 
481  void insertDisabledGroupPair( agx::UInt32 group1, agx::UInt32 group2 );
482 
494  void eraseDisabledGroupPair( agx::UInt32 group1, agx::UInt32 group2 );
495 
509  bool canCollide( const Geometry* g1, const Geometry* g2 ) const;
510 
512  void setEnableCollisions(const Geometry* g1, const Geometry* g2, bool flag);
513 
514  // To be called for geometries that are enabled/disabled
515  void setEnableGeometry(Geometry* geometry, bool flag);
516 
520  agx::Real getOrientedBoundsThreshold() const;
521 
526  void setOrientedBoundsThreshold( agx::Real threshold );
527 
533  void removeContact(agx::Physics::GeometryContactPtr contact);
534 
538  void commitRemovedContacts();
539 
543  const BroadPhasePairVector& getBroadPhasePairs() const;
544 
548  const SeparationPairVector& getSeparationPairs() const;
549 
550 
558  size_t getSeparationPairs(agx::Physics::GeometryPairPtrVector &matches, const agxCollide::Geometry *geometry1, const agxCollide::Geometry *geometry2=nullptr) const;
559 
567  size_t getSeparationPairs(agx::Physics::GeometryPairPtrVector& matches, const agx::RigidBody *body1, const agx::RigidBody *body2=nullptr) const;
568 
569 
574  void reportOverlap( agxCollide::Geometry* geometry1, agxCollide::Geometry* geometry2 );
575 
582  void removeOverlap( agxCollide::Geometry* geometry1, agxCollide::Geometry* geometry2 );
583 
587  agxCollide::SweepAndPrune* getSweepAndPrune();
588 
590 
592  const GeometryPairHash& getDisabledPairs() const;
593 
594  void resetParticleCellAssignments();
595  void resetGeometryCellAssignments(agxCollide::Geometry* geometry);
596 
597 
601  HierarchicalGrid *getHierarchicalGrid();
602 
604  const ParticleGeometryContactVector& getParticleGeometryContacts();
605 
607  const ParticlePairContactVector& getParticleParticleContacts();
608 
610  size_t computeNumberOfEnabledContactPoints() const;
611 
617  agxCollide::DisabledCollisionsState findDisabledCollisionsState() const;
618 
619  public:
620 
622 
623 
624 
627  void synchronizeTransforms();
628 
632  void synchronizeBounds();
637  void printContacts(const agx::String& title);
638 
639  CollisionGroupManager* getCollisionGroupManager();
640  const CollisionGroupManager* getCollisionGroupManager() const;
641 
642  agxData::EntityStorage* getShapeStorage(agxData::EntityModel* shapeModel);
643 
644  agxData::EntityStorage *getGeometryStorage();
645 
646  agxData::EntityStorage* getGeometryContactStorage();
647  agxData::EntityStorage* getContactPointStorage();
648  agxData::EntityStorage* getOrientedGeometryBoundStorage();
649 
650  void setEnableParticleGridTasks(bool flag);
651  void optimizeGridCellFitting();
652 
654  agx::TaskGroup* getUpdateTask();
655 
656 
657  SpaceListener::GeometryEvent addGeometryEvent;
658  SpaceListener::GeometryEvent removeGeometryEvent;
659 
660  SpaceListener::ShapeEvent addShapeEvent;
661  SpaceListener::ShapeEvent removeShapeEvent;
662 
663  static agx::Model* ClassModel();
664 
666 
667  typedef agx::SymmetricPair<unsigned> GeometryIDPair;
668 
670  class SpaceSerializer : public agxStream::Serializable
671  {
672  public:
673  SpaceSerializer( const agxCollide::Space* space ) : m_space(space) {}
674  AGXSTREAM_DECLARE_SERIALIZABLE(agxCollide::Space::SpaceSerializer);
675 
676  const agxCollide::Space* getSpace() const {
677  return m_space;
678  }
679  void setSpace( agxCollide::Space* space ) {
680  m_space = space;
681  }
682 
683  typedef agx::Vector<GeometryIDPair> DisablePairVector;
684  DisablePairVector m_disabledGeometryIDPairs;
685  agx::UInt32 m_uniqueGroupID;
686 
687  protected:
688  SpaceSerializer( ) : m_space(nullptr) {}
689  const Space* m_space;
690 
691  };
692 
693  friend class SpaceSerializer;
694  friend class agxSDK::Simulation;
695 
697 
698  protected:
699 
701  virtual ~Space();
702 
704 
705  void clearContactData();
706 
708  void garbageCollect(bool clearGcList = true);
709 
710  void restore( const SpaceSerializer& ss );
711 
712  void commitNewOverlaps();
713 
714  friend class Geometry;
715 
717  void init();
718 
719 
721  template <typename T1, typename T2>
722  void calculateNarrowPhase(BroadPhasePair* pair, T1& contactContainer, T2& separationContainer);
723 
724  void createGeometryContacts();
725  void startUpdateTimer(agx::Task* task);
726  void stopUpdateTimerAndReport(agx::Task* task);
727  void createShapeStorage(const agx::Path& entityPath);
728  void updateContactState();
729  void createMissingContactMaterials();
730  void updateSweepAndPrune();
731 
732  void loadTasks(BroadPhaseAlgorithm algorithm);
733  agx::Task* createSynchronizeTransformsTask();
734  agx::Task* createSynchronizeBoundsTask();
735  agx::Task* createUpdateBroadPhaseTask(BroadPhaseAlgorithm algorithm);
736  agx::Task* createUpdateNarrowPhaseTask( const agx::String& implementation = "");
737  agx::Task* createUpdateContactStateTask();
738 
739  void createParticlePairContacts();
740  void createParticleGeometryContacts();
741 
742 
744 
745  private:
746  void validate();
747 
748  bool removeSweepAndPrune();
749  bool removeGrid();
750 
751  friend class agxSDK::SimulationFrameWriter;
752  void setCollisionGroupManager(CollisionGroupManager* m);
753 
754  BroadPhaseAlgorithm m_broadPhaseAlgorithm;
755 
756  HierarchicalGridRef m_grid;
757  agxCollide::SweepAndPruneRef m_sweepAndPrune;
758 
759  agx::TaskGroupRef m_updateTask;
760  agx::TaskRef m_synchronizeTransformsTask;
761  agx::TaskRef m_synchronizeBoundsTask;
762  agx::TaskRef m_updateBroadPhaseTask;
763  agx::TaskRef m_updateNarrowPhaseTask;
764  agx::TaskRef m_updateContactStateTask;
765  agx::TaskRef m_createMissingMaterialsTask;
766 
767  agx::TaskRef m_synchronizeTransformsTask2;
768  agx::TaskRef m_synchronizeBoundsTask2;
769  agx::TaskRef m_updateBroadPhaseTask2;
770  agx::TaskRef m_updateNarrowPhaseTask2;
771  agx::TaskRef m_updateContactStateTask2;
772  agx::TaskRef m_createMissingMaterialsTask2;
773 
774  GeometryRefVector m_geometries;
775  agx::Vector<GeometryObserver> m_potentialProblemGeometries;
776 
777  agxData::EntityStorageRef m_geometryStorage;
778  agxData::EntityStorageRef m_geometryContactStorage;
779  agxData::EntityStorageRef m_contactPointStorage;
780  agxData::EntityStorageRef m_broadPhasePairStorage;
781  agxData::EntityStorageRef m_geometryContactSeparations;
782  agxData::EntityStorageRef m_orientedGeometryBoundStorage;
783  agxData::BufferRef m_materialLessGeometryContacts;
784  agxData::BufferRef m_sortedGeometryContacts;
785  agxData::BufferRef m_sortedSeparationPairs;
786  agxData::BufferRef m_filteredBroadPhasePairs;
787 
788  BroadPhasePairVector m_broadPhasePairVector;
789  SeparationPairVector m_separationPairVector;
790 
791  GeometryPairHash m_disabledGeometryPairs;
792 
793  friend class agxIO::SceneExporter;
794  friend class agxCollide::SweepAndPrune;
795 
796  agxCollide::SweepAndPrune::ExternallyReportedPairsContainer m_externallyReportedPairs;
797 
798  typedef agx::HashVector< agx::Physics::GeometryPtr, GeometryRef > GeometryRemoveTable;
799  GeometryRemoveTable m_geometriesToRemove;
800 
801  agx::Timer m_updateTimer;
802  agx::Task::ExecutionEvent::CallbackType m_startUpdateTimerCallback;
803  agx::Task::ExecutionEvent::CallbackType m_stopUpdateTimerAndReportCallback;
804 
805  agxData::ValueRefT<agx::Bool> m_contactReductionEnable;
806  agxData::ValueRefT<agx::UInt> m_contactReductionBinResolution;
807  agxData::ValueRefT<agx::UInt> m_contactReductionThreshold;
808  agxData::ValueRefT<agx::UInt> m_narrowPhaseMinJobSize;
809 
810  agxData::ValueRefT<agx::Real> m_orientedBoundsThreshold;
811 
812  GeometryRef m_ray;
813  SphereRef m_proxyParticle;
814 
815  GeometryContactPtrVector m_geometryContacts;
816  agxData::BufferRef m_geometryContactInstanceBuffer;
817  agxData::BufferRef m_contactPointInstanceBuffer;
818 
819  ParticleGeometryContactVector m_particleGeometryContacts;
820  ParticlePairContactVector m_particlePairContacts;
821 
822  typedef agx::HashTable<agxData::EntityModel*, agxData::EntityStorage*> ShapeStorageTable;
823  ShapeStorageTable m_shapeStorageTable;
824 
825  typedef agx::Vector< SpaceListenerRef > SpaceListenerRefVector;
826  SpaceListenerRefVector m_listeners;
827  agxData::Buffer::Event::CallbackType m_shapeTransformReallocationCallback;
828 
829 
830  agxData::EntityStorageRef m_collisionObjectStorage;
831  agxData::BufferRef m_collisionObjectBuffer_sourceIndex;
832  agxData::BufferRef m_collisionObjectBuffer_subsystem;
833  agxData::BufferRef m_collisionObjectBuffer_position;
834  agxData::BufferRef m_collisionObjectBuffer_radius;
835  agxData::BufferRef m_collisionObjectBuffer_obbIndex;
836 
837  agxData::BufferRef m_gridOvelapBuffer_collisionObject1;
838  agxData::BufferRef m_gridOvelapBuffer_collisionObject2;
839 
840  agx::TaskRef m_overlapTestTask;
841 
842  agx::HashSet<Geometry*> m_skipTable;
843 
844  typedef agx::HashTableComponent<agxData::GeometryPair, agx::Physics::GeometryContactPtr> GridContactTableComponent;
845  typedef agx::QuadraticProbingHashTable<agxData::GeometryPair, agx::Physics::GeometryContactPtr, agx::HashFn<agxData::GeometryPair>, agxData::BufferProxyAllocator> GridContactTable;
846 
847 
848  CollisionGroupManagerRef m_collisionGroupManager;
849 
850  agxData::Value::Event::CallbackType m_gridCellSizeAlignmentCallback;
851  void gridCellSizeAlignmentCallback(agxData::Value* sizeAlignment);
852 
853  GridContactTable* m_gridContactTable;
854  };
855 
856  /* Implementation */
857  AGX_FORCE_INLINE bool Space::canCollide( const Geometry* g1, const Geometry* g2 ) const
858  {
859  if (!(g1 && g2) )
860  return false;
861 
862  // We cannot collide with ourself. TODO Not necessarily true in general case, e.g., if a deformable is defined as one geometry
863  if (g1 == g2)
864  return false;
865 
866  // One of the geometries are disabled for collision
867  if (!(g1->isEnabled() && g2->isEnabled()))
868  return false;
869 
870  if (!(g1->getEnableCollisions() && g2->getEnableCollisions()))
871  return false;
872 
873  const agx::RigidBody* rb1 = g1->getRigidBody();
874  const agx::RigidBody* rb2 = g2->getRigidBody();
875 
876  // If one is disabled, ignore overlap.
877  if ( (rb1 && !rb1->getEnable()) || (rb2 && !rb2->getEnable()) )
878  return false;
879 
880  // not same (non-null) body
881  if (rb1 && (rb1 == rb2))
882  return false;
883 
884  // Is this geometry pair disabled?
885  if (m_disabledGeometryPairs.contains( GeometryPair(const_cast<Geometry*>(g1), const_cast<Geometry*>(g2)) ))
886  return false;
887 
888  // Can these two groups collide?
889  const agx::Physics::CollisionGroupSetPtr& groupSet1 = g1->getGroupSet();
890  const agx::Physics::CollisionGroupSetPtr& groupSet2 = g2->getGroupSet();
891  if (groupSet1 && groupSet2 && g1->getSpace() == this && g2->getSpace() == this && !m_collisionGroupManager->canSetsCollide(groupSet1, groupSet2))
892  return false;
893 
894  return true;
895  }
896 
898 
899  AGX_FORCE_INLINE agxData::EntityStorage* Space::getOrientedGeometryBoundStorage()
900  {
901  return m_orientedGeometryBoundStorage;
902  }
903 
904  AGX_FORCE_INLINE agxData::EntityStorage* Space::getGeometryContactStorage()
905  {
906  return m_geometryContactStorage;
907  }
908 
909  AGX_FORCE_INLINE agxData::EntityStorage* Space::getContactPointStorage()
910  {
911  return m_contactPointStorage;
912  }
913 
914 
915  AGX_FORCE_INLINE CollisionGroupManager* Space::getCollisionGroupManager()
916  {
917  return m_collisionGroupManager;
918  }
919 
920  AGX_FORCE_INLINE const CollisionGroupManager* Space::getCollisionGroupManager() const
921  {
922  return m_collisionGroupManager;
923  }
924 
925  AGX_FORCE_INLINE agxData::EntityStorage *Space::getGeometryStorage() { return m_geometryStorage; }
926 
928 
930  {
931  return m_geometries;
932  }
933 
934  AGX_FORCE_INLINE bool Space::getEnablePair( const agx::Name& group1, const agx::Name& group2 ) const
935  {
936  return this->getEnablePair(
937  m_collisionGroupManager->getGroupId(group1),
938  m_collisionGroupManager->getGroupId(group2));
939  }
940 
941  AGX_FORCE_INLINE bool Space::getEnablePair( agx::UInt32 group1, agx::UInt32 group2 ) const
942  {
943  return m_collisionGroupManager->canGroupsCollide(group1, group2);
944  }
945 
946  AGX_FORCE_INLINE const BroadPhasePairVector& Space::getBroadPhasePairs() const
947  {
948  m_broadPhasePairVector.allocator().update();
949  return m_broadPhasePairVector;
950  }
951 
952  AGX_FORCE_INLINE const SeparationPairVector& Space::getSeparationPairs() const
953  {
954  m_separationPairVector.allocator().update();
955  return m_separationPairVector;
956  }
957 
958  AGX_FORCE_INLINE void Space::removeContact(agx::Physics::GeometryContactPtr contact)
959  {
960  if (contact)
961  contact.enabled() = false;
962  }
963 
964  AGX_FORCE_INLINE void Space::reportOverlap( Geometry* geometry1, Geometry* geometry2 )
965  {
966  if ( geometry1 == 0L || geometry2 == 0L || !geometry1->isEnabled() || !geometry2->isEnabled() )
967  return;
968 
969  m_externallyReportedPairs.insert( SweepAndPrune::SymmetricGeometryPtrPair( geometry1, geometry2 ), SweepAndPrune::SymmetricGeometryRefPair( geometry1, geometry2 ) );
970  }
971 
972  AGX_FORCE_INLINE void Space::removeOverlap( Geometry* geometry1, Geometry* geometry2 )
973  {
974  if ( m_sweepAndPrune == 0L || geometry1 == 0L || geometry2 == 0L )
975  return;
976 
977  auto it = m_externallyReportedPairs.find( SweepAndPrune::SymmetricGeometryPtrPair( geometry1, geometry2 ) );
978  if ( it != m_externallyReportedPairs.end() )
979  m_externallyReportedPairs.erase( it );
980  else
981  m_sweepAndPrune->removePair( geometry1, geometry2 );
982  }
983 
984  AGX_FORCE_INLINE bool Space::getEnableContactReduction() const
985  {
986  return m_contactReductionEnable->get();
987  }
988 
989  AGX_FORCE_INLINE agx::UInt Space::getContactReductionBinResolution() const
990  {
991  return m_contactReductionBinResolution->get();
992  }
993 
994  AGX_FORCE_INLINE agx::Real Space::getOrientedBoundsThreshold() const
995  {
996  return m_orientedBoundsThreshold->get();
997  }
998 
999  AGX_FORCE_INLINE HierarchicalGrid *Space::getHierarchicalGrid() { return m_grid; }
1000 
1001 }
agx::ref_ptr< Task > TaskRef
Definition: Task.h:42
void enableForContacts(F relevantCollision)
If for some reason a geometry or several geometries collides with more geometries now than previously...
Definition: Space.h:418
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API...
agx::ref_ptr< EntityStorage > EntityStorageRef
Definition: EntityStorage.h:62
void pop_back()
Definition: Vector.h:754
A std::pair, with both elements of the same type, and symmetric so (a, b) == (b, a) ...
Definition: SymmetricPair.h:31
The agxIO namespace contains classes for reading, writing and finding files.
Definition: Material.h:41
Class for listening for add/remove geometry events for an associated Space.
Definition: SpaceListener.h:29
std::pair< agx::Physics::ParticlePtr, agx::Physics::GeometryPtr > ParticleGeometryPair
Definition: Space.h:68
bool Bool
Definition: Integer.h:48
Data storage for a collection of entity instances of a specified EntityModel.
Definition: EntityStorage.h:72
void garbageCollect()
Use with caution!
agx::SymmetricPair< agx::Physics::GeometryPtr > GeometryPair
Definition: Geometry.h:66
bool restore(const agx::String &filename, agx::UInt selection=READ_DEFAULT)
Restore state from a serialized scene file.
A component is an object containing other objects, enabling hierarchical structuring.
Definition: Component.h:38
Pointer to a entity instance of type Physics.BroadPhasePair.
const T * const_iterator
Definition: Vector.h:256
This namespace consists of a set of classes for handling geometric intersection tests including boole...
A contact between two geometries.
Definition: Contacts.h:270
Inheritance with partial specialization due to bug with ref_ptr containers.
#define AGXPHYSICS_EXPORT
AgXString< std::string > String
Definition: String.h:427
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
agx::ref_ptr< Buffer > BufferRef
Definition: Buffer.h:47
Representation of a name string.
Definition: Name.h:32
#define AGX_FORCE_INLINE
Definition: Object.h:59
AGXPHYSICS_EXPORT agx::Bool & enabled()
agx::Vector< agx::Physics::BroadPhasePairPtr, agxData::BufferProxyAllocator > BroadPhasePairVector
Definition: Space.h:65
Pointer to a entity instance of type Physics.CollisionGroupSet.
bool getEnable() const
Access the state enable flag.
Definition: RigidBody.h:1403
void reserve(size_t size)
Reserve capacity in the vector.
Definition: Vector.h:583
The geometry representation used by the collision detection engine.
Definition: Geometry.h:92
uint32_t UInt
Definition: Integer.h:34
Vector containing &#39;raw&#39; data.
Definition: Vector.h:245
agx::ref_ptr< TaskGroup > TaskGroupRef
Definition: Task.h:46
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
Definition: Space.h:81
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
void disableForContacts(F relevantCollision)
If for some reason a geometry or several geometries collides with less geometries now than previously...
Definition: Space.h:448
Contains classes for low level data storage for AGX.
Definition: Container.h:23
agx::Vector< agx::Physics::GeometryPairPtr > LocalSeparationPairVector
Definition: Space.h:67
UInt32 Index
Definition: Integer.h:52
AGXPHYSICS_EXPORT agx::Physics::GeometryPtr & geometry1()
agx::Vector< agx::Physics::GeometryPairPtr, agxData::BufferProxyAllocator > SeparationPairVector
Definition: Space.h:66
const agxCollide::GeometryRefVector & getGeometries() const
agx::Vector< ParticleGeometryPair > ParticleGeometryPairVector
Definition: Space.h:69
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.
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...
BroadPhaseAlgorithm
Enum for specifying which BroadPhase algorithm space should use.
Definition: Space.h:86
void clearContactData()
Clears contact data in the simulation.
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
Definition: Uuid.h:41
AGXPHYSICS_EXPORT agxCollide::Geometry *& model()
#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
AGXPHYSICS_EXPORT agx::Physics::GeometryPtr & geometry2()
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
size_t size() const
Definition: Container.h:134
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:126
Complete disabled collisions state in a simulation including disabled given name, group id (integer) ...
double Real
Definition: Real.h:42
agx::Vector< agx::Physics::ParticlePairContactPtr > ParticlePairContactVector
Definition: Space.h:72
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
SAP good for scenes which are semi stationary.
Definition: Space.h:88
Inheritance with partial specialization due to bug with ref_ptr containers.
agx::SetVector< GeometryPair > GeometryPairHash
Definition: Space.h:589
An agx::Device is an abstract representation of a device on which data can be stored and processed...
Definition: Device.h:57
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30
LinearProbingHashTable< KeyT, DataT, HashT, AllocatorT > HashTable
Definition: HashTable.h:24
bool contains(const T2 &key) const
Hash search for the data in the container.
Definition: SetVector.h:225
void push_back(const T2 &value)
Definition: Vector.h:715
uint32_t UInt32
Definition: Integer.h:40
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: Object.h:98
bool empty() const
Definition: Container.h:136
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: Object.h:97
bool isEnabled() const
Alias for getEnable Return whether the geometry should be used in intersection tests.
Definition: Geometry.h:880
T & back() const
Definition: Vector.h:707
agx::Vector< agx::Physics::ParticleGeometryContactPtr > ParticleGeometryContactVector
Definition: Space.h:71