[−][src]Struct broccoli::Tree
The data structure this crate revoles around.
Implementations
impl<'a, T: Aabb> Tree<'a, T>
[src]
pub fn new(bots: &'a mut [T]) -> Tree<'a, T>
[src]
Create a Tree
.
Examples
let mut bots = [axgeom::rect(0,10,0,10)]; let tree = broccoli::Tree::new(&mut bots);
pub fn new_par(bots: &'a mut [T]) -> Tree<'a, T> where
T: Send + Sync,
T::Num: Send + Sync,
[src]
T: Send + Sync,
T::Num: Send + Sync,
Create a Tree
in parallel.
Examples
let mut bots = [axgeom::rect(0,10,0,10)]; let tree = broccoli::Tree::new_par(&mut bots);
#[must_use]pub fn get_height(&self) -> usize
[src]
Examples
use broccoli::build; const NUM_ELEMENT:usize=40; let mut bots = [axgeom::rect(0,10,0,10);NUM_ELEMENT]; let mut tree = broccoli::new(&mut bots); assert_eq!(tree.get_height(),build::TreePreBuilder::new(NUM_ELEMENT).get_height());
#[must_use]pub fn num_nodes(&self) -> usize
[src]
Examples
use broccoli::build; let mut bots = [axgeom::rect(0,10,0,10)]; let mut tree = broccoli::new(&mut bots); assert_eq!(tree.num_nodes(),build::TreePreBuilder::new(1).num_nodes());
#[must_use]pub fn get_nodes(&self) -> &[Node<'a, T>]ⓘ
[src]
Examples
let mut bots = [axgeom::rect(0,10,0,10)]; let mut tree = broccoli::new(&mut bots); assert_eq!(tree.get_nodes()[0].range[0], axgeom::rect(0,10,0,10));
#[must_use]pub fn get_nodes_mut(&mut self) -> PMut<'_, [Node<'a, T>]>
[src]
Examples
let mut bots = [axgeom::rect(0,10,0,10)]; let mut tree = broccoli::new(&mut bots); assert_eq!(tree.get_nodes_mut().get_index_mut(0).range[0], axgeom::rect(0,10,0,10));
#[must_use]pub fn get_elements_mut(&mut self) -> PMut<'_, [T]>
[src]
Return the underlying slice of aabbs in the order sorted during tree construction.
Examples
let mut bots = [axgeom::rect(0,10,0,10)]; let mut tree = broccoli::new(&mut bots); assert_eq!(*tree.get_elements_mut().get_index_mut(0), axgeom::rect(0,10,0,10));
#[must_use]pub fn get_elements(&self) -> &[T]ⓘ
[src]
Return the underlying slice of aabbs in the order sorted during tree construction.
Examples
let mut bots = [axgeom::rect(0,10,0,10)]; let tree = broccoli::new(&mut bots); assert_eq!(tree.get_elements()[0], axgeom::rect(0,10,0,10));
Trait Implementations
impl<'a, T: Aabb> ColfindQuery<'a> for Tree<'a, T>
[src]
pub fn find_colliding_pairs_mut(
&mut self,
func: impl FnMut(PMut<'_, Self::T>, PMut<'_, Self::T>)
)
[src]
&mut self,
func: impl FnMut(PMut<'_, Self::T>, PMut<'_, Self::T>)
)
pub fn find_colliding_pairs_mut_par(
&mut self,
func: impl Fn(PMut<'_, Self::T>, PMut<'_, Self::T>) + Send + Sync + Clone
) where
Self::T: Send + Sync,
Self::Num: Send + Sync,
[src]
&mut self,
func: impl Fn(PMut<'_, Self::T>, PMut<'_, Self::T>) + Send + Sync + Clone
) where
Self::T: Send + Sync,
Self::Num: Send + Sync,
pub fn new_colfind_builder<'c>(&'c mut self) -> QueryBuilder<'c, 'a, Self::T>
[src]
impl<'a, T: Aabb> DrawQuery<'a> for Tree<'a, T>
[src]
pub fn draw_divider(
&self,
line: impl FnMut(AxisDyn, &Node<'_, Self::T>, &Rect<Self::Num>, usize),
rect: Rect<Self::Num>
)
[src]
&self,
line: impl FnMut(AxisDyn, &Node<'_, Self::T>, &Rect<Self::Num>, usize),
rect: Rect<Self::Num>
)
impl<'a, 'b, N: Num, T> From<TreeRefInd<'a, 'b, N, T>> for Tree<'b, BBox<N, &'a mut T>>
[src]
pub fn from(a: TreeRefInd<'a, 'b, N, T>) -> Self
[src]
impl<'a, T: Aabb> IntersectQuery<'a> for Tree<'a, T>
[src]
pub fn intersect_with_mut<X: Aabb<Num = Self::Num>>(
&mut self,
other: &mut [X],
func: impl Fn(PMut<'_, Self::T>, PMut<'_, X>)
)
[src]
&mut self,
other: &mut [X],
func: impl Fn(PMut<'_, Self::T>, PMut<'_, X>)
)
impl<'a, T: Aabb> KnearestQuery<'a> for Tree<'a, T>
[src]
#[must_use]pub fn k_nearest_mut<'b, K: Knearest<T = Self::T, N = Self::Num>>(
&'b mut self,
point: Vec2<Self::Num>,
num: usize,
ktrait: &mut K
) -> KResult<'_, Self::T> where
'a: 'b,
[src]
&'b mut self,
point: Vec2<Self::Num>,
num: usize,
ktrait: &mut K
) -> KResult<'_, Self::T> where
'a: 'b,
impl<'a, T: Aabb> Queries<'a> for Tree<'a, T>
[src]
type T = T
type Num = T::Num
pub fn vistr_mut(&mut self) -> VistrMut<'_, Node<'a, T>>
[src]
pub fn vistr(&self) -> Vistr<'_, Node<'a, T>>
[src]
impl<'a, T: Aabb> RaycastQuery<'a> for Tree<'a, T>
[src]
pub fn raycast_mut<'b, R: RayCast<T = Self::T, N = Self::Num>>(
&'b mut self,
ray: Ray<Self::Num>,
rtrait: &mut R
) -> CastResult<CastAnswer<'b, Self::T>> where
'a: 'b,
[src]
&'b mut self,
ray: Ray<Self::Num>,
rtrait: &mut R
) -> CastResult<CastAnswer<'b, Self::T>> where
'a: 'b,
impl<'a, T: Aabb> RectQuery<'a> for Tree<'a, T>
[src]
pub fn for_all_intersect_rect<'b>(
&'b self,
rect: &Rect<Self::Num>,
func: impl FnMut(&'b Self::T)
) where
'a: 'b,
[src]
&'b self,
rect: &Rect<Self::Num>,
func: impl FnMut(&'b Self::T)
) where
'a: 'b,
pub fn for_all_intersect_rect_mut<'b>(
&'b mut self,
rect: &Rect<Self::Num>,
func: impl FnMut(PMut<'b, Self::T>)
) where
'a: 'b,
[src]
&'b mut self,
rect: &Rect<Self::Num>,
func: impl FnMut(PMut<'b, Self::T>)
) where
'a: 'b,
pub fn for_all_in_rect<'b>(
&'b self,
rect: &Rect<Self::Num>,
func: impl FnMut(&'b Self::T)
) where
'a: 'b,
[src]
&'b self,
rect: &Rect<Self::Num>,
func: impl FnMut(&'b Self::T)
) where
'a: 'b,
pub fn for_all_in_rect_mut<'b>(
&'b mut self,
rect: &Rect<Self::Num>,
func: impl FnMut(PMut<'b, Self::T>)
) where
'a: 'b,
[src]
&'b mut self,
rect: &Rect<Self::Num>,
func: impl FnMut(PMut<'b, Self::T>)
) where
'a: 'b,
pub fn for_all_not_in_rect_mut<'b>(
&'b mut self,
rect: &Rect<Self::Num>,
func: impl FnMut(PMut<'b, Self::T>)
) where
'a: 'b,
[src]
&'b mut self,
rect: &Rect<Self::Num>,
func: impl FnMut(PMut<'b, Self::T>)
) where
'a: 'b,
#[must_use]pub fn multi_rect<'c>(&'c mut self) -> MultiRectMut<'c, 'a, Self::T>
[src]
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Tree<'a, T> where
T: RefUnwindSafe,
<T as Aabb>::Num: RefUnwindSafe,
[src]
T: RefUnwindSafe,
<T as Aabb>::Num: RefUnwindSafe,
impl<'a, T> Send for Tree<'a, T> where
T: Send,
<T as Aabb>::Num: Send,
[src]
T: Send,
<T as Aabb>::Num: Send,
impl<'a, T> Sync for Tree<'a, T> where
T: Sync,
<T as Aabb>::Num: Sync,
[src]
T: Sync,
<T as Aabb>::Num: Sync,
impl<'a, T> Unpin for Tree<'a, T>
[src]
impl<'a, T> !UnwindSafe for Tree<'a, T>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,