AABB - Hilbert R-tree Spatial Index
A Rust library providing a simple and efficient Hilbert R-tree implementation for spatial queries on axis-aligned bounding boxes (AABBs).
Features
- Hilbert Curve Ordering: Uses Hilbert space-filling curve for improved spatial locality
- AABB Intersection Queries: Fast rectangular bounding box intersection testing
- Simple API: Easy to use with minimal setup
- Static Optimization: Efficient for static or infrequently-modified spatial data
Usage
Add this to your Cargo.toml:
[]
= "0.1"
Basic Example
use *;
How it Works
The Hilbert R-tree stores bounding boxes in a flat array and sorts them by their Hilbert curve index (computed from box centers). This provides good spatial locality for most spatial queries while maintaining a simple, cache-friendly data structure.
API Reference
HilbertRTree::new()- Create a new empty treeadd(min_x, max_x, min_y, max_y)- Add a bounding boxbuild()- Build the spatial index (required before querying)query_intersecting(min_x, max_x, min_y, max_y, results)- Find intersecting boxes
License
This project is licensed under the MIT License.