pub struct InteractionGraph<N, Handle>(/* private fields */)
where
    N: RealField + Copy,
    Handle: CollisionObjectHandle;
Expand description

A graph where nodes are collision objects and edges are contact or proximity algorithms.

Implementations§

source§

impl<N, Handle> InteractionGraph<N, Handle>where N: RealField + Copy, Handle: CollisionObjectHandle,

source

pub fn new() -> InteractionGraph<N, Handle>

Creates a new empty collection of collision objects.

source

pub fn add_node(&mut self, handle: Handle) -> NodeIndex<usize>

Adds a handle to this graph.

source

pub fn remove_node(&mut self, id: NodeIndex<usize>) -> Option<Handle>

Removes a handle from this graph and returns a handle that must have its graph index changed to id.

When a node is removed, another node of the graph takes it place. This means that the CollisionObjectGraphIndex of the collision object returned by this method will be equal to id. Thus if you maintain a map between CollisionObjectSlabHandle and CollisionObjectGraphIndex, then you should update this map to associate id to the handle returned by this method. For example:

// Let `id` be the graph index of the collision object we want to remove.
if let Some(other_handle) = graph.remove_node(id) {
   // The graph index of `other_handle` changed to `id` due to the removal.
   map.insert(other_handle, id) ;
}
source

pub fn interaction_pairs( &self, effective_only: bool ) -> impl Iterator<Item = (Handle, Handle, &Interaction<N>)>

All the interactions pairs on this graph.

Refer to the official user guide for details.

source

pub fn contact_pairs( &self, effective_only: bool ) -> impl Iterator<Item = (Handle, Handle, &Box<dyn ContactManifoldGenerator<N>, Global>, &ContactManifold<N>)>

All the contact pairs on this graph.

Refer to the official user guide for details.

source

pub fn proximity_pairs( &self, effective_only: bool ) -> impl Iterator<Item = (Handle, Handle, &(dyn ProximityDetector<N> + 'static), Proximity)>

All the proximity pairs on this graph.

Refer to the official user guide for details.

source

pub fn interaction_pair( &self, id1: NodeIndex<usize>, id2: NodeIndex<usize>, effective_only: bool ) -> Option<(Handle, Handle, &Interaction<N>)>

The interaction between the two collision objects identified by their graph index.

Refer to the official user guide for details.

source

pub fn interaction_pair_mut( &mut self, id1: NodeIndex<usize>, id2: NodeIndex<usize> ) -> Option<(Handle, Handle, &mut Interaction<N>)>

The interaction between the two collision objects identified by their graph index.

Refer to the official user guide for details.

source

pub fn contact_pair( &self, id1: NodeIndex<usize>, id2: NodeIndex<usize>, effective_only: bool ) -> Option<(Handle, Handle, &Box<dyn ContactManifoldGenerator<N>, Global>, &ContactManifold<N>)>

The contact pair between the two collision objects identified by their graph index.

Refer to the official user guide for details.

source

pub fn proximity_pair( &self, id1: NodeIndex<usize>, id2: NodeIndex<usize>, effective_only: bool ) -> Option<(Handle, Handle, &(dyn ProximityDetector<N> + 'static), Proximity)>

The proximity pair between the two collision objects identified by their graph index.

Refer to the official user guide for details.

source

pub fn proximity_pair_mut( &mut self, id1: NodeIndex<usize>, id2: NodeIndex<usize> ) -> Option<(Handle, Handle, &mut (dyn ProximityDetector<N> + 'static), &mut Proximity)>

The proximity pair between the two collision objects identified by their graph index.

Refer to the official user guide for details.

source

pub fn interactions_with( &self, id: NodeIndex<usize>, effective_only: bool ) -> impl Iterator<Item = (Handle, Handle, &Interaction<N>)>

All the interaction involving the collision object with graph index id.

Refer to the official user guide for details.

source

pub fn index_interaction( &self, id: EdgeIndex<usize> ) -> Option<(Handle, Handle, &Interaction<N>)>

Gets the interaction with the given index.

source

pub fn interactions_with_mut( &mut self, id: NodeIndex<usize> ) -> impl Iterator<Item = (Handle, Handle, EdgeIndex<usize>, &mut Interaction<N>)>

All the mutable references to interactions involving the collision object with graph index id.

Refer to the official user guide for details.

source

pub fn proximities_with( &self, handle: NodeIndex<usize>, effective_only: bool ) -> impl Iterator<Item = (Handle, Handle, &(dyn ProximityDetector<N> + 'static), Proximity)>

All the proximity pairs involving the collision object with graph index id.

Refer to the official user guide for details.

source

pub fn contacts_with( &self, handle: NodeIndex<usize>, effective_only: bool ) -> impl Iterator<Item = (Handle, Handle, &Box<dyn ContactManifoldGenerator<N>, Global>, &ContactManifold<N>)>

All the contact pairs involving the collision object with graph index id.

Refer to the official user guide for details.

source

pub fn collision_objects_interacting_with<'a>( &'a self, id: NodeIndex<usize> ) -> impl Iterator<Item = Handle> + 'a

All the collision object handles of collision objects interacting with the collision object with graph index id.

Refer to the official user guide for details.

source

pub fn collision_objects_in_contact_with<'a>( &'a self, id: NodeIndex<usize> ) -> impl Iterator<Item = Handle> + 'a

All the collision object handles of collision objects in contact with the collision object with graph index id.

Refer to the official user guide for details.

source

pub fn collision_objects_in_proximity_of<'a>( &'a self, id: NodeIndex<usize> ) -> impl Iterator<Item = Handle> + 'a

All the collision object handles of collision objects in proximity of with the collision object with graph index id.

Refer to the official user guide for details.

Auto Trait Implementations§

§

impl<N, Handle> !RefUnwindSafe for InteractionGraph<N, Handle>

§

impl<N, Handle> Send for InteractionGraph<N, Handle>

§

impl<N, Handle> Sync for InteractionGraph<N, Handle>

§

impl<N, Handle> Unpin for InteractionGraph<N, Handle>where Handle: Unpin, N: Unpin,

§

impl<N, Handle> !UnwindSafe for InteractionGraph<N, Handle>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T, Global>) -> Rc<dyn Any, Global>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T, Global>) -> Arc<dyn Any + Send + Sync, Global>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<T> Finalize for T

§

unsafe fn finalize_raw(data: *mut ())

Safety Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Component for Twhere T: Send + Sync + 'static,