pub struct RTree<T, C, const D: usize> { /* private fields */ }Expand description
R*-tree spatial index.
Stores points with associated payloads and supports range queries, kNN queries, and spatial joins. Uses forced reinsertion on overflow and quadratic splits.
Implementations§
Source§impl<T, C: CoordType, const D: usize> RTree<T, C, D>
impl<T, C: CoordType, const D: usize> RTree<T, C, D>
pub fn insert_entry(&mut self, point: Point<C, D>, payload: T) -> EntryId
pub fn remove_entry(&mut self, id: EntryId) -> Option<T>
Sourcepub fn range_query_impl<'a>(
&'a self,
bbox: &BBox<C, D>,
) -> Vec<(EntryId, &'a T)>
pub fn range_query_impl<'a>( &'a self, bbox: &BBox<C, D>, ) -> Vec<(EntryId, &'a T)>
Return all entries whose points lie within bbox.
pub fn knn_query_impl<'a>( &'a self, point: &Point<C, D>, k: usize, ) -> Vec<(f64, EntryId, &'a T)>
Trait Implementations§
Source§impl<T: Send + Sync + 'static, C: CoordType, const D: usize> SpatialBackend<T, C, D> for RTree<T, C, D>
impl<T: Send + Sync + 'static, C: CoordType, const D: usize> SpatialBackend<T, C, D> for RTree<T, C, D>
Source§fn insert(&mut self, point: Point<C, D>, payload: T) -> EntryId
fn insert(&mut self, point: Point<C, D>, payload: T) -> EntryId
Insert a point with an associated payload. Returns the unique
EntryId
assigned to this entry.Source§fn remove(&mut self, id: EntryId) -> Option<T>
fn remove(&mut self, id: EntryId) -> Option<T>
Remove the entry with the given
EntryId. Returns the payload if the
entry existed, or None otherwise.Source§fn range_query(&self, bbox: &BBox<C, D>) -> Vec<(EntryId, &T)>
fn range_query(&self, bbox: &BBox<C, D>) -> Vec<(EntryId, &T)>
Return all entries whose positions are contained within
bbox.Source§fn knn_query(&self, point: &Point<C, D>, k: usize) -> Vec<(f64, EntryId, &T)>
fn knn_query(&self, point: &Point<C, D>, k: usize) -> Vec<(f64, EntryId, &T)>
Return the
k nearest entries to point, ordered by ascending
Euclidean distance. Each result is (distance, id, payload_ref).Source§fn spatial_join(
&self,
other: &dyn SpatialBackend<T, C, D>,
) -> Vec<(EntryId, EntryId)>
fn spatial_join( &self, other: &dyn SpatialBackend<T, C, D>, ) -> Vec<(EntryId, EntryId)>
Return all pairs
(id_a, id_b) where the bounding box of entry id_a
in self intersects the bounding box of entry id_b in other. Read moreSource§fn bulk_load(entries: Vec<(Point<C, D>, T)>) -> Self
fn bulk_load(entries: Vec<(Point<C, D>, T)>) -> Self
Bulk-load a set of
(point, payload) pairs into a new backend instance. Read moreSource§fn kind(&self) -> BackendKind
fn kind(&self) -> BackendKind
Return the
BackendKind discriminant for this backend.Auto Trait Implementations§
impl<T, C, const D: usize> Freeze for RTree<T, C, D>
impl<T, C, const D: usize> RefUnwindSafe for RTree<T, C, D>where
C: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, C, const D: usize> Send for RTree<T, C, D>
impl<T, C, const D: usize> Sync for RTree<T, C, D>
impl<T, C, const D: usize> Unpin for RTree<T, C, D>where
C: Unpin,
impl<T, C, const D: usize> UnsafeUnpin for RTree<T, C, D>
impl<T, C, const D: usize> UnwindSafe for RTree<T, C, D>where
C: UnwindSafe,
T: 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