[][src]Trait broccoli::query::intersect_with::IntersectQuery

pub trait IntersectQuery<'a>: Queries<'a> + RectQuery<'a> {
    pub fn intersect_with_mut<X: Aabb<Num = Self::Num>>(
        &mut self,
        other: &mut [X],
        func: impl Fn(PMut<'_, Self::T>, PMut<'_, X>)
    ) { ... } }

Intersect functions that can be called on a tree.

Provided methods

pub fn intersect_with_mut<X: Aabb<Num = Self::Num>>(
    &mut self,
    other: &mut [X],
    func: impl Fn(PMut<'_, Self::T>, PMut<'_, X>)
)
[src]

Find collisions between elements in this tree, with the specified slice of elements.

Examples

 use broccoli::{prelude::*,bbox,rect};
 let mut bots1 = [bbox(rect(0,10,0,10),0u8)];
 let mut bots2 = [bbox(rect(5,15,5,15),0u8)];
 let mut tree = broccoli::new(&mut bots1);

 tree.intersect_with_mut(&mut bots2,|a,b|{
    *a.unpack_inner()+=1;
    *b.unpack_inner()+=2;    
 });

 assert_eq!(bots1[0].inner,1);
 assert_eq!(bots2[0].inner,2);
Loading content...

Implementors

impl<'a, T: Aabb> IntersectQuery<'a> for Tree<'a, T>[src]

Loading content...