87 INVALID_BROAD_PHASE_ALGORITHM = -1,
110 bool setBroadPhaseAlgorithm(BroadPhaseAlgorithm algorithm);
115 BroadPhaseAlgorithm getBroadPhaseAlgorithm()
const;
189 void updateBroadPhase();
200 void updateNarrowPhase();
280 bool testBoundingVolumeOverlap(
299 bool testGeometryOverlap(
346 void setEnableContactReduction(
bool flag );
358 void setContactReductionBinResolution(
agx::UInt binResolution);
361 bool getEnableContactReduction()
const;
364 agx::UInt getContactReductionBinResolution()
const;
371 void setContactReductionThreshold(
agx::UInt threshold);
376 agx::UInt getContactReductionThreshold()
const;
421 template<
typename F >
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 ) {
433 if ( relevantCollision(m_geometries[ i ], m_geometries[ j ] ) &&
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 ] );
451 template<
typename F >
461 for (
agx::UInt i = 0, numBroadPhasePairs = broadPhasePairs.
size(); i < numBroadPhasePairs; ++i ) {
467 while ( !pairsToRemove.
empty() ) {
469 m_sweepAndPrune->removePair( pairsToRemove.
back().first, pairsToRemove.
back().second );
519 void setEnableGeometry(
Geometry* geometry,
bool flag);
524 agx::Real getOrientedBoundsThreshold()
const;
530 void setOrientedBoundsThreshold(
agx::Real threshold );
542 void commitRemovedContacts();
598 void resetParticleCellAssignments();
614 size_t computeNumberOfEnabledContactPoints()
const;
631 void synchronizeTransforms();
636 void synchronizeBounds();
641 void printContacts(const
agx::
String& title);
646 agxData::EntityStorage* getShapeStorage(
agxData::EntityModel* shapeModel);
648 agxData::EntityStorage *getGeometryStorage();
650 agxData::EntityStorage* getGeometryContactStorage();
651 agxData::EntityStorage* getContactPointStorage();
652 agxData::EntityStorage* getOrientedGeometryBoundStorage();
654 void setEnableParticleGridTasks(
bool flag);
655 void optimizeGridCellFitting();
658 agx::TaskGroup* getUpdateTask();
667 static
agx::Model* ClassModel();
671 typedef
agx::SymmetricPair<
unsigned> GeometryIDPair;
674 class SpaceSerializer : public
agxStream::Serializable
688 DisablePairVector m_disabledGeometryIDPairs;
692 SpaceSerializer( ) : m_space(nullptr) {}
693 const Space* m_space;
697 friend class SpaceSerializer;
714 void restore( const SpaceSerializer& ss );
716 void commitNewOverlaps();
718 friend class Geometry;
725 template <typename T1, typename T2>
726 void calculateNarrowPhase(BroadPhasePair* pair, T1& contactContainer, T2& separationContainer);
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();
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();
743 void createParticlePairContacts();
744 void createParticleGeometryContacts();
752 bool removeSweepAndPrune();
755 friend class
agxSDK::SimulationFrameWriter;
805 agx::Timer m_updateTimer;
806 agx::Task::ExecutionEvent::CallbackType m_startUpdateTimerCallback;
807 agx::Task::ExecutionEvent::CallbackType m_stopUpdateTimerAndReportCallback;
831 agxData::Buffer::
Event::CallbackType m_shapeTransformReallocationCallback;
854 agxData::Value::
Event::CallbackType m_gridCellSizeAlignmentCallback;
855 void gridCellSizeAlignmentCallback(
agxData::Value* sizeAlignment);
871 if (!(g1->isEnabled() && g2->isEnabled()))
874 if (!(g1->getEnableCollisions() && g2->getEnableCollisions()))
885 if (rb1 && (rb1 == rb2))
895 if (groupSet1 && groupSet2 && g1->getSpace() ==
this && g2->getSpace() ==
this && !m_collisionGroupManager->canSetsCollide(groupSet1, groupSet2))
905 return m_orientedGeometryBoundStorage;
910 return m_geometryContactStorage;
915 return m_contactPointStorage;
921 return m_collisionGroupManager;
924 AGX_FORCE_INLINE const CollisionGroupManager* Space::getCollisionGroupManager()
const
926 return m_collisionGroupManager;
940 return this->getEnablePair(
941 m_collisionGroupManager->getGroupId(group1),
942 m_collisionGroupManager->getGroupId(group2));
947 return m_collisionGroupManager->canGroupsCollide(group1, group2);
953 return m_broadPhasePairVector;
959 return m_separationPairVector;
970 if ( geometry1 == 0L || geometry2 == 0L || !geometry1->
isEnabled() || !geometry2->
isEnabled() )
978 if ( m_sweepAndPrune == 0L || geometry1 == 0L || geometry2 == 0L )
982 if ( it != m_externallyReportedPairs.end() )
983 m_externallyReportedPairs.erase( it );
985 m_sweepAndPrune->removePair( geometry1, geometry2 );
990 return m_contactReductionEnable->get();
995 return m_contactReductionBinResolution->get();
1000 return m_orientedBoundsThreshold->get();