Struct collision::algorithm::broad_phase::SweepAndPrune
[−]
[src]
pub struct SweepAndPrune<V> { /* fields omitted */ }
Sweep and prune broad phase collision detection algorithm.
Will sort the bounding boxes of the collision world along some axis, and will then sweep the sorted list, and compare the bounds along the sweep axis, adding them to an active list when they are encountered, and removing them from the active list when the end extent is passed.
Any shape pairs found by the base algorithm, will then do a bounding box intersection test, before adding to the resulting pairs list.
Type parameters:
V
: Variance type used for computing what axis to use on the next iteration. Should be eitherVariance2
orVariance3
.
Methods
impl<V> SweepAndPrune<V> where
V: Variance,
[src]
V: Variance,
pub fn new() -> Self
[src]
Create a new sweep and prune algorithm, will use the X axis as the first sweep axis
pub fn with_sweep_axis(sweep_axis: usize) -> Self
[src]
Create a new sweep and prune algorithm, starting with the given axis as the first sweep axis
pub fn get_sweep_axis(&self) -> usize
[src]
Get sweep axis
pub fn find_collider_pairs<A>(
&mut self,
shapes: &mut [A]
) -> Vec<(usize, usize)> where
A: HasBound,
A::Bound: Bound + Discrete<A::Bound>,
V: Variance<Bound = A::Bound>,
[src]
&mut self,
shapes: &mut [A]
) -> Vec<(usize, usize)> where
A: HasBound,
A::Bound: Bound + Discrete<A::Bound>,
V: Variance<Bound = A::Bound>,
Find all potentially colliding pairs of shapes
Parameters
shapes
: Shapes to do find potential collisions for
Returns
Returns tuples with indices into the shapes list, of all potentially colliding pairs. The first value in the tuple will always be first in the list.
Side effects:
The shapes list might have been resorted. The indices in the return values will be for the sorted list.
Trait Implementations
Auto Trait Implementations
impl<V> Send for SweepAndPrune<V> where
V: Send,
V: Send,
impl<V> Sync for SweepAndPrune<V> where
V: Sync,
V: Sync,