From 97d64547f40f362120109fd23f647f15241c08d9 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 28 May 2020 16:02:25 -0400 Subject: docs: Add a README --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 README.md (limited to 'README.md') 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` +====== + +[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/tavianator/knn/blob/master/LICENSE) +[![Build Status](https://travis-ci.com/tavianator/acap.svg?branch=master)](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); +``` -- cgit v1.2.3