[−][src]Trait broccoli::query::colfind::ColfindQuery
Colfind functions that can be called on a tree.
Provided methods
pub fn find_colliding_pairs_mut(
&mut self,
mut func: impl FnMut(PMut<'_, Self::T>, PMut<'_, Self::T>)
)
[src]
&mut self,
mut func: impl FnMut(PMut<'_, Self::T>, PMut<'_, Self::T>)
)
Find all aabb intersections and return a PMutfind_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,
joiner: impl Joinable,
func: impl Fn(PMut<'_, Self::T>, PMut<'_, Self::T>) + Send + Sync + Clone
) where
Self::T: Send + Sync,
Self::Num: Send + Sync,
[src]
&mut self,
joiner: impl Joinable,
func: impl Fn(PMut<'_, Self::T>, PMut<'_, Self::T>) + Send + Sync + Clone
) where
Self::T: Send + Sync,
Self::Num: Send + Sync,
The parallel version of ColfindQuery::find_colliding_pairs_mut
.
Examples
use broccoli::{prelude::*,bbox,rect,RayonJoin}; 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(RayonJoin,|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_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_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);