Struct ncollide2d::pipeline::narrow_phase::InteractionGraph
source · [−]pub struct InteractionGraph<N: RealField + Copy, Handle: CollisionObjectHandle>(_);
Expand description
A graph where nodes are collision objects and edges are contact or proximity algorithms.
Implementations
sourceimpl<N: RealField + Copy, Handle: CollisionObjectHandle> InteractionGraph<N, Handle>
impl<N: RealField + Copy, Handle: CollisionObjectHandle> InteractionGraph<N, Handle>
sourcepub fn add_node(&mut self, handle: Handle) -> CollisionObjectGraphIndex
pub fn add_node(&mut self, handle: Handle) -> CollisionObjectGraphIndex
Adds a handle to this graph.
sourcepub fn remove_node(&mut self, id: CollisionObjectGraphIndex) -> Option<Handle>
pub fn remove_node(&mut self, id: CollisionObjectGraphIndex) -> 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) ;
}
sourcepub fn interaction_pairs(
&self,
effective_only: bool
) -> impl Iterator<Item = (Handle, Handle, &Interaction<N>)>
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.
sourcepub fn contact_pairs(
&self,
effective_only: bool
) -> impl Iterator<Item = (Handle, Handle, &ContactAlgorithm<N>, &ContactManifold<N>)>
pub fn contact_pairs(
&self,
effective_only: bool
) -> impl Iterator<Item = (Handle, Handle, &ContactAlgorithm<N>, &ContactManifold<N>)>
All the contact pairs on this graph.
Refer to the official user guide for details.
sourcepub fn proximity_pairs(
&self,
effective_only: bool
) -> impl Iterator<Item = (Handle, Handle, &dyn ProximityDetector<N>, Proximity)>
pub fn proximity_pairs(
&self,
effective_only: bool
) -> impl Iterator<Item = (Handle, Handle, &dyn ProximityDetector<N>, Proximity)>
All the proximity pairs on this graph.
Refer to the official user guide for details.
sourcepub fn interaction_pair(
&self,
id1: CollisionObjectGraphIndex,
id2: CollisionObjectGraphIndex,
effective_only: bool
) -> Option<(Handle, Handle, &Interaction<N>)>
pub fn interaction_pair(
&self,
id1: CollisionObjectGraphIndex,
id2: CollisionObjectGraphIndex,
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.
sourcepub fn interaction_pair_mut(
&mut self,
id1: CollisionObjectGraphIndex,
id2: CollisionObjectGraphIndex
) -> Option<(Handle, Handle, &mut Interaction<N>)>
pub fn interaction_pair_mut(
&mut self,
id1: CollisionObjectGraphIndex,
id2: CollisionObjectGraphIndex
) -> 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.
sourcepub fn contact_pair(
&self,
id1: CollisionObjectGraphIndex,
id2: CollisionObjectGraphIndex,
effective_only: bool
) -> Option<(Handle, Handle, &ContactAlgorithm<N>, &ContactManifold<N>)>
pub fn contact_pair(
&self,
id1: CollisionObjectGraphIndex,
id2: CollisionObjectGraphIndex,
effective_only: bool
) -> Option<(Handle, Handle, &ContactAlgorithm<N>, &ContactManifold<N>)>
The contact pair between the two collision objects identified by their graph index.
Refer to the official user guide for details.
sourcepub fn proximity_pair(
&self,
id1: CollisionObjectGraphIndex,
id2: CollisionObjectGraphIndex,
effective_only: bool
) -> Option<(Handle, Handle, &dyn ProximityDetector<N>, Proximity)>
pub fn proximity_pair(
&self,
id1: CollisionObjectGraphIndex,
id2: CollisionObjectGraphIndex,
effective_only: bool
) -> Option<(Handle, Handle, &dyn ProximityDetector<N>, Proximity)>
The proximity pair between the two collision objects identified by their graph index.
Refer to the official user guide for details.
sourcepub fn proximity_pair_mut(
&mut self,
id1: CollisionObjectGraphIndex,
id2: CollisionObjectGraphIndex
) -> Option<(Handle, Handle, &mut dyn ProximityDetector<N>, &mut Proximity)>
pub fn proximity_pair_mut(
&mut self,
id1: CollisionObjectGraphIndex,
id2: CollisionObjectGraphIndex
) -> Option<(Handle, Handle, &mut dyn ProximityDetector<N>, &mut Proximity)>
The proximity pair between the two collision objects identified by their graph index.
Refer to the official user guide for details.
sourcepub fn interactions_with(
&self,
id: CollisionObjectGraphIndex,
effective_only: bool
) -> impl Iterator<Item = (Handle, Handle, &Interaction<N>)>
pub fn interactions_with(
&self,
id: CollisionObjectGraphIndex,
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.
sourcepub fn index_interaction(
&self,
id: TemporaryInteractionIndex
) -> Option<(Handle, Handle, &Interaction<N>)>
pub fn index_interaction(
&self,
id: TemporaryInteractionIndex
) -> Option<(Handle, Handle, &Interaction<N>)>
Gets the interaction with the given index.
sourcepub fn interactions_with_mut(
&mut self,
id: CollisionObjectGraphIndex
) -> impl Iterator<Item = (Handle, Handle, TemporaryInteractionIndex, &mut Interaction<N>)>
pub fn interactions_with_mut(
&mut self,
id: CollisionObjectGraphIndex
) -> impl Iterator<Item = (Handle, Handle, TemporaryInteractionIndex, &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.
sourcepub fn proximities_with(
&self,
handle: CollisionObjectGraphIndex,
effective_only: bool
) -> impl Iterator<Item = (Handle, Handle, &dyn ProximityDetector<N>, Proximity)>
pub fn proximities_with(
&self,
handle: CollisionObjectGraphIndex,
effective_only: bool
) -> impl Iterator<Item = (Handle, Handle, &dyn ProximityDetector<N>, Proximity)>
All the proximity pairs involving the collision object with graph index id
.
Refer to the official user guide for details.
sourcepub fn contacts_with(
&self,
handle: CollisionObjectGraphIndex,
effective_only: bool
) -> impl Iterator<Item = (Handle, Handle, &ContactAlgorithm<N>, &ContactManifold<N>)>
pub fn contacts_with(
&self,
handle: CollisionObjectGraphIndex,
effective_only: bool
) -> impl Iterator<Item = (Handle, Handle, &ContactAlgorithm<N>, &ContactManifold<N>)>
All the contact pairs involving the collision object with graph index id
.
Refer to the official user guide for details.
sourcepub fn collision_objects_interacting_with<'a>(
&'a self,
id: CollisionObjectGraphIndex
) -> impl Iterator<Item = Handle> + 'a
pub fn collision_objects_interacting_with<'a>(
&'a self,
id: CollisionObjectGraphIndex
) -> 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.
sourcepub fn collision_objects_in_contact_with<'a>(
&'a self,
id: CollisionObjectGraphIndex
) -> impl Iterator<Item = Handle> + 'a
pub fn collision_objects_in_contact_with<'a>(
&'a self,
id: CollisionObjectGraphIndex
) -> 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.
sourcepub fn collision_objects_in_proximity_of<'a>(
&'a self,
id: CollisionObjectGraphIndex
) -> impl Iterator<Item = Handle> + 'a
pub fn collision_objects_in_proximity_of<'a>(
&'a self,
id: CollisionObjectGraphIndex
) -> 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedAs for T
impl<T> CheckedAs for T
sourcefn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst> where
T: CheckedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dst where
Src: CheckedCast<Dst>,
sourcefn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
sourceimpl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, 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
. Read more
sourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
sourcefn as_any(&self) -> &(dyn Any + 'static)
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. Read more
sourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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. Read more
sourceimpl<T> DowncastSync for T where
T: Any + Send + Sync,
impl<T> DowncastSync for T where
T: Any + Send + Sync,
sourceimpl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Src where
Dst: LosslessTryFrom<Src>,
sourcefn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
sourceimpl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Src where
Dst: LossyFrom<Src>,
sourcefn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
sourceimpl<T> OverflowingAs for T
impl<T> OverflowingAs for T
sourcefn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool) where
T: OverflowingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dst where
Src: OverflowingCast<Dst>,
sourcefn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
OverflowingCasts the value.
sourceimpl<T> SaturatingAs for T
impl<T> SaturatingAs for T
sourcefn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dst where
T: SaturatingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dst where
Src: SaturatingCast<Dst>,
sourcefn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
sourceimpl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
sourcefn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
sourcefn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
sourcefn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
sourcefn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
sourceimpl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
sourcefn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dst where
T: UnwrappedCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dst where
Src: UnwrappedCast<Dst>,
sourcefn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
UnwrappedCasts the value.
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WrappingAs for T
impl<T> WrappingAs for T
sourcefn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dst where
T: WrappingCast<Dst>,
Casts the value.
sourceimpl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dst where
Src: WrappingCast<Dst>,
sourcefn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
WrappingCasts the value.