diff --git a/README.md b/README.md index cfacccb..032c983 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,9 @@ A Rust crate for packed, immutable, zero-copy spatial indexes. ## Drawbacks - Trees are _immutable_. After creating the index, items can no longer be added or removed. -- Only two-dimensional data is supported. This can still be used with higher-dimensional input as long as it's fine to only index two of the dimensions. -- Queries return positional indexes into the input set, so you must manage your own collections. -- Only the set of coordinate types that exist in JavaScript are allowed, to maintain FFI compatibility with the reference JavaScript implementations. This does not and probably will not support other types like `u64`. +- Only two-dimensional indexes is supported. This can still be used with higher-dimensional input data as long as it's fine to only index two of the dimensions. +- Queries return insertion indexes into the input set, so you must manage your own collections. +- Only the set of coordinate types that exist in JavaScript are allowed, to maintain FFI compatibility with the reference JavaScript implementations. Hence this does not support other types like `u64`. ## Alternatives @@ -60,7 +60,6 @@ Currently, this library is used under the hood in [`geoarrow-rs`](https://github ## Future work -- Nearest-neighbor queries on the R-tree. This is implemented in the original JS version but hasn't been ported yet. - Geographic queries. Currently all queries are planar. ## Benchmarks diff --git a/src/kdtree/mod.rs b/src/kdtree/mod.rs index ccaae28..54c1796 100644 --- a/src/kdtree/mod.rs +++ b/src/kdtree/mod.rs @@ -1,25 +1,25 @@ //! An immutable, ABI-stable K-D Tree. //! -//! ## Creation +//! ### Creation //! //! Use [`KDTreeBuilder`] to construct an [`KDTree`], which allows you to make queries. //! -//! ## Search +//! ### Search //! //! Use [`KDTreeIndex::range`] to search a KDTree given a bounding box query. Use //! [`KDTreeIndex::within`] to search a KDTree given a point and radius. //! -//! ## Persisting +//! ### Persisting //! //! You can use [`KDTree::into_inner`] to access the underlying `Vec` it contains. //! -//! ## Recovering the index +//! ### Recovering the index //! //! You can use [`KDTreeRef::try_new`] to construct a KDTree as a reference on an external byte //! slice. If you don't know the coordinate type used in the index, you can use //! [`CoordType::from_buffer`][crate::CoordType::from_buffer] to infer the coordinate type. //! -//! ## Coordinate types +//! ### Coordinate types //! //! Supported coordinate types implement [`IndexableNum`][crate::IndexableNum]. Note that float //! `NaN` is not supported and may panic. diff --git a/src/rtree/mod.rs b/src/rtree/mod.rs index 4410b19..ca110ea 100644 --- a/src/rtree/mod.rs +++ b/src/rtree/mod.rs @@ -1,28 +1,33 @@ //! An immutable, ABI-stable RTree. //! -//! ## Creation +//! ### Creation //! //! Use [`RTreeBuilder`] to construct an [`RTree`], which allows you to make queries. //! -//! ## Search +//! ### Search //! -//! Use [`RTreeIndex::search`] to search an RTree given a bounding box query. +//! Use [`RTreeIndex::search`] to search an RTree given a bounding box query or +//! [`RTreeIndex::neighbors`] to find the nearest neighbors from a point. //! -//! ## Persisting +//! ### Persisting //! //! You can use [`RTree::into_inner`] to access the underlying `Vec` it contains. //! -//! ## Recovering the index +//! ### Recovering the index //! //! You can use [`RTreeRef::try_new`] to construct an RTree as a reference on an external byte //! slice. If you don't know the coordinate type used in the index, you can use //! [`CoordType::from_buffer`][crate::CoordType::from_buffer] to infer the coordinate type. //! -//! ## Coordinate types +//! ### Coordinate types //! //! Supported coordinate types implement [`IndexableNum`][crate::IndexableNum]. Note that float //! `NaN` is not supported and may panic. //! +//! ### Alternate sorting methods +//! +//! This crate allows for multiple sorting methods, implemented in [`sort`]. +//! //! ## Example //! //! ``` @@ -48,10 +53,6 @@ //! // Perform search again //! assert_eq!(tree_ref.search(0.5, 0.5, 1.5, 1.5), vec![0, 1]); //! ``` -//! -//! ## Alternate sorting methods -//! -//! This crate allows for multiple sorting methods, implemented in [`sort`]. mod builder; mod constants;