[][src]Struct dinotree_alg::DinoTree

pub struct DinoTree<A: Axis, N: Node> { /* fields omitted */ }

The data structure this crate revoles around.

Methods

impl<'a, T: Aabb> DinoTree<DefaultA, NodeMut<'a, T>>[src]

#[must_use] pub fn new(bots: &'a mut [T]) -> DinoTree<DefaultA, NodeMut<'a, T>>[src]

Examples

let mut bots = [axgeom::rect(0,10,0,10)];
let tree = dinotree_alg::DinoTree::new(&mut bots);

impl<'a, T: Aabb + Send + Sync> DinoTree<DefaultA, NodeMut<'a, T>>[src]

#[must_use] pub fn new_par(bots: &'a mut [T]) -> DinoTree<DefaultA, NodeMut<'a, T>>[src]

Examples

let mut bots = [axgeom::rect(0,10,0,10)];
let tree = dinotree_alg::DinoTree::new_par(&mut bots);

impl<'a, A: Axis, T: Aabb> DinoTree<A, NodeMut<'a, T>>[src]

#[must_use] pub fn with_axis(axis: A, bots: &'a mut [T]) -> DinoTree<A, NodeMut<'a, T>>[src]

Examples

let mut bots = [axgeom::rect(0,10,0,10)];
let tree = dinotree_alg::DinoTree::with_axis(axgeom::XAXISS,&mut bots);

impl<'a, A: Axis, T: Aabb + Send + Sync> DinoTree<A, NodeMut<'a, T>>[src]

#[must_use] pub fn with_axis_par(axis: A, bots: &'a mut [T]) -> DinoTree<A, NodeMut<'a, T>>[src]

Examples

let mut bots = [axgeom::rect(0,10,0,10)];
let tree = dinotree_alg::DinoTree::with_axis(axgeom::XAXISS,&mut bots);

impl<A: Axis, N: Node + Send + Sync> DinoTree<A, N> where
    N::T: Send + Sync
[src]

pub fn find_collisions_mut_par(
    &mut self,
    func: impl Fn(PMut<N::T>, PMut<N::T>) + Send + Sync
)
[src]

Examples

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

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

impl<A: Axis, N: Node> DinoTree<A, N>[src]

pub fn as_bounded(&mut self, rect: Rect<N::Num>) -> BoundedDinoTree<A, N>[src]

pub fn draw(
    &self,
    drawer: &mut impl DividerDrawer<N = N::Num>,
    rect: &Rect<N::Num>
)
[src]

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

Examples

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

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

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

#[must_use] pub fn multi_rect(&mut self) -> MultiRectMut<A, N>[src]

Examples

use dinotree_alg::prelude::*;
let mut bots1 = [bbox(axgeom::rect(0,10,0,10),0u8)];
let mut tree = DinoTree::new(&mut bots1);
let mut multi = tree.multi_rect();

multi.for_all_in_rect_mut(axgeom::rect(0,10,0,10),|a|{}).unwrap();
let res = multi.for_all_in_rect_mut(axgeom::rect(5,15,5,15),|a|{});
assert_eq!(res,Err(RectIntersectErr));

pub fn for_all_not_in_rect_mut(
    &mut self,
    rect: &Rect<N::Num>,
    func: impl FnMut(PMut<N::T>)
)
[src]

pub fn for_all_intersect_rect_mut(
    &mut self,
    rect: &Rect<N::Num>,
    func: impl FnMut(PMut<N::T>)
)
[src]

pub fn for_all_intersect_rect<'a>(
    &'a self,
    rect: &Rect<N::Num>,
    func: impl FnMut(&'a N::T)
)
[src]

pub fn for_all_in_rect_mut(
    &mut self,
    rect: &Rect<N::Num>,
    func: impl FnMut(PMut<N::T>)
)
[src]

pub fn for_all_in_rect(&self, rect: &Rect<N::Num>, func: impl FnMut(&N::T))[src]

pub fn find_collisions_mut(&mut self, func: impl FnMut(PMut<N::T>, PMut<N::T>))[src]

Examples

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

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

#[must_use] pub fn axis(&self) -> A[src]

#[must_use] pub fn vistr_mut(&mut self) -> VistrMut<N>[src]

#[must_use] pub fn vistr(&self) -> Vistr<N>[src]

#[must_use] pub fn get_height(&self) -> usize[src]

#[must_use] pub fn num_nodes(&self) -> usize[src]

Auto Trait Implementations

impl<A, N> Unpin for DinoTree<A, N> where
    A: Unpin,
    N: Unpin

impl<A, N> Send for DinoTree<A, N> where
    N: Send

impl<A, N> Sync for DinoTree<A, N> where
    N: Sync

impl<A, N> UnwindSafe for DinoTree<A, N> where
    A: UnwindSafe,
    N: UnwindSafe

impl<A, N> RefUnwindSafe for DinoTree<A, N> where
    A: RefUnwindSafe,
    N: RefUnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]