pub struct Tree<'a, T: Aabb> { /* private fields */ }
Expand description
A broccoli Tree.
Implementations
sourceimpl<'a, T: Aabb> Tree<'a, T>
impl<'a, T: Aabb> Tree<'a, T>
sourcepub fn assert_tree_invariants(&self) where
T::Num: Debug,
pub fn assert_tree_invariants(&self) where
T::Num: Debug,
panics if a broken broccoli tree invariant is detected. For debugging purposes only.
sourceimpl<T: Aabb> Tree<'_, T>
impl<T: Aabb> Tree<'_, T>
pub fn find_colliding_pairs_from_args<S: Splitter>(
&mut self,
args: QueryArgs<'_, S>,
func: impl FnMut(AabbPin<&mut T>, AabbPin<&mut T>)
)
pub fn par_find_colliding_pairs_from_args<S: Splitter, F>(
&mut self,
args: QueryArgs<'_, S>,
func: F
) where
F: FnMut(AabbPin<&mut T>, AabbPin<&mut T>),
F: Send + Clone,
S: Send,
T: Send,
T::Num: Send,
pub fn par_find_colliding_pairs_acc<Acc, FS, FA, F>(
&mut self,
acc: Acc,
split_func: FS,
add_func: FA,
func: F
) -> Acc where
FS: FnMut(&mut Acc) -> Acc + Clone + Send,
FA: FnMut(&mut Acc, Acc) + Clone + Send,
F: FnMut(&mut Acc, AabbPin<&mut T>, AabbPin<&mut T>) + Clone + Send,
Acc: Send,
T: Send,
T::Num: Send,
sourceimpl<'a, T: Aabb> Tree<'a, T>
impl<'a, T: Aabb> Tree<'a, T>
pub fn find_knearest(
&mut self,
point: Vec2<T::Num>,
num: usize,
ktrait: impl Knearest<T>
) -> KResult<'_, T>
pub fn find_knearest_closure(
&mut self,
point: Vec2<T::Num>,
num: usize,
broad: impl FnMut(Vec2<T::Num>, AabbPin<&mut T>) -> Option<T::Num>,
fine: impl FnMut(Vec2<T::Num>, AabbPin<&mut T>) -> T::Num,
xline: impl FnMut(Vec2<T::Num>, T::Num) -> T::Num,
yline: impl FnMut(Vec2<T::Num>, T::Num) -> T::Num
) -> KResult<'_, T>
sourceimpl<'a, T: Aabb> Tree<'a, T>
impl<'a, T: Aabb> Tree<'a, T>
pub fn cast_ray_closure(
&mut self,
ray: Ray<T::Num>,
broad: impl FnMut(&Ray<T::Num>, AabbPin<&mut T>) -> Option<CastResult<T::Num>>,
fine: impl FnMut(&Ray<T::Num>, AabbPin<&mut T>) -> CastResult<T::Num>,
xline: impl FnMut(&Ray<T::Num>, T::Num) -> CastResult<T::Num>,
yline: impl FnMut(&Ray<T::Num>, T::Num) -> CastResult<T::Num>
) -> CastResult<CastAnswer<'_, T>>
pub fn cast_ray<R: RayCast<T>>(
&mut self,
ray: Ray<T::Num>,
rtrait: R
) -> CastResult<CastAnswer<'_, T>>
sourceimpl<'a, T: Aabb> Tree<'a, T>
impl<'a, T: Aabb> Tree<'a, T>
pub fn find_all_not_in_rect<'b, K: Aabb<Num = T::Num>>(
&'b mut self,
rect: AabbPin<&mut K>,
closure: impl FnMut(AabbPin<&mut K>, AabbPin<&'b mut T>)
)
pub fn find_all_in_rect<'b, K: Aabb<Num = T::Num>>(
&'b mut self,
rect: AabbPin<&mut K>,
closure: impl FnMut(AabbPin<&mut K>, AabbPin<&'b mut T>)
)
pub fn find_all_intersect_rect<'b, K: Aabb<Num = T::Num>>(
&'b mut self,
rect: AabbPin<&mut K>,
closure: impl FnMut(AabbPin<&mut K>, AabbPin<&'b mut T>)
)
sourceimpl<'a, T: Aabb> Tree<'a, T>
impl<'a, T: Aabb> Tree<'a, T>
pub fn find_colliding_pairs_with<X: Aabb<Num = T::Num>>(
&mut self,
other: &mut Tree<'_, X>,
func: impl FnMut(AabbPin<&mut T>, AabbPin<&mut X>)
)
pub fn find_colliding_pairs_with_iter<'x, X: Aabb<Num = T::Num> + 'x>(
&mut self,
other: impl Iterator<Item = AabbPin<&'x mut X>>,
func: impl FnMut(AabbPin<&mut T>, AabbPin<&mut X>)
)
sourceimpl<'a, T: Aabb> Tree<'a, T>
impl<'a, T: Aabb> Tree<'a, T>
pub fn handle_nbody<N: Nbody<T = T>>(&mut self, no: &mut N)
sourceimpl<'a, T: Aabb> Tree<'a, T>
impl<'a, T: Aabb> Tree<'a, T>
sourcepub fn is_degenerate(&self) -> bool
pub fn is_degenerate(&self) -> bool
If the top 25% of tree levels has more elements than the bottom 75%, consider the tree not good for querying without a considerable jump in computation cost.
If worst case n*n time is unacceptable for your usecase, consider calling this
after tree construction. If the tree is degenerate, consider just handling
a subset of all colliding pairs by using the colliding pair building blocks
in queries::colfind::build
sourceimpl<'a, T: Aabb + 'a> Tree<'a, T>
impl<'a, T: Aabb + 'a> Tree<'a, T>
pub fn from_build_args<'b, P: Splitter>(args: BuildArgs<'a, 'b, T, P>) -> Self
pub fn par_from_build_args<'b, P: Splitter>(
args: BuildArgs<'a, 'b, T, P>
) -> Self where
T: Send,
T::Num: Send,
P: Send,
pub fn new(bots: &'a mut [T]) -> Self
pub fn par_new(bots: &'a mut [T]) -> Self where
T: Send,
T::Num: Send,
pub fn vistr_mut(&mut self) -> VistrMutPin<'_, Node<'a, T>>
pub fn vistr(&self) -> Vistr<'_, Node<'a, T>>
pub fn num_levels(&self) -> usize
pub fn num_nodes(&self) -> usize
pub fn get_nodes(&self) -> &[Node<'a, T>]
pub fn get_nodes_mut(&mut self) -> AabbPin<&mut [Node<'a, T>]>
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Tree<'a, T> where
T: RefUnwindSafe,
<T as Aabb>::Num: RefUnwindSafe,
impl<'a, T> Send for Tree<'a, T> where
T: Send,
<T as Aabb>::Num: Send,
impl<'a, T> Sync for Tree<'a, T> where
T: Sync,
<T as Aabb>::Num: Sync,
impl<'a, T> Unpin for Tree<'a, T> where
<T as Aabb>::Num: Unpin,
impl<'a, T> !UnwindSafe for Tree<'a, T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more