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::dummy_point::*;
use nabo::KDTree;
let cloud = random_point_cloud(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::dummy_point::*;
use nabo::KDTree;
use nabo::CandidateContainer;
use nabo::Parameters;
let cloud = random_point_cloud(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

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

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