87 INVALID_BROAD_PHASE_ALGORITHM = -1,
110 bool setBroadPhaseAlgorithm(BroadPhaseAlgorithm algorithm);
115 BroadPhaseAlgorithm getBroadPhaseAlgorithm()
const;
185 void updateBroadPhase();
196 void updateNarrowPhase();
276 bool testBoundingVolumeOverlap(
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 >
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();
594 void resetParticleCellAssignments();
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();
714 friend class Geometry;
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();
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();
739 void createParticlePairContacts();
740 void createParticleGeometryContacts();
748 bool removeSweepAndPrune();
751 friend class
agxSDK::SimulationFrameWriter;
801 agx::Timer m_updateTimer;
802 agx::Task::ExecutionEvent::CallbackType m_startUpdateTimerCallback;
803 agx::Task::ExecutionEvent::CallbackType m_stopUpdateTimerAndReportCallback;
827 agxData::Buffer::
Event::CallbackType m_shapeTransformReallocationCallback;
850 agxData::Value::
Event::CallbackType m_gridCellSizeAlignmentCallback;
851 void gridCellSizeAlignmentCallback(
agxData::Value* sizeAlignment);
867 if (!(g1->isEnabled() && g2->isEnabled()))
870 if (!(g1->getEnableCollisions() && g2->getEnableCollisions()))
881 if (rb1 && (rb1 == rb2))
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;
920 AGX_FORCE_INLINE const CollisionGroupManager* Space::getCollisionGroupManager()
const
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);
949 return m_broadPhasePairVector;
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();