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 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.