[][src]Trait broccoli::query::colfind::ColfindQuery

pub trait ColfindQuery<'a>: Queries<'a> {
    pub fn find_colliding_pairs_mut(
        &mut self,
        func: impl FnMut(PMut<'_, Self::T>, PMut<'_, Self::T>)
    ) { ... }
pub fn find_colliding_pairs_mut_par(
        &mut self,
        func: impl Fn(PMut<'_, Self::T>, PMut<'_, Self::T>) + Send + Sync + Clone
    )
    where
        Self::T: Send + Sync,
        Self::Num: Send + Sync
, { ... }
pub fn new_colfind_builder<'c>(
        &'c mut self
    ) -> QueryBuilder<'c, 'a, Self::T> { ... } }

Colfind functions that can be called on a tree.

Provided methods

pub fn find_colliding_pairs_mut(
    &mut self,
    func: impl FnMut(PMut<'_, Self::T>, PMut<'_, Self::T>)
)
[src]

Find all aabb intersections and return a PMut of it. Unlike the regular find_colliding_pairs_mut, this allows the user to access a read only reference of the AABB.

Examples

 use broccoli::{prelude::*,bbox,rect};
 let mut bots = [bbox(rect(0,10,0,10),0u8),bbox(rect(5,15,5,15),0u8)];
 let mut tree = broccoli::new(&mut bots);
 tree.find_colliding_pairs_mut(|a,b|{
    *a.unpack_inner()+=1;
    *b.unpack_inner()+=1;
 });

 assert_eq!(bots[0].inner,1);
 assert_eq!(bots[1].inner,1);

pub fn find_colliding_pairs_mut_par(
    &mut self,
    func: impl Fn(PMut<'_, Self::T>, PMut<'_, Self::T>) + Send + Sync + Clone
) where
    Self::T: Send + Sync,
    Self::Num: Send + Sync
[src]

The parallel version of ColfindQuery::find_colliding_pairs_mut.

Examples

 use broccoli::{prelude::*,bbox,rect};
 let mut bots = [bbox(rect(0,10,0,10),0u8),bbox(rect(5,15,5,15),0u8)];
 let mut tree = broccoli::new(&mut bots);
 tree.find_colliding_pairs_mut_par(|a,b|{
    *a.unpack_inner()+=1;
    *b.unpack_inner()+=1;
 });

 assert_eq!(bots[0].inner,1);
 assert_eq!(bots[1].inner,1);

pub fn new_colfind_builder<'c>(&'c mut self) -> QueryBuilder<'c, 'a, Self::T>[src]

For analysis, allows the user to query with custom settings

Examples

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

 let builder=tree.new_colfind_builder();
 let builder=builder.with_switch_height(4);
 builder.query_seq(|a,b|{
    *a.unpack_inner()+=1;
    *b.unpack_inner()+=1;
 });

 assert_eq!(bots[0].inner,1);
 assert_eq!(bots[1].inner,1);
Loading content...

Implementors

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

Loading content...