|
AGX Dynamics 2.41.1.2
|
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to calculate overlapping Geometry pairs. More...
#include <Space.h>
Inheritance diagram for agxCollide::Space:Public Types | |
| enum | BroadPhaseAlgorithm { INVALID_BROAD_PHASE_ALGORITHM = -1 , SWEEP_AND_PRUNE , HIERARCHICAL_GRID } |
| Enum for specifying which BroadPhase algorithm space should use. More... | |
| typedef agx::SetVector< GeometryPair > | GeometryPairHash |
Public Types inherited from agx::Component | |
| typedef Event2< Component *, Object * > | ObjectEvent |
| Event when adding removing child objects. | |
| typedef Callback1< Object * > | TraverseCallback |
Public Types inherited from agx::Object | |
| typedef agx::observer_ptr< const Event > | EventConstObserver |
| typedef agx::ref_ptr< const Event > | EventConstRef |
| typedef agx::observer_ptr< Event > | EventObserver |
| typedef agx::Vector< EventObserver > | EventObserverVector |
| typedef agx::VectorPOD< Event * > | EventPtrVector |
| typedef agx::ref_ptr< Event > | EventRef |
| typedef agx::Vector< EventRef > | EventRefVector |
Public Member Functions | |
| Space () | |
| Default constructor. | |
| Space (agx::Device *device) | |
| Instantiate Space with a specific device. | |
| bool | add (Geometry *geometry) |
| Insert a new geometry into the Space so it can collide with other geometries. | |
| void | addGeometryContacts (const LocalGeometryContactVector &localContacts) |
| Explicitly add geometry contacts. | |
| void | addListener (agxCollide::SpaceListener *listener) |
| Add a listener to space. | |
| bool | canCollide (const Geometry *g1, const Geometry *g2) const |
| Check if two geometries can collide. | |
| void | cleanup () |
| Cleanup the internal state of the object. | |
| void | commitRemovedContacts () |
| Go through all the contact and contact points scheduled for removal and remove them from the list of contacts. | |
| size_t | computeNumberOfEnabledContactPoints () const |
| template<typename F > | |
| void | disableForContacts (F relevantCollision) |
| If for some reason a geometry or several geometries collides with less geometries now than previously, we need to make sure that previous overlaps are removed, as they might remain otherwise. | |
| template<typename F > | |
| void | enableForContacts (F relevantCollision) |
| If for some reason a geometry or several geometries collides with more geometries now than previously, we need to make sure that current overlaps are reported, as they might be ignored otherwise. | |
| void | eraseDisabledGroupPair (agx::UInt32 group1, agx::UInt32 group2) |
| Consider using setEnablePair( group1, group2, true ) instead. | |
| agxCollide::DisabledCollisionsState | findDisabledCollisionsState () const |
| Find the complete state of disabled collisions, including name <-> name pairs, id <-> id pairs and geometry <-> geometry pairs. | |
| BroadPhaseAlgorithm | getBroadPhaseAlgorithm () const |
| const BroadPhasePairVector & | getBroadPhasePairs () const |
| GeometryContact | getContact (Geometry *g1, Geometry *g2) const |
| Returns geometry contact between two geometries, if existing. | |
| agx::UInt | getContactReductionBinResolution () const |
| agx::UInt | getContactReductionThreshold () const |
| const GeometryPairHash & | getDisabledPairs () const |
| bool | getEnableContactReduction () const |
| bool | getEnablePair (agx::UInt32 group1, agx::UInt32 group2) const |
Get information if group1 and group2 are allowed to collide. | |
| bool | getEnablePair (const agx::Name &group1, const agx::Name &group2) const |
Get information if group1 and group2 are allowed to collide. | |
| const GeometryRefVector & | getGeometries () const |
| Geometry * | getGeometry (const agx::Name &name) |
| Find (linear search) the first Geometry in space with a matching name. | |
| const Geometry * | getGeometry (const agx::Name &name) const |
| Find (linear search) the first Geometry in space with a matching name. | |
| Geometry * | getGeometry (const agx::Uuid &uuid) |
| Find (linear search) the first Geometry in space matching the specified uuid. | |
| const Geometry * | getGeometry (const agx::Uuid &uuid) const |
| Find (linear search) the first Geometry in space matching the specified uuid. | |
| const GeometryContactPtrVector & | getGeometryContacts () const |
| Access to the vector containing all narrow phase contacts. | |
| size_t | getGeometryContacts (GeometryContactPtrVector &matches, const agx::RigidBody *body1, const agx::RigidBody *body2=nullptr) const |
| Extract a vector with all matching geometry contacts involving the two specified rigid bodies This method will perform a linear search through all contact points. | |
| size_t | getGeometryContacts (GeometryContactPtrVector &matches, const agxCollide::Geometry *geometry1, const agxCollide::Geometry *geometry2=nullptr) const |
| Extract a vector with all matching geometry contacts involving the two specified geometries. | |
| Geometry * | getGeometryWithEntityId (agx::Index id) |
| Return Geometry in space matching the specified id. | |
| const Geometry * | getGeometryWithEntityId (agx::Index id) const |
| Return Geometry in space matching the specified id. | |
| HierarchicalGrid * | getHierarchicalGrid () |
| agx::Real | getOrientedBoundsThreshold () const |
| Returns the current threshold for where oriented bounds are created for Geometries. | |
| const ParticleGeometryContactVector & | getParticleGeometryContacts () |
| const ParticlePairContactVector & | getParticleParticleContacts () |
| const SeparationPairVector & | getSeparationPairs () const |
| size_t | getSeparationPairs (agx::Physics::GeometryPairPtrVector &matches, const agx::RigidBody *body1, const agx::RigidBody *body2=nullptr) const |
| Extract a new vector including rigid bodies which just recently separated. | |
| size_t | getSeparationPairs (agx::Physics::GeometryPairPtrVector &matches, const agxCollide::Geometry *geometry1, const agxCollide::Geometry *geometry2=nullptr) const |
| Extract a new vector including geometries which just recently separated. | |
| agxCollide::SweepAndPrune * | getSweepAndPrune () |
| agx::UInt32 | getUniqueGroupID () |
| void | insertDisabledGroupPair (agx::UInt32 group1, agx::UInt32 group2) |
| Consider using setEnablePair( group1, group2, false ) instead. | |
| bool | intersect (const agx::Vec3 &point, const agx::Vec3 &direction, LocalGeometryContactVector &geometryContacts, LocalParticleGeometryContactVector &particleGeometryContacts, const agx::Real length=FLT_MAX/4) |
| Sends a ray into the collision space and returns information about the objects the ray hits. | |
| bool | remove (Geometry *geometry) |
| Remove a geometry from Space. | |
| void | removeContact (agx::Physics::GeometryContactPtr contact) |
| Schedule a removal of a specified Narrow phase contact, the contact will not be removed until the method commitRemovedContacts() is called (during the next update()) | |
| GeometryContactPtrVector::const_iterator | removeContact (GeometryContactPtrVector::const_iterator contact) |
| Remove a specified GeometryContact from the list of contacts. | |
| bool | removeListener (agxCollide::SpaceListener *listener) |
| Remove a listener from Space. | |
| void | removeOverlap (agxCollide::Geometry *geometry1, agxCollide::Geometry *geometry2) |
Remove a (Sweep and Prune) bounding overlap, if it exists, between geometry1 and geoemtry2. | |
| void | reportOverlap (agxCollide::Geometry *geometry1, agxCollide::Geometry *geometry2) |
| Add an explicit bounding volume overlap between the two specified geometries. | |
| void | resetGeometryCellAssignments (agxCollide::Geometry *geometry) |
| void | resetParticleCellAssignments () |
| bool | setBroadPhaseAlgorithm (BroadPhaseAlgorithm algorithm) |
| Specify a new broad phase algorithm implementation. | |
| void | setContactReductionBinResolution (agx::UInt binResolution) |
| Specify the default (for this Simulation) resolution used when evaluating contacts for reduction between geometry-geometry contacts. | |
| void | setContactReductionThreshold (agx::UInt threshold) |
| Specify the lower threshold for the number of contact points needed per geometry contact in order to do contact reduction per geometry contact. | |
| void | setEnableCollisions (const Geometry *g1, const Geometry *g2, bool flag) |
| Explicitly disable/enable a geometry pair. | |
| void | setEnableContactReduction (bool flag) |
| Enable/Disable contact reduction between pairs of geometries. | |
| void | setEnableGeometry (Geometry *geometry, bool flag) |
| void | setEnablePair (agx::UInt32 group1, agx::UInt32 group2, bool flag) |
| Enable/disable collisions between two geometry group ID:s. | |
| void | setEnablePair (const agx::Name &group1, const agx::Name &group2, bool flag) |
| void | setOrientedBoundsThreshold (agx::Real threshold) |
| Sets the threshold where oriented bounds are created for Geometries. | |
| bool | testBoundingVolumeOverlap (GeometryPtrVector &testGeometries, GeometryPairVector &geometryPairs, ParticleGeometryPairVector &particleGeometryPairs, bool skip=true) |
| Tests a number of geometries for bounding volume overlaps without changing the geometries already in space besides from updating bounding volumes. | |
| bool | testGeometryOverlap (GeometryPtrVector &testGeometries, LocalGeometryContactVector &geometryContacts, LocalParticleGeometryContactVector &particleGeometryContacts, bool skip=true) |
| Test if a number of geometries collides with something already present in space without changing space, besides from updating some bounding volumes. | |
| void | update () |
| Update the contact state of the entire space including Broad Phase and narrow phase. | |
| void | updateBroadPhase () |
| Update the broad-phase state of the space. | |
| void | updateNarrowPhase () |
| Update the narrow phase state, calculating contact data for all overlapping geometry pairs. | |
Public Member Functions inherited from agx::Component | |
| Component (const agx::Name &name=agx::Name(), agx::Model *model=agx::Component::ClassModel(), agx::Device *device=nullptr) | |
| virtual void | addObject (agx::Object *object, bool assignContext=true) |
| Add an object to the component. | |
| virtual String | autoComplete (const String &partialName, StringVector &matchingNames) const |
| virtual void | buildNavigationTree (agxJson::Value &eNode) const override |
| void | configure (Model *model) |
| virtual void | configure (TiXmlElement *eComponent) override |
| agx::Device * | getDevice () |
| template<typename T > | |
| T * | getDevice () |
| const agx::Device * | getDevice () const |
| template<typename T > | |
| const T * | getDevice () const |
| size_t | getNumObjects (const agx::Name &name) const |
| agx::Object * | getObject (const agx::Name &name, agx::Model *model, size_t index=0) |
| const agx::Object * | getObject (const agx::Name &name, agx::Model *model, size_t index=0) const |
| agx::Object * | getObject (const agx::Name &name, size_t index=0) |
| template<typename T > | |
| T * | getObject (const agx::Name &name, size_t index=0) |
| const agx::Object * | getObject (const agx::Name &name, size_t index=0) const |
| template<typename T > | |
| const T * | getObject (const agx::Name &name, size_t index=0) const |
| const agx::ObjectRefVector & | getObjects () const |
| template<typename T > | |
| void | getObjects (agx::ObjectPtrVector &result, bool recursive=false) const |
| void | getObjects (agx::ObjectPtrVector &result, const agx::Model *model, bool recursive=false) const |
| virtual Object * | getResourceImpl (const Path &path, agx::Model *model) override |
| virtual void | printSubtree () const override |
| void | printSubtree (std::ostream &stream, int depth=0) const |
| virtual void | rebind () override |
| void | removeAllObjects () |
| Remove all components. | |
| virtual void | removeObject (agx::Object *object) |
| Remove an object from the component. | |
| void | removeObject (const agx::Name &name, size_t index=0) |
| Remove an object with a specified name (and optional index) from the component. | |
| virtual void | snapshot (TiXmlNode *eParent, const String &directory) const override |
| void | traverse (ComponentVisitor *) |
| void | traverse (const TraverseCallback &callback) |
Public Member Functions inherited from agx::Object | |
| Object (const Name &name=Name(), Model *model=Object::ClassModel()) | |
| void | addListener (EventListener *listener) |
| virtual void | buildNavigationTree (agxJson::Value &eNode) const |
| virtual void | configure (TiXmlElement *) |
| agx::String | fullName () const |
| agx::String | fullPath () const |
| agx::String | fullPath (const agx::Object *root) const |
| template<typename T > | |
| T * | getAutoScopedResource (const agx::Path &path) |
| template<typename T > | |
| const T * | getAutoScopedResource (const agx::Path &path) const |
| agx::Object * | getAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr) |
| const agx::Object * | getAutoScopedResource (const agx::Path &path, agx::Model *model=nullptr) const |
| agx::Object * | getContext () |
| template<typename T > | |
| T * | getContext () |
| const agx::Object * | getContext () const |
| template<typename T > | |
| const T * | getContext () const |
| agx::UInt32 | getId () const |
| const agx::Name & | getImplementationName () const |
| agx::Model * | getModel () |
| const agx::Model * | getModel () const |
| const agx::Name & | getName () const |
| agx::Object * | getNextSibling () |
| const agx::Object * | getNextSibling () const |
| agx::Path | getPath () const |
| agx::Path | getPath (const agx::Object *root) const |
| template<typename T > | |
| T * | getResource (const agx::Path &path) |
| template<typename T > | |
| const T * | getResource (const agx::Path &path) const |
| agx::Object * | getResource (const agx::Path &path, agx::Model *model=nullptr) |
| const agx::Object * | getResource (const agx::Path &path, agx::Model *model=nullptr) const |
| virtual agx::Object * | getResourceImpl (const agx::Path &path, agx::Model *model) |
| agx::Object * | getRootContext () |
| const agx::Object * | getRootContext () const |
| bool | hasListener (EventListener *listener) |
| bool | hasParent (const agx::Object *node) const |
| bool | isUnique () const |
| virtual void | printSubtree () const |
| virtual void | rebind () |
| void | removeListener (EventListener *listener) |
| virtual void | save (TiXmlElement *) const |
| virtual void | setContext (agx::Object *context) |
| void | setId (UInt32 id) |
| void | setModel (agx::Model *model) |
| Set the object model (handled automatically). | |
| void | setName (const agx::Name &name) |
| Set the name of the object. | |
| virtual void | snapshot (TiXmlNode *, const String &) const |
Public Member Functions inherited from agx::Referenced | |
| Referenced () | |
| Default constructor. | |
| Referenced (const Referenced &) | |
| template<typename T > | |
| T * | as () |
| Subclass casting. | |
| template<typename T > | |
| const T * | as () const |
| template<typename T > | |
| T * | asSafe () |
| Safe subclass casting, return nullptr if template type does not match. | |
| template<typename T > | |
| const T * | asSafe () const |
| int | getReferenceCount () const |
| template<typename T > | |
| bool | is () const |
| Subclass test. | |
| Referenced & | operator= (const Referenced &) |
| Assignment operator. Will increment the number of references to the referenced object. | |
| void | reference (void *ptr=nullptr) const |
| Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. | |
| void | unreference (void *ptr=nullptr) const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
| void | unreference_nodelete () const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. | |
Public Member Functions inherited from agxStream::Serializable | |
| virtual | ~Serializable () |
| Destructor for normal C++ use but hidden from SWIG bindings. | |
| virtual const char * | getClassName () const |
| bool | getEnableSerialization () const |
| bool | getEnableUuidGeneration () |
| agx::UInt32 | getIndex () const |
| This index is given at creation of this object. | |
| virtual StorageAgent * | getStorageAgent () const =0 |
| agx::Uuid | getUuid () const |
| bool | isFinished () const |
| void | setEnableSerialization (bool flag) |
| Set to false to disable serialization of this object. | |
| void | setFinished () |
| Tells this class that it is restored correctly and should not be deleted during destruction of an Archive. | |
| void | setUuid (const agx::Uuid &uuid) |
| Explicitly set a Uuid on a serializable object. | |
Protected Member Functions | |
| virtual | ~Space () |
| Destructor. | |
Protected Member Functions inherited from agx::Component | |
| virtual | ~Component () |
| String | expandAutoCompletionMatch (const String &query, const StringVector &matchingNames) const |
| void | setDevice (Device *device) |
Protected Member Functions inherited from agx::Object | |
| virtual | ~Object () |
Protected Member Functions inherited from agx::Referenced | |
| virtual | ~Referenced () |
| Destructor. | |
| void | allocateObserverVector () const |
| void | deleteUsingDeleteHandler () const |
Protected Member Functions inherited from agxStream::Serializable | |
| Serializable () | |
| Default constructor. | |
| Serializable (const Serializable &other) | |
| Copy constructor. | |
| void | generateUuid () |
Additional Inherited Members | |
Static Public Member Functions inherited from agx::Component | |
| static Component * | _load (TiXmlElement *eComponent, Device *device) |
| static agx::Model * | ClassModel () |
| static Component * | load (const Path &path, const Name &implementation, Device *device, const Path &_namespace=Path()) |
| static Component * | load (const String &path, const Path &_namespace=Path()) |
| static Component * | load (const String &path, Device *device, const Path &_namespace=Path()) |
| static Component * | load (TiXmlElement *eComponent, Device *device) |
Static Public Member Functions inherited from agx::Object | |
| static agx::Model * | ClassModel () |
| static agx::String | generateName (const agx::String &bindPath) |
| static const HashSet< Object * > & | getActiveObjects () |
| static bool | getEnableRebind () |
| Should rebinding be allowed? Right now a global setting. | |
| static Object * | load (const String &path, Device *device, const String &type, const String &attribute, const String &value) |
| template<typename T > | |
| static T * | load (const String &path, Device *device, const String &type, const String &attribute, const String &value) |
| static Object * | load (const String &path, Device *device, const String &type="", size_t instance=0) |
| template<typename T > | |
| static T * | load (const String &path, Device *device, const String &type="", size_t instance=0) |
| static void | load (const String &path, Device *device, ObjectPtrVector &loadedObjects) |
| static Object * | load (TiXmlElement *eObject, Device *device) |
| template<typename T > | |
| static T * | load (TiXmlElement *eObject, Device *device) |
| static TiXmlDocument | openDocument (const String &path) |
| static void | setEnableRebind (bool flag) |
| Sets if rebinding of objects should be allowed (Right now a global setting). | |
Static Public Member Functions inherited from agx::Referenced | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Static Public Member Functions inherited from agxStream::Serializable | |
| static void | setEnableUuidGeneration (bool flag) |
| Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled. | |
Public Attributes inherited from agx::Component | |
| ObjectEvent | addObjectEvent |
| ObjectEvent | removeObjectEvent |
Static Protected Member Functions inherited from agx::Referenced | |
| static DeleteHandler * | getDeleteHandler () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. | |
Protected Attributes inherited from agx::Referenced | |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| AtomicValue | m_refCount |
This class contains all Geometries and performs Broad Phase and Narrow Phase collision detection to calculate overlapping Geometry pairs.
It also contains methods for explicit overlapping tests with rays etc.
| typedef agx::SetVector<GeometryPair> agxCollide::Space::GeometryPairHash |
Enum for specifying which BroadPhase algorithm space should use.
| agxCollide::Space::Space | ( | ) |
Default constructor.
| agxCollide::Space::Space | ( | agx::Device * | device | ) |
Instantiate Space with a specific device.
|
protectedvirtual |
Destructor.
| bool agxCollide::Space::add | ( | Geometry * | geometry | ) |
Insert a new geometry into the Space so it can collide with other geometries.
| void agxCollide::Space::addGeometryContacts | ( | const LocalGeometryContactVector & | localContacts | ) |
Explicitly add geometry contacts.
This must be done after Space::update(), and not from within a ContactEventListener; preferable via agxSDK::StepEventListener::pre(t). Contact materials are not automatically calculated; they must be explicitly set for each contact. Contacts without a contact material will be ignored. Impact state for each LocalGeometryContact has to be set manually by using the 'solveImpact'-member (default: on).
| void agxCollide::Space::addListener | ( | agxCollide::SpaceListener * | listener | ) |
Add a listener to space.
The listener will be signaled at add/remove geometry events.
Check if two geometries can collide.
Following has to be true to make this method return true.
Both geometries have to be enabled if they belong to a group pair that is not disabled g1 != g2. collisions for g1 are not disabled against g2 (g1->setEnableCollisions(g2, false) if they both have a body, that it is not the same body.
Definition at line 870 of file Space.h.
References agx::SetVector< DataT, HashT >::contains(), and agx::RigidBody::getEnable().
| void agxCollide::Space::cleanup | ( | ) |
Cleanup the internal state of the object.
All Geometries will be removed one by one. The state after calling this method should be the same as creating a new object.
| void agxCollide::Space::commitRemovedContacts | ( | ) |
Go through all the contact and contact points scheduled for removal and remove them from the list of contacts.
| size_t agxCollide::Space::computeNumberOfEnabledContactPoints | ( | ) | const |
|
inline |
If for some reason a geometry or several geometries collides with less geometries now than previously, we need to make sure that previous overlaps are removed, as they might remain otherwise.
| relevantCollision | A class that has the function const bool operator()(const agxCollide::Geometry*, const agxCollide::Geometry*) that returns whether or not the collision between the two geometries should be reevaluated |
Definition at line 456 of file Space.h.
References agx::Vector< T, Allocator >::back(), agx::Container::empty(), agx::Physics::GeometryPairPtr::geometry1(), agx::Physics::GeometryPairPtr::geometry2(), agx::Physics::GeometryPtr::model(), agx::Vector< T, Allocator >::pop_back(), agx::Vector< T, Allocator >::push_back(), agx::Vector< T, Allocator >::reserve(), and agx::Container::size().
|
inline |
If for some reason a geometry or several geometries collides with more geometries now than previously, we need to make sure that current overlaps are reported, as they might be ignored otherwise.
| relevantCollision | A class that has the function const bool operator()(const agxCollide::Geometry*, const agxCollide::Geometry*) that returns whether or not the collision between the two geometries should be reevaluated |
| void agxCollide::Space::eraseDisabledGroupPair | ( | agx::UInt32 | group1, |
| agx::UInt32 | group2 | ||
| ) |
Consider using setEnablePair( group1, group2, true ) instead.
Similar to setEnablePair( group1, group2, true ) but this method doesn't look for (and adds) broad phase pairs matching the groups. I.e., this method isn't safe to use if you are unsure there are geometries overlapping matching the groups.
| group1 | - first group id |
| group2 | - second group id |
| agxCollide::DisabledCollisionsState agxCollide::Space::findDisabledCollisionsState | ( | ) | const |
Find the complete state of disabled collisions, including name <-> name pairs, id <-> id pairs and geometry <-> geometry pairs.
| BroadPhaseAlgorithm agxCollide::Space::getBroadPhaseAlgorithm | ( | ) | const |
| const BroadPhasePairVector & agxCollide::Space::getBroadPhasePairs | ( | ) | const |
Definition at line 959 of file Space.h.
References agx::Vector< T, Allocator >::allocator(), and agxData::BufferProxyAllocator::update().
| GeometryContact agxCollide::Space::getContact | ( | Geometry * | g1, |
| Geometry * | g2 | ||
| ) | const |
Returns geometry contact between two geometries, if existing.
| g1 | The first geometry. |
| g2 | The second geometry. |
| agx::UInt agxCollide::Space::getContactReductionBinResolution | ( | ) | const |
| agx::UInt agxCollide::Space::getContactReductionThreshold | ( | ) | const |
| const GeometryPairHash & agxCollide::Space::getDisabledPairs | ( | ) | const |
| bool agxCollide::Space::getEnableContactReduction | ( | ) | const |
| bool agxCollide::Space::getEnablePair | ( | agx::UInt32 | group1, |
| agx::UInt32 | group2 | ||
| ) | const |
| const GeometryRefVector & agxCollide::Space::getGeometries | ( | ) | const |
| const GeometryContactPtrVector & agxCollide::Space::getGeometryContacts | ( | ) | const |
Access to the vector containing all narrow phase contacts.
| size_t agxCollide::Space::getGeometryContacts | ( | GeometryContactPtrVector & | matches, |
| const agx::RigidBody * | body1, | ||
| const agx::RigidBody * | body2 = nullptr |
||
| ) | const |
Extract a vector with all matching geometry contacts involving the two specified rigid bodies This method will perform a linear search through all contact points.
| body1 | - The first specified rigid body to search for among geometry contacts |
| body2 | - The second specified rigid body to search for among geometry contacts (if null only match body1) |
| matches | - a vector with all matching geometry contact points This vector contain pointers to GeometryContact which are valid during this simulation step only, so never store a pointer to them and use them over several time steps. |
| size_t agxCollide::Space::getGeometryContacts | ( | GeometryContactPtrVector & | matches, |
| const agxCollide::Geometry * | geometry1, | ||
| const agxCollide::Geometry * | geometry2 = nullptr |
||
| ) | const |
Extract a vector with all matching geometry contacts involving the two specified geometries.
This method will perform a linear search through all contact points.
| geometry1 | - The first specified geometry to search for among geometry contacts |
| geometry2 | - The second specified geometry to search for among geometry contacts (if null only match geometry1) |
| matches | - a vector with all matching geometry contact points This vector contain pointers to GeometryContact which are valid during this simulation step only, so never store a pointer to them and use them over several time steps. |
| Geometry * agxCollide::Space::getGeometryWithEntityId | ( | agx::Index | id | ) |
Return Geometry in space matching the specified id.
Note that the id specified here is the internal id of a geometry entity and not the id of the high level geometry object as returned by Geometry::getId()
| id | - Entity id of geometry |
| const Geometry * agxCollide::Space::getGeometryWithEntityId | ( | agx::Index | id | ) | const |
Return Geometry in space matching the specified id.
Note that the id specified here is the internal id of a geometry entity and not the id of the high level geometry object as returned by Geometry::getId()
| id | - Entity id of geometry |
| HierarchicalGrid * agxCollide::Space::getHierarchicalGrid | ( | ) |
| agx::Real agxCollide::Space::getOrientedBoundsThreshold | ( | ) | const |
| const ParticleGeometryContactVector & agxCollide::Space::getParticleGeometryContacts | ( | ) |
| const ParticlePairContactVector & agxCollide::Space::getParticleParticleContacts | ( | ) |
| const SeparationPairVector & agxCollide::Space::getSeparationPairs | ( | ) | const |
Definition at line 965 of file Space.h.
References agx::Vector< T, Allocator >::allocator(), and agxData::BufferProxyAllocator::update().
| size_t agxCollide::Space::getSeparationPairs | ( | agx::Physics::GeometryPairPtrVector & | matches, |
| const agx::RigidBody * | body1, | ||
| const agx::RigidBody * | body2 = nullptr |
||
| ) | const |
Extract a new vector including rigid bodies which just recently separated.
| body1 | - Specifies the first rigid body to search for among the separation pairs |
| body2 | - Specifies the second rigid body to search for among the separation pairs, if nullptr then only match geometry1 |
| matches | - a vector of the geometries which are no longer overlapping (could still have overlapping bounding volumes) |
| size_t agxCollide::Space::getSeparationPairs | ( | agx::Physics::GeometryPairPtrVector & | matches, |
| const agxCollide::Geometry * | geometry1, | ||
| const agxCollide::Geometry * | geometry2 = nullptr |
||
| ) | const |
Extract a new vector including geometries which just recently separated.
| geometry1 | - Specifies the first geometry to search for among the separation pairs |
| geometry2 | - Specifies the second geometry to search for among the separation pairs, if nullptr then only match geometry1 |
| matches | - a vector of the geometries which are no longer overlapping (could still have overlapping bounding volumes) |
| agxCollide::SweepAndPrune * agxCollide::Space::getSweepAndPrune | ( | ) |
| agx::UInt32 agxCollide::Space::getUniqueGroupID | ( | ) |
| void agxCollide::Space::insertDisabledGroupPair | ( | agx::UInt32 | group1, |
| agx::UInt32 | group2 | ||
| ) |
Consider using setEnablePair( group1, group2, false ) instead.
Similar to setEnablePair( group1, group2, false ) but this method doesn't look for (and removes) broad phase pairs matching the groups. I.e., this method isn't safe to use if you are unsure there are geometries overlapping matching the groups.
| group1 | - first group id |
| group2 | - second group id |
| bool agxCollide::Space::intersect | ( | const agx::Vec3 & | point, |
| const agx::Vec3 & | direction, | ||
| LocalGeometryContactVector & | geometryContacts, | ||
| LocalParticleGeometryContactVector & | particleGeometryContacts, | ||
| const agx::Real | length = FLT_MAX/4 |
||
| ) |
Sends a ray into the collision space and returns information about the objects the ray hits.
The ray does not have to hit anything and the returned contact data can be empty.
| point | start point of the ray |
| direction | Direction of the ray |
| geometryContacts | A GeometryContactPtrVector where contact data will be stored for the objects the ray intersected the objects are sorted closest to furthest away |
| particleGeometryContacts | A GeometryContactPtrVector where contact data will be stored for the objects the ray intersected the objects are sorted closest to furthest away |
| length | Max length of ray, objects further away than length will not be hit even if they are in the path of the ray |
| bool agxCollide::Space::remove | ( | Geometry * | geometry | ) |
| void agxCollide::Space::removeContact | ( | agx::Physics::GeometryContactPtr | contact | ) |
Schedule a removal of a specified Narrow phase contact, the contact will not be removed until the method commitRemovedContacts() is called (during the next update())
| contact | - Remove the specified contact. |
Definition at line 971 of file Space.h.
References agx::Physics::GeometryContactPtr::enabled().
| GeometryContactPtrVector::const_iterator agxCollide::Space::removeContact | ( | GeometryContactPtrVector::const_iterator | contact | ) |
Remove a specified GeometryContact from the list of contacts.
It is important that this iterator is valid, i.e. accessed during the same time step and that the list of contacts is not modified since it is acquired.
| contact | - iterator taken from the getGeometryContacts() at the same time step. |
| bool agxCollide::Space::removeListener | ( | agxCollide::SpaceListener * | listener | ) |
Remove a listener from Space.
| void agxCollide::Space::removeOverlap | ( | agxCollide::Geometry * | geometry1, |
| agxCollide::Geometry * | geometry2 | ||
| ) |
| void agxCollide::Space::reportOverlap | ( | agxCollide::Geometry * | geometry1, |
| agxCollide::Geometry * | geometry2 | ||
| ) |
Add an explicit bounding volume overlap between the two specified geometries.
| geometry1,geometry2 | - The two geometries in the new Broad phase overlap. |
Definition at line 977 of file Space.h.
References agxCollide::Geometry::isEnabled().
| void agxCollide::Space::resetGeometryCellAssignments | ( | agxCollide::Geometry * | geometry | ) |
| void agxCollide::Space::resetParticleCellAssignments | ( | ) |
| bool agxCollide::Space::setBroadPhaseAlgorithm | ( | BroadPhaseAlgorithm | algorithm | ) |
Specify a new broad phase algorithm implementation.
| void agxCollide::Space::setContactReductionBinResolution | ( | agx::UInt | binResolution | ) |
Specify the default (for this Simulation) resolution used when evaluating contacts for reduction between geometry-geometry contacts.
A high value will keep more contacts, lower will result in more aggressive reduction the default. If no resolution is specified per material this value will be used. Commonly a value of 2-3 will give good results. Values from 1 to 10 are valid. This value will be used for all geometry contacts where either no contact material is set, or where the ContactReductionBinResolution of the contact material is 0.
| binResolution | - parameter to ContactReducer. |
| void agxCollide::Space::setContactReductionThreshold | ( | agx::UInt | threshold | ) |
Specify the lower threshold for the number of contact points needed per geometry contact in order to do contact reduction per geometry contact.
| threshold | - Lower threshold for number of contact points in a geometry contact in order run contact reduction on it. |
Explicitly disable/enable a geometry pair.
| void agxCollide::Space::setEnableContactReduction | ( | bool | flag | ) |
Enable/Disable contact reduction between pairs of geometries.
| flag | - if true, contact reduction is enabled. |
| void agxCollide::Space::setEnableGeometry | ( | Geometry * | geometry, |
| bool | flag | ||
| ) |
| void agxCollide::Space::setEnablePair | ( | agx::UInt32 | group1, |
| agx::UInt32 | group2, | ||
| bool | flag | ||
| ) |
Enable/disable collisions between two geometry group ID:s.
This can be used to group Geometries into separate collision groups, where collisions can be enabled/disabled between the different GeometryID groups.
The largest number for a group ID is defined to be 2^31 - 1 (2 147 483 647), the rest are reserved by space and can be accessed via getUniqueGroupID().
| group1 | - First group id |
| group2 | - Second group id |
| flag | - If true, the geometries in groupID1 and groupID2 can collide, otherwise not. |
| void agxCollide::Space::setEnablePair | ( | const agx::Name & | group1, |
| const agx::Name & | group2, | ||
| bool | flag | ||
| ) |
| void agxCollide::Space::setOrientedBoundsThreshold | ( | agx::Real | threshold | ) |
Sets the threshold where oriented bounds are created for Geometries.
Changing the value will create or destroy oriented bounds as necessary for already created Geometries.
| bool agxCollide::Space::testBoundingVolumeOverlap | ( | GeometryPtrVector & | testGeometries, |
| GeometryPairVector & | geometryPairs, | ||
| ParticleGeometryPairVector & | particleGeometryPairs, | ||
| bool | skip = true |
||
| ) |
Tests a number of geometries for bounding volume overlaps without changing the geometries already in space besides from updating bounding volumes.
| testGeometries | - The vector with geometries that should be tested for overlaps. These may be rearranged to speed up testing. |
| geometryPairs | - The geometry pairs which have overlapping bounding volumes |
| particleGeometryPairs | - The particle-geometry pairs which have overlapping bounding volumes |
| skip | - If true, skip collisions between geometries that both are in the testGeometries vector. Useful when some geometries are already added to space. |
| bool agxCollide::Space::testGeometryOverlap | ( | GeometryPtrVector & | testGeometries, |
| LocalGeometryContactVector & | geometryContacts, | ||
| LocalParticleGeometryContactVector & | particleGeometryContacts, | ||
| bool | skip = true |
||
| ) |
Test if a number of geometries collides with something already present in space without changing space, besides from updating some bounding volumes.
| testGeometries | The vector with geometries that should be tested for overlaps. These may be rearranged to speed up testing. |
| geometryContacts | - The geometry contacts that were found |
| particleGeometryContacts | - The particle-geometry contacts that were found |
| skip | - If true, skip collisions between geometries that both are in the testGeometries vector. Useful when some geometries are already added to space. |
| void agxCollide::Space::update | ( | ) |
Update the contact state of the entire space including Broad Phase and narrow phase.
| void agxCollide::Space::updateBroadPhase | ( | ) |
Update the broad-phase state of the space.
| void agxCollide::Space::updateNarrowPhase | ( | ) |
Update the narrow phase state, calculating contact data for all overlapping geometry pairs.
i.e. check all current bounding box overlaps for possible contacts