pub struct Query<'tree, P, V> { /* private fields */ }
Expand description
A context for repeated nearest-neighbor queries that internally re-uses memory across queries.
Implementations§
Source§impl<'tree, P: Point, V> Query<'tree, P, V>
impl<'tree, P: Point, V> Query<'tree, P, V>
Sourcepub fn nn<'query>(
&'query mut self,
point: &'query P,
) -> Iter<'tree, 'query, P, V> ⓘ
pub fn nn<'query>( &'query mut self, point: &'query P, ) -> Iter<'tree, 'query, P, V> ⓘ
Given a point
, return an Iterator
that yields neighbors from closest to
farthest. To get the K nearest neighbors, simply take
K from the iterator.
The neighbor, its distance, and associated value are returned.
Sourcepub fn nn_within<'query>(
&'query mut self,
point: &'query P,
max_radius: f64,
) -> Iter<'tree, 'query, P, V> ⓘ
pub fn nn_within<'query>( &'query mut self, point: &'query P, max_radius: f64, ) -> Iter<'tree, 'query, P, V> ⓘ
The same as nn
but only consider neighbors whose distance is <= max_radius
.
Sourcepub fn min_radius<'query>(&'query mut self, point: &'query P, k: usize) -> f64
pub fn min_radius<'query>(&'query mut self, point: &'query P, k: usize) -> f64
What is the minimum radius that encompasses k
neighbors of point
?
Sourcepub fn count<'query>(
&'query mut self,
point: &'query P,
max_radius: f64,
) -> usize
pub fn count<'query>( &'query mut self, point: &'query P, max_radius: f64, ) -> usize
How many neighbors are <= max_radius
of point
?
Sourcepub fn allocated_size(&self) -> usize
pub fn allocated_size(&self) -> usize
Return the size in bytes of the memory this Query
is keeping internally to avoid allocation.
Sourcepub fn deallocate_memory(&mut self)
pub fn deallocate_memory(&mut self)
The Query
object re-uses memory internally to avoid allocation. This method deallocates that memory.
Trait Implementations§
Auto Trait Implementations§
impl<'tree, P, V> Freeze for Query<'tree, P, V>
impl<'tree, P, V> RefUnwindSafe for Query<'tree, P, V>where
P: RefUnwindSafe,
V: RefUnwindSafe,
impl<'tree, P, V> Send for Query<'tree, P, V>
impl<'tree, P, V> Sync for Query<'tree, P, V>
impl<'tree, P, V> Unpin for Query<'tree, P, V>
impl<'tree, P, V> UnwindSafe for Query<'tree, P, V>where
P: RefUnwindSafe,
V: RefUnwindSafe,
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