pub struct SpatialIndex<K: Ord + Copy> { /* private fields */ }Expand description
Bounding-box index keyed by K.
Implementations§
Source§impl<K: Ord + Copy + PartialEq> SpatialIndex<K>
impl<K: Ord + Copy + PartialEq> SpatialIndex<K>
Sourcepub fn bulk_load(items: Vec<(K, Aabb)>) -> Self
pub fn bulk_load(items: Vec<(K, Aabb)>) -> Self
Bulk-load (much faster than repeated inserts). Empty boxes are skipped.
Sourcepub fn upsert(&mut self, key: K, bbox: Aabb)
pub fn upsert(&mut self, key: K, bbox: Aabb)
Insert or replace the box of key. Empty boxes remove the key.
Sourcepub fn query_rect(&self, r: Aabb) -> Vec<K>
pub fn query_rect(&self, r: Aabb) -> Vec<K>
Keys whose boxes intersect r, sorted.
Sourcepub fn query_point(&self, p: Point, radius: f64) -> Vec<K>
pub fn query_point(&self, p: Point, radius: f64) -> Vec<K>
Keys whose boxes lie within radius of p, nearest first.
Trait Implementations§
Source§impl<K: Clone + Ord + Copy> Clone for SpatialIndex<K>
impl<K: Clone + Ord + Copy> Clone for SpatialIndex<K>
Source§fn clone(&self) -> SpatialIndex<K>
fn clone(&self) -> SpatialIndex<K>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<K> Freeze for SpatialIndex<K>
impl<K> RefUnwindSafe for SpatialIndex<K>where
K: RefUnwindSafe,
impl<K> Send for SpatialIndex<K>where
K: Send,
impl<K> Sync for SpatialIndex<K>where
K: Sync,
impl<K> Unpin for SpatialIndex<K>where
K: Unpin,
impl<K> UnsafeUnpin for SpatialIndex<K>
impl<K> UnwindSafe for SpatialIndex<K>where
K: RefUnwindSafe + UnwindSafe,
Blanket Implementations§
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