pub struct QuadTree<T> { /* private fields */ }Expand description
Quadrilateral (quad) tree is used for space partitioning and fast spatial queries.
Implementations§
Source§impl<I> QuadTree<I>where
I: Clone + 'static,
impl<I> QuadTree<I>where
I: Clone + 'static,
Sourcepub fn new<T>(
root_bounds: Rect<f32>,
objects: impl Iterator<Item = T>,
split_threshold: usize,
) -> Result<QuadTree<I>, QuadTreeBuildError>where
T: BoundsProvider<Id = I>,
pub fn new<T>(
root_bounds: Rect<f32>,
objects: impl Iterator<Item = T>,
split_threshold: usize,
) -> Result<QuadTree<I>, QuadTreeBuildError>where
T: BoundsProvider<Id = I>,
Creates new quad tree from the given initial bounds and the set of objects.
Sourcepub fn point_query<S>(
&self,
point: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
storage: &mut S,
)where
S: QueryStorage<Id = I>,
pub fn point_query<S>(
&self,
point: Matrix<f32, Const<2>, Const<1>, ArrayStorage<f32, 2, 1>>,
storage: &mut S,
)where
S: QueryStorage<Id = I>,
Searches for a leaf node in the tree, that contains the given point and writes ids of the entities stored in the leaf node to the output storage.
Sourcepub fn split_threshold(&self) -> usize
pub fn split_threshold(&self) -> usize
Returns current split threshold, that was used to build the quad tree.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for QuadTree<T>
impl<T> RefUnwindSafe for QuadTree<T>where
T: RefUnwindSafe,
impl<T> Send for QuadTree<T>where
T: Send,
impl<T> Sync for QuadTree<T>where
T: Sync,
impl<T> Unpin for QuadTree<T>where
T: Unpin,
impl<T> UnwindSafe for QuadTree<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> AsyncTaskResult for T
impl<T> AsyncTaskResult for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts self reference as a reference to
Any. Could be used to downcast a trait object
to a particular type.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts self reference as a reference to
Any. Could be used to downcast a trait object
to a particular type.fn into_any(self: Box<T>) -> Box<dyn Any>
Source§impl<T> FieldValue for Twhere
T: 'static,
impl<T> FieldValue for Twhere
T: 'static,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.