pub struct KdTree<A, const K: usize> { /* private fields */ }
Implementations
sourceimpl<A: Float + Zero + One, const K: usize> KdTree<A, K>
impl<A: Float + Zero + One, const K: usize> KdTree<A, K>
pub fn new() -> Self
pub fn with_per_node_capacity(capacity: usize) -> Result<Self, ErrorKind>
pub fn size(&self) -> usize
pub fn is_leaf(&self) -> bool
pub fn best_n_within<F>(
&self,
point: &[A; K],
radius: A,
max_qty: usize,
distance: &F
) -> Result<Vec<&[A; K]>, ErrorKind> where
F: Fn(&[A; K], &[A; K]) -> A,
sourcepub fn add(&mut self, point: &[A; K]) -> Result<(), ErrorKind>
pub fn add(&mut self, point: &[A; K]) -> Result<(), ErrorKind>
Add an element to the tree. The first argument specifies the location in kd space at which the element is located. The second argument is the data associated with that point in space.
Examples
use kiddo::KdTree;
let mut tree: KdTree<f64, 3> = KdTree::new();
tree.add(&[1.0, 2.0, 5.0])?;
tree.add(&[1.1, 2.1, 5.1])?;
assert_eq!(tree.size(), 2);
Trait Implementations
Auto Trait Implementations
impl<A, const K: usize> RefUnwindSafe for KdTree<A, K> where
A: RefUnwindSafe,
impl<A, const K: usize> Send for KdTree<A, K> where
A: Send,
impl<A, const K: usize> Sync for KdTree<A, K> where
A: Sync,
impl<A, const K: usize> Unpin for KdTree<A, K> where
A: Unpin,
impl<A, const K: usize> UnwindSafe for KdTree<A, K> where
A: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
Uses borrowed data to replace owned data, usually by cloning. Read more