Crate nabo

Source
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::simple_point::*;
use nabo::KDTree;
let cloud = random_point_cloud::<2>(10000);
let tree = KDTree::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::simple_point::*;
use nabo::KDTree;
use nabo::CandidateContainer;
use nabo::Parameters;
let cloud = random_point_cloud::<2>(10000);
let tree = KDTree::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§

simple_point
A simple D-dimensional point type

Structs§

FloatIsNan
An error indicating an attempt to construct NotNan from a NaN
KDTree
A KD-Tree to perform NN-search queries
Neighbour
A neighbour resulting from the search
NotNan
A wrapper around floats providing an implementation of Eq, Ord and Hash.
Parameters
Advanced search parameters

Enums§

CandidateContainer
The type of container to keep candidates

Traits§

Point
A point in the space to be searched
Scalar
The scalar type for points in the space to be searched

Type Aliases§

Index
The index of a point in the original point cloud