spade
Spade (SPAtial DatastructurEs, obviously!) implements a few nifty data structures for spatial access operations:
- An n-dimensional r*-tree for efficient nearest-neighbor and point lookup queries
- 2D Delaunay triangulation, optionally backed by an r-tree for faster insertion and nearest neighbor lookup
- 2D constrained Delaunay triangulation (CDT)
Some other noteworthy features:
- natural neighbor interpolation on this triangulation
- Precise and adaptive calculation methods to avoid rounding issues
All structures are purely written in rust, the package currently supports vectors from the nalgebra and cgmath packages. However, using these packages is not required.
Compatibility note
Spade complies with semantic versioning, and since it is past its 1.0 version, current minor version changes will be backward compatible. However, due to the way cargo resolves dependencies, there might be issues when using spade combined with cgmath or nalgebra: every time spade updates these libraries, the using code must be update too, even if spade would still work happily with the older versions. To avoid this, consider switching to fixed size arrays as points until public / private dependencies make their way into cargo.
Documentation
The documentation can be found under docs.rs. There is also a user guide available.
Feedback and contributing
Do you miss a feature? Many features may be easy to implement, I might just have missed that use case. Please do post an issue on GitHub. If you think there's a feature missing and you are interested to implement it yourself, don't be shy to mention it - I'd be happy to help you getting started. Just post an appropriate issue on GitHub.
Examples
Note: If you have opened this on docs.rs, you won't see any images. Use the README.md on the GitHub page.
R-Tree
This image shows the structure of an r*-tree with some points inserted in a circular pattern.
Points are shown as blue dots, the tree's directory nodes are displayed as boxes of different colors (depending on their depth in the tree).
Note that the implementation tries prevent any boxes from overlapping, resulting in faster query performance. You can find this example in /examples/interactivedemo, run it with cargo run rtree.
CDT
CDT's are usual Delaunay triangulations with a few "fixed" edges:
Interpolation
The user guide has a an own chapter about interpolation, along with some nice images.
An example showcasing spade's interpolation features can be found in /examples/nninterpolation, run it with cargo run.
Performance
The user guide contains detailed graphs and information about the delaunay triangulation's performance.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.