diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..2407ebc --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +`acap` +====== + +[](https://github.com/tavianator/knn/blob/master/LICENSE) +[](https://travis-ci.com/tavianator/acap) + +As Close As Possible — [nearest neighbor search] in Rust. + +[nearest neighbor search]: https://en.wikipedia.org/wiki/Nearest_neighbor_search + + +Example +------- + +```rust +use acap::euclid::Euclidean; +use acap::vp::VpTree; +use acap::NearestNeighbors; + +let tree = VpTree::balanced(vec![ + Euclidean([3, 4]), + Euclidean([5, 12]), + Euclidean([8, 15]), + Euclidean([7, 24]), +]); + +let nearest = tree.nearest(&[7, 7]).unwrap(); +assert_eq!(nearest.item, &Euclidean([3, 4])); +assert_eq!(nearest.distance, 5); +``` |