Struct broccoli::query::QueryBuilder[][src]

pub struct QueryBuilder<'a, 'node: 'a, T: Aabb> { /* fields omitted */ }
Expand description

Builder for a query on a DinoTree.

Implementations

Create the builder.

Choose a custom height at which to switch from parallel to sequential. If you end up building sequentially, this option is ignored.

Perform the query sequentially.

Perform the query sequentially with splitter functions getting called at every level of recursion.

An extended version of find_colliding_pairs. where the user can supply callbacks to when new worker tasks are spawned and joined by rayon. Allows the user to potentially collect some aspect of every aabb collision in parallel.

sweeper : The splitter div/add functions will be called every time a new parallel recurse is started. splitter: The splitter div/add will be called at every level of recursion.

Examples

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

 let mut handler=broccoli::helper::QueryParClosure::new(
     &tree,
     Vec::new(),
     |_|(Vec::new(),Vec::new()),        //Start a new thread
     |a,mut b,mut c|{a.append(&mut b);a.append(&mut c)}, //Combine two threads
     |v,a,b|v.push((*a.unpack_inner(),*b.unpack_inner())), //Handle a collision
 );

 let (handler,_)=tree.new_colfind_builder().query_par_ext(
     RayonJoin,
     handler,
     broccoli::build::SplitterEmpty
 );

 let intersections=handler.acc;

 assert_eq!(intersections.len(),1);

Perform the query in parallel, switching to sequential as specified by the QueryBuilder::with_switch_height()

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.