Struct rapier3d::geometry::InteractionGroups[][src]

#[repr(transparent)]pub struct InteractionGroups(pub u32);

Pairwise filtering using bit masks.

This filtering method is based on two 16-bit values:

  • The interaction groups (the 16 left-most bits of self.0).
  • The interaction mask (the 16 right-most bits of self.0).

An interaction is allowed between two filters a and b when two conditions are met simultaneously:

  • The interaction groups of a has at least one bit set to 1 in common with the interaction mask of b.
  • The interaction groups of b has at least one bit set to 1 in common with the interaction mask of a.

In other words, interactions are allowed between two filter iff. the following condition is met:

((self.0 >> 16) & rhs.0) != 0 && ((rhs.0 >> 16) & self.0) != 0

Implementations

impl InteractionGroups[src]

pub const fn new(groups: u16, masks: u16) -> Self[src]

Initializes with the given interaction groups and interaction mask.

pub const fn all() -> Self[src]

Allow interaction with everything.

pub const fn none() -> Self[src]

Prevent all interactions.

pub const fn with_groups(self, groups: u16) -> Self[src]

Sets the group this filter is part of.

pub const fn with_mask(self, mask: u16) -> Self[src]

Sets the interaction mask of this filter.

pub const fn test(self, rhs: Self) -> bool[src]

Check if interactions should be allowed based on the interaction groups and mask.

An interaction is allowed iff. the groups of self contain at least one bit set to 1 in common with the mask of rhs, and vice-versa.

Trait Implementations

impl Clone for InteractionGroups[src]

impl Copy for InteractionGroups[src]

impl Debug for InteractionGroups[src]

impl Default for InteractionGroups[src]

impl Eq for InteractionGroups[src]

impl Hash for InteractionGroups[src]

impl PartialEq<InteractionGroups> for InteractionGroups[src]

impl StructuralEq for InteractionGroups[src]

impl StructuralPartialEq for InteractionGroups[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Any + Send + Sync
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Scalar for T where
    T: Copy + PartialEq<T> + Debug + Any
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.