[−][src]Struct broccoli::Tree
A space partitioning tree.
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(joiner: impl Joinable, 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(broccoli::RayonJoin,&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 into_inner(self) -> CompleteTreeContainer<Node<'a, T>, PreOrder>
[src]
Examples
use broccoli::build; const NUM_ELEMENT:usize=7; let mut bots = [axgeom::rect(0,10,0,10);NUM_ELEMENT]; let mut tree = broccoli::new(&mut bots); let inner =tree.into_inner(); assert_eq!(inner.into_nodes().len(),1);
#[must_use]pub fn num_aabbs(&self) -> usize
[src]
Examples
use broccoli::build; const NUM_ELEMENT:usize=7; let mut bots = [axgeom::rect(0,10,0,10);NUM_ELEMENT]; let mut tree = broccoli::new(&mut bots); assert_eq!(tree.num_aabbs(),7);
pub unsafe fn from_raw_parts(
inner: CompleteTreeContainer<Node<'a, T>, PreOrder>,
num_aabbs: usize
) -> Self
[src]
inner: CompleteTreeContainer<Node<'a, T>, PreOrder>,
num_aabbs: usize
) -> Self
Examples
use broccoli::build; const NUM_ELEMENT:usize=7; let mut bots = [axgeom::rect(0,10,0,10);NUM_ELEMENT]; let mut tree = broccoli::new(&mut bots); let num_aabbs=tree.num_aabbs(); let inner =tree.into_inner(); let tree=unsafe{broccoli::Tree::from_raw_parts(inner,num_aabbs)}; assert_eq!(tree.num_aabbs(),7);
Safety
Unsafe, since the user may pass a number of aabbs that does not reflect the true number of aabbs in every node.
#[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]
fn find_colliding_pairs_mut(
&mut self,
mut func: impl FnMut(PMut<'_, Self::T>, PMut<'_, Self::T>)
)
[src]
&mut self,
mut func: impl FnMut(PMut<'_, Self::T>, PMut<'_, Self::T>)
)
fn find_colliding_pairs_mut_par(
&mut self,
joiner: impl Joinable,
func: impl Fn(PMut<'_, Self::T>, PMut<'_, Self::T>) + Send + Sync + Clone
) where
Self::T: Send + Sync,
Self::Num: Send + Sync,
[src]
&mut self,
joiner: impl Joinable,
func: impl Fn(PMut<'_, Self::T>, PMut<'_, Self::T>) + Send + Sync + Clone
) where
Self::T: Send + Sync,
Self::Num: Send + Sync,
fn new_builder<'c>(&'c mut self) -> QueryBuilder<'c, 'a, Self::T>
[src]
impl<'a, T: Aabb> DrawQuery<'a> for Tree<'a, T>
[src]
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<TreeInd<'a, 'b, N, T>> for Tree<'b, BBox<N, &'a mut T>>
[src]
impl<'a, T: Aabb> IntersectQuery<'a> for Tree<'a, T>
[src]
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]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
fn vistr_mut(&mut self) -> VistrMut<'_, Node<'a, T>>
[src]
fn vistr(&self) -> Vistr<'_, Node<'a, T>>
[src]
impl<'a, T: Aabb> RaycastQuery<'a> for Tree<'a, T>
[src]
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]
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,
fn for_all_intersect_rect_mut<'b>(
&'b mut self,
rect: &Rect<Self::Num>,
mut func: impl FnMut(PMut<'b, Self::T>)
) where
'a: 'b,
[src]
&'b mut self,
rect: &Rect<Self::Num>,
mut func: impl FnMut(PMut<'b, Self::T>)
) where
'a: 'b,
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,
fn for_all_in_rect_mut<'b>(
&'b mut self,
rect: &Rect<Self::Num>,
mut func: impl FnMut(PMut<'b, Self::T>)
) where
'a: 'b,
[src]
&'b mut self,
rect: &Rect<Self::Num>,
mut func: impl FnMut(PMut<'b, Self::T>)
) where
'a: 'b,
fn for_all_not_in_rect_mut<'b>(
&'b mut self,
rect: &Rect<Self::Num>,
mut func: impl FnMut(PMut<'b, Self::T>)
) where
'a: 'b,
[src]
&'b mut self,
rect: &Rect<Self::Num>,
mut func: impl FnMut(PMut<'b, Self::T>)
) where
'a: 'b,
#[must_use]fn multi_rect<'c>(&'c mut self) -> MultiRect<'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>,