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();
624 void synchronizeTransforms();
629 void synchronizeBounds();
634 void printContacts(const
agx::
String& title);
639 agxData::EntityStorage* getShapeStorage(
agxData::EntityModel* shapeModel);
641 agxData::EntityStorage *getGeometryStorage();
643 agxData::EntityStorage* getGeometryContactStorage();
644 agxData::EntityStorage* getContactPointStorage();
645 agxData::EntityStorage* getOrientedGeometryBoundStorage();
647 void setEnableParticleGridTasks(
bool flag);
648 void optimizeGridCellFitting();
651 agx::TaskGroup* getUpdateTask();
660 static
agx::Model* ClassModel();
664 typedef
agx::SymmetricPair<
unsigned> GeometryIDPair;
667 class SpaceSerializer : public
agxStream::Serializable
681 DisablePairVector m_disabledGeometryIDPairs;
685 SpaceSerializer( ) : m_space(nullptr) {}
686 const Space* m_space;
690 friend class SpaceSerializer;
707 void restore( const SpaceSerializer& ss );
709 void commitNewOverlaps();
718 template <typename T1, typename T2>
719 void calculateNarrowPhase(BroadPhasePair* pair, T1& contactContainer, T2& separationContainer);
721 void createGeometryContacts();
722 void startUpdateTimer(
agx::Task* task);
723 void stopUpdateTimerAndReport(
agx::Task* task);
724 void createShapeStorage(const
agx::Path& entityPath);
725 void updateContactState();
726 void createMissingContactMaterials();
727 void updateSweepAndPrune();
730 agx::Task* createSynchronizeTransformsTask();
731 agx::Task* createSynchronizeBoundsTask();
733 agx::Task* createUpdateNarrowPhaseTask( const
agx::
String& implementation = "");
734 agx::Task* createUpdateContactStateTask();
736 void createParticlePairContacts();
737 void createParticleGeometryContacts();
745 bool removeSweepAndPrune();
782 BroadPhasePairVector m_broadPhasePairVector;
783 SeparationPairVector m_separationPairVector;
785 GeometryPairHash m_disabledGeometryPairs;
790 agxCollide::SweepAndPrune::ExternallyReportedPairsContainer m_externallyReportedPairs;
793 GeometryRemoveTable m_geometriesToRemove;
795 agx::Timer m_updateTimer;
796 agx::Task::ExecutionEvent::CallbackType m_startUpdateTimerCallback;
797 agx::Task::ExecutionEvent::CallbackType m_stopUpdateTimerAndReportCallback;
813 ParticleGeometryContactVector m_particleGeometryContacts;
814 ParticlePairContactVector m_particlePairContacts;
817 ShapeStorageTable m_shapeStorageTable;
820 SpaceListenerRefVector m_listeners;
821 agxData::Buffer::
Event::CallbackType m_shapeTransformReallocationCallback;
836 agx::HashSet<Geometry*> m_skipTable;
844 agxData::Value::
Event::CallbackType m_gridCellSizeAlignmentCallback;
845 void gridCellSizeAlignmentCallback(
agxData::Value* sizeAlignment);
847 GridContactTable* m_gridContactTable;
861 if (!(g1->isEnabled() && g2->isEnabled()))
864 if (!(g1->getEnableCollisions() && g2->getEnableCollisions()))
875 if (rb1 && (rb1 == rb2))
879 if (m_disabledGeometryPairs.
contains( GeometryPair(const_cast<Geometry*>(g1), const_cast<Geometry*>(g2)) ))
885 if (groupSet1 && groupSet2 && g1->getSpace() ==
this && g2->getSpace() ==
this && !m_collisionGroupManager->canSetsCollide(groupSet1, groupSet2))
895 return m_orientedGeometryBoundStorage;
900 return m_geometryContactStorage;
905 return m_contactPointStorage;
911 return m_collisionGroupManager;
916 return m_collisionGroupManager;
930 return this->getEnablePair(
931 m_collisionGroupManager->getGroupId(group1),
932 m_collisionGroupManager->getGroupId(group2));
937 return m_collisionGroupManager->canGroupsCollide(group1, group2);
942 m_broadPhasePairVector.allocator().update();
943 return m_broadPhasePairVector;
948 m_separationPairVector.allocator().update();
949 return m_separationPairVector;
960 if ( geometry1 == 0L || geometry2 == 0L || !geometry1->
isEnabled() || !geometry2->
isEnabled() )
968 if ( m_sweepAndPrune == 0L || geometry1 == 0L || geometry2 == 0L )
972 if ( it != m_externallyReportedPairs.end() )
973 m_externallyReportedPairs.erase( it );
975 m_sweepAndPrune->removePair( geometry1, geometry2 );
980 return m_contactReductionEnable->get();
985 return m_contactReductionBinResolution->get();
990 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.
agx::ref_ptr< EntityStorage > EntityStorageRef
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.
agxCollide namespace consists of a set of classes for handling geometric intersection tests including...
Inheritance with partial specialization due to bug with ref_ptr containers.
#define AGXPHYSICS_EXPORT
AgXString< std::string > String
GLenum GLuint GLenum GLsizei length
#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...
Namespace agx 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
typedef void(GLAD_API_PTR *GLDEBUGPROC)(GLenum source
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