Skip to content

Commit

Permalink
Small doc edits (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron authored Jan 5, 2025
1 parent 87e1ec8 commit c7bc4f9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/kdtree/mod.rs
Original file line number Diff line number Diff line change
@@ -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<u8>` 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.
Expand Down
21 changes: 11 additions & 10 deletions src/rtree/mod.rs
Original file line number Diff line number Diff line change
@@ -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<u8>` 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
//!
//! ```
Expand All @@ -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;
Expand Down

0 comments on commit c7bc4f9

Please sign in to comment.