[−][src]Struct dinotree_alg::BoundedDinoTree
Methods
impl<'_, A: Axis, N: Node> BoundedDinoTree<'_, A, N>
[src]
#[must_use]
pub fn k_nearest_mut(
&mut self,
point: Vec2<N::Num>,
num: usize,
distance: impl Fn(Vec2<N::Num>, &Rect<N::Num>) -> N::Num
) -> Vec<KnearestResult<N::T>>
[src]
&mut self,
point: Vec2<N::Num>,
num: usize,
distance: impl Fn(Vec2<N::Num>, &Rect<N::Num>) -> N::Num
) -> Vec<KnearestResult<N::T>>
Examples
use dinotree_alg::prelude::*; use axgeom::*; let border = rect(0,100,0,100); let mut bots = [rect(0,10,0,10), rect(2,5,2,5), rect(4,10,4,10)]; let mut bots_copy=bots.clone(); let mut tree = DinoTree::new(&mut bots); let mut bounded_tree=tree.as_bounded(border); let res = bounded_tree.k_nearest_mut(vec2(0,0),2,|a,b|b.distance_squared_to_point(a).unwrap_or(0)); assert_eq!(res.len(),2); assert_eq!(res[0].bot.get(),&bots_copy[0]); assert_eq!(res[1].bot.get(),&bots_copy[1]);
#[must_use]
pub fn k_nearest_fine_mut(
&mut self,
point: Vec2<N::Num>,
num: usize,
knear: &mut impl Knearest<N = N::Num, T = N::T>
) -> Vec<KnearestResult<N::T>>
[src]
&mut self,
point: Vec2<N::Num>,
num: usize,
knear: &mut impl Knearest<N = N::Num, T = N::T>
) -> Vec<KnearestResult<N::T>>
#[must_use]
pub fn raycast_fine_mut(
&mut self,
ray: Ray<N::Num>,
rtrait: &mut impl RayCast<N = N::Num, T = N::T>
) -> RayCastResult<N::T>
[src]
&mut self,
ray: Ray<N::Num>,
rtrait: &mut impl RayCast<N = N::Num, T = N::T>
) -> RayCastResult<N::T>
#[must_use]
pub fn raycast_mut(
&mut self,
ray: Ray<N::Num>,
rtrait: impl Fn(&Ray<N::Num>, &Rect<N::Num>) -> RayIntersectResult<N::Num>
) -> RayCastResult<N::T>
[src]
&mut self,
ray: Ray<N::Num>,
rtrait: impl Fn(&Ray<N::Num>, &Rect<N::Num>) -> RayIntersectResult<N::Num>
) -> RayCastResult<N::T>
Methods from Deref<Target = DinoTree<A, N>>
pub fn find_collisions_mut_par(
&mut self,
func: impl Fn(PMut<N::T>, PMut<N::T>) + Send + Sync
)
[src]
&mut self,
func: impl Fn(PMut<N::T>, PMut<N::T>) + Send + Sync
)
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);
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]
&self,
drawer: &mut impl DividerDrawer<N = N::Num>,
rect: &Rect<N::Num>
)
pub fn intersect_with_mut<X: Aabb<Num = N::Num>>(
&mut self,
other: &mut [X],
func: impl Fn(PMut<N::T>, PMut<X>)
)
[src]
&mut self,
other: &mut [X],
func: impl Fn(PMut<N::T>, PMut<X>)
)
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]
&mut self,
rect: &Rect<N::Num>,
func: impl FnMut(PMut<N::T>)
)
pub fn for_all_intersect_rect_mut(
&mut self,
rect: &Rect<N::Num>,
func: impl FnMut(PMut<N::T>)
)
[src]
&mut self,
rect: &Rect<N::Num>,
func: impl FnMut(PMut<N::T>)
)
pub fn for_all_intersect_rect<'a>(
&'a self,
rect: &Rect<N::Num>,
func: impl FnMut(&'a N::T)
)
[src]
&'a self,
rect: &Rect<N::Num>,
func: impl FnMut(&'a N::T)
)
pub fn for_all_in_rect_mut(
&mut self,
rect: &Rect<N::Num>,
func: impl FnMut(PMut<N::T>)
)
[src]
&mut self,
rect: &Rect<N::Num>,
func: impl FnMut(PMut<N::T>)
)
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]
Trait Implementations
impl<'_, A: Axis, N: Node> Deref for BoundedDinoTree<'_, A, N>
[src]
type Target = DinoTree<A, N>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
impl<'_, A: Axis, N: Node> DerefMut for BoundedDinoTree<'_, A, N>
[src]
Auto Trait Implementations
impl<'a, A, N> Unpin for BoundedDinoTree<'a, A, N> where
<N as Node>::Num: Unpin,
<N as Node>::Num: Unpin,
impl<'a, A, N> Send for BoundedDinoTree<'a, A, N> where
N: Send,
<N as Node>::Num: Send,
N: Send,
<N as Node>::Num: Send,
impl<'a, A, N> Sync for BoundedDinoTree<'a, A, N> where
N: Sync,
<N as Node>::Num: Sync,
N: Sync,
<N as Node>::Num: Sync,
impl<'a, A, N> !UnwindSafe for BoundedDinoTree<'a, A, N>
impl<'a, A, N> RefUnwindSafe for BoundedDinoTree<'a, A, N> where
A: RefUnwindSafe,
N: RefUnwindSafe,
<N as Node>::Num: RefUnwindSafe,
A: RefUnwindSafe,
N: RefUnwindSafe,
<N as Node>::Num: RefUnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
ⓘImportant traits for &'_ mut Ifn borrow_mut(&mut self) -> &mut T
[src]
ⓘImportant traits for &'_ mut I
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,