87 INVALID_BROAD_PHASE_ALGORITHM = -1,
185 void updateBroadPhase();
196 void updateNarrowPhase();
276 bool testBoundingVolumeOverlap(
279 ParticleGeometryPairVector& particleGeometryPairs,
295 bool testGeometryOverlap(
342 void setEnableContactReduction(
bool flag );
354 void setContactReductionBinResolution(
agx::UInt binResolution);
357 bool getEnableContactReduction()
const;
360 agx::UInt getContactReductionBinResolution()
const;
367 void setContactReductionThreshold(
agx::UInt threshold);
372 agx::UInt getContactReductionThreshold()
const;
417 template<
typename F >
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 ) {
429 if ( relevantCollision(m_geometries[ i ], m_geometries[ j ] ) &&
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 ] );
447 template<
typename F >
456 const BroadPhasePairVector& broadPhasePairs = getBroadPhasePairs();
457 for (
agx::UInt i = 0, numBroadPhasePairs = broadPhasePairs.
size(); i < numBroadPhasePairs; ++i ) {
463 while ( !pairsToRemove.
empty() ) {
465 m_sweepAndPrune->removePair( pairsToRemove.
back().first, pairsToRemove.
back().second );
515 void setEnableGeometry(
Geometry* geometry,
bool flag);
520 agx::Real getOrientedBoundsThreshold()
const;
526 void setOrientedBoundsThreshold(
agx::Real threshold );
538 void commitRemovedContacts();
543 const BroadPhasePairVector& getBroadPhasePairs()
const;
548 const SeparationPairVector& getSeparationPairs()
const;
592 const GeometryPairHash& getDisabledPairs()
const;
594 void resetParticleCellAssignments();
604 const ParticleGeometryContactVector& getParticleGeometryContacts();
607 const ParticlePairContactVector& getParticleParticleContacts();
610 size_t computeNumberOfEnabledContactPoints()
const;
627 void synchronizeTransforms();
632 void synchronizeBounds();
637 void printContacts(const
agx::
String& title);
642 agxData::EntityStorage* getShapeStorage(
agxData::EntityModel* shapeModel);
644 agxData::EntityStorage *getGeometryStorage();
646 agxData::EntityStorage* getGeometryContactStorage();
647 agxData::EntityStorage* getContactPointStorage();
648 agxData::EntityStorage* getOrientedGeometryBoundStorage();
650 void setEnableParticleGridTasks(
bool flag);
651 void optimizeGridCellFitting();
654 agx::TaskGroup* getUpdateTask();
663 static
agx::Model* ClassModel();
667 typedef
agx::SymmetricPair<
unsigned> GeometryIDPair;
670 class SpaceSerializer : public
agxStream::Serializable
684 DisablePairVector m_disabledGeometryIDPairs;
688 SpaceSerializer( ) : m_space(nullptr) {}
689 const Space* m_space;
693 friend class SpaceSerializer;
710 void restore( const SpaceSerializer& ss );
712 void commitNewOverlaps();
721 template <typename T1, typename T2>
722 void calculateNarrowPhase(BroadPhasePair* pair, T1& contactContainer, T2& separationContainer);
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();
733 agx::Task* createSynchronizeTransformsTask();
734 agx::Task* createSynchronizeBoundsTask();
736 agx::Task* createUpdateNarrowPhaseTask( const
agx::
String& implementation = "");
737 agx::Task* createUpdateContactStateTask();
739 void createParticlePairContacts();
740 void createParticleGeometryContacts();
748 bool removeSweepAndPrune();
751 friend class
agxSDK::SimulationFrameWriter;
788 BroadPhasePairVector m_broadPhasePairVector;
789 SeparationPairVector m_separationPairVector;
791 GeometryPairHash m_disabledGeometryPairs;
796 agxCollide::SweepAndPrune::ExternallyReportedPairsContainer m_externallyReportedPairs;
799 GeometryRemoveTable m_geometriesToRemove;
801 agx::Timer m_updateTimer;
802 agx::Task::ExecutionEvent::CallbackType m_startUpdateTimerCallback;
803 agx::Task::ExecutionEvent::CallbackType m_stopUpdateTimerAndReportCallback;
819 ParticleGeometryContactVector m_particleGeometryContacts;
820 ParticlePairContactVector m_particlePairContacts;
823 ShapeStorageTable m_shapeStorageTable;
826 SpaceListenerRefVector m_listeners;
827 agxData::Buffer::
Event::CallbackType m_shapeTransformReallocationCallback;
842 agx::HashSet<Geometry*> m_skipTable;
850 agxData::Value::
Event::CallbackType m_gridCellSizeAlignmentCallback;
851 void gridCellSizeAlignmentCallback(
agxData::Value* sizeAlignment);
853 GridContactTable* m_gridContactTable;
867 if (!(g1->isEnabled() && g2->isEnabled()))
870 if (!(g1->getEnableCollisions() && g2->getEnableCollisions()))
881 if (rb1 && (rb1 == rb2))
885 if (m_disabledGeometryPairs.
contains( GeometryPair(const_cast<Geometry*>(g1), const_cast<Geometry*>(g2)) ))
891 if (groupSet1 && groupSet2 && g1->getSpace() ==
this && g2->getSpace() ==
this && !m_collisionGroupManager->canSetsCollide(groupSet1, groupSet2))
901 return m_orientedGeometryBoundStorage;
906 return m_geometryContactStorage;
911 return m_contactPointStorage;
917 return m_collisionGroupManager;
922 return m_collisionGroupManager;
936 return this->getEnablePair(
937 m_collisionGroupManager->getGroupId(group1),
938 m_collisionGroupManager->getGroupId(group2));
943 return m_collisionGroupManager->canGroupsCollide(group1, group2);
948 m_broadPhasePairVector.allocator().update();
949 return m_broadPhasePairVector;
954 m_separationPairVector.allocator().update();
955 return m_separationPairVector;
966 if ( geometry1 == 0L || geometry2 == 0L || !geometry1->
isEnabled() || !geometry2->
isEnabled() )
974 if ( m_sweepAndPrune == 0L || geometry1 == 0L || geometry2 == 0L )
978 if ( it != m_externallyReportedPairs.end() )
979 m_externallyReportedPairs.erase( it );
981 m_sweepAndPrune->removePair( geometry1, geometry2 );
986 return m_contactReductionEnable->get();
991 return m_contactReductionBinResolution->get();
996 return m_orientedBoundsThreshold->get();
agx::ref_ptr< Task > TaskRef
void enableForContacts(F relevantCollision)
If for some reason a geometry or several geometries collides with more geometries now than previously...
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
A std::pair, with both elements of the same type, and symmetric so (a, b) == (b, a) ...
The agxIO namespace contains classes for reading, writing and finding files.
Class for listening for add/remove geometry events for an associated Space.
std::pair< agx::Physics::ParticlePtr, agx::Physics::GeometryPtr > ParticleGeometryPair
Data storage for a collection of entity instances of a specified EntityModel.
void garbageCollect()
Use with caution!
agx::SymmetricPair< agx::Physics::GeometryPtr > GeometryPair
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.
Pointer to a entity instance of type Physics.BroadPhasePair.
This namespace consists of a set of classes for handling geometric intersection tests including boole...
Inheritance with partial specialization due to bug with ref_ptr containers.
#define AGXPHYSICS_EXPORT
AgXString< std::string > String
#define AGX_DECLARE_POINTER_TYPES(type)
agx::ref_ptr< Buffer > BufferRef
Representation of a name string.
agx::Vector< agx::Physics::BroadPhasePairPtr, agxData::BufferProxyAllocator > BroadPhasePairVector
Pointer to a entity instance of type Physics.CollisionGroupSet.
bool getEnable() const
Access the state enable flag.
void reserve(size_t size)
Reserve capacity in the vector.
The geometry representation used by the collision detection engine.
Vector containing 'raw' data.
agx::ref_ptr< TaskGroup > TaskGroupRef
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to c...
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...
Contains classes for low level data storage for AGX.
agx::Vector< agx::Physics::GeometryPairPtr > LocalSeparationPairVector
AGXPHYSICS_EXPORT agx::Physics::GeometryPtr & geometry1()
agx::Vector< agx::Physics::GeometryPairPtr, agxData::BufferProxyAllocator > SeparationPairVector
const agxCollide::GeometryRefVector & getGeometries() const
agx::Vector< ParticleGeometryPair > ParticleGeometryPairVector
The rigid body class, combining a geometric model and a frame of reference.
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.
void clearContactData()
Clears contact data in the simulation.
A UUID, or Universally unique identifier, is intended to uniquely identify information in a distribut...
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...
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...
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Complete disabled collisions state in a simulation including disabled given name, group id (integer) ...
agx::Vector< agx::Physics::ParticlePairContactPtr > ParticlePairContactVector
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
SAP good for scenes which are semi stationary.
Inheritance with partial specialization due to bug with ref_ptr containers.
agx::SetVector< GeometryPair > GeometryPairHash
An agx::Device is an abstract representation of a device on which data can be stored and processed...
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
LinearProbingHashTable< KeyT, DataT, HashT, AllocatorT > HashTable
bool contains(const T2 &key) const
Hash search for the data in the container.
void push_back(const T2 &value)
#define DOXYGEN_END_INTERNAL_BLOCK()
#define DOXYGEN_START_INTERNAL_BLOCK()
bool isEnabled() const
Alias for getEnable Return whether the geometry should be used in intersection tests.
agx::Vector< agx::Physics::ParticleGeometryContactPtr > ParticleGeometryContactVector