summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2020-05-28 16:02:25 -0400
committerTavian Barnes <tavianator@tavianator.com>2020-06-24 10:03:44 -0400
commit97d64547f40f362120109fd23f647f15241c08d9 (patch)
tree3b69d764bbf6379bca48516684d85dd175b39578
parent360565b36adab5f6c69e3dc09091c940a142527e (diff)
downloadacap-97d64547f40f362120109fd23f647f15241c08d9.tar.xz
docs: Add a README
-rw-r--r--Cargo.toml1
-rw-r--r--README.md30
2 files changed, 31 insertions, 0 deletions
diff --git a/Cargo.toml b/Cargo.toml
index ebdf330..418514a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,6 +4,7 @@ version = "0.1.0"
authors = ["Tavian Barnes <tavianator@tavianator.com>"]
edition = "2018"
description = "A principled API for nearest neighbor search in both metric and non-metric spaces"
+readme = "README.md"
repository = "https://github.com/tavianator/acap"
license = "MIT"
keywords = ["ann", "knn", "nearest-neighbors"]
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);
+```