Expand description
A fast K Nearest Neighbour library for low-dimensional spaces.
This crate is a re-implementation in pure Rust of the C++ library of the same name. This work has been sponsored by Enlightware GmbH.
Example
use nabo_pbc::dummy_point::*;
use nabo_pbc::KDTree;
const K: usize = 2;
let cloud = random_point_cloud(10000);
let tree = KDTree::<_,_,K>::new(&cloud);
let query = random_point();
let neighbour = tree.knn(3, &query);
If you want to have more control on the search, you can use the advanced API:
use nabo_pbc::dummy_point::*;
use nabo_pbc::KDTree;
use nabo_pbc::CandidateContainer;
use nabo_pbc::Parameters;
const K: usize = 2;
let cloud = random_point_cloud(10000);
let tree = KDTree::<_,_,K>::new(&cloud);
let query = random_point();
let mut touch_count = 0;
let neighbour = tree.knn_advanced(
3,
&query,
CandidateContainer::BinaryHeap,
&Parameters {
epsilon: 0.0,
max_radius: 10.0,
allow_self_match: true,
sort_results: false,
},
Some(&mut touch_count) // statistics
);
Modules
A simple 2-D point for testing
Structs
A KD-Tree to perform NN-search queries
A neighbour resulting from the search
A wrapper around floats providing an implementation of Eq
, Ord
and Hash
.
Advanced search parameters
Enums
The type of container to keep candidates
Traits
A point in the space to be searched
The scalar type for points in the space to be searched
Type Definitions
The index of a point in the original point cloud