Point/region Quadtree with support for overlapping regions.
For documentation, see docs.rs/quadtree_rs.
```rust use quadtree_rs::{area::AreaBuilder, point::Point, Quadtree};
// Instantiate a new quadtree which associates String values with u64
// coordinates.
let mut qt = Quadtree::
// A depth of four means a square with width (and height) 2^4. assert_eq!(qt.width(), 16);
// Associate the value "foo" with a rectangle of size 2x1, anchored at (0, 0). let regiona = AreaBuilder::default() .anchor(Point {x: 0, y: 0}) .dimensions((2, 1)) .build().unwrap(); qt.insert(regiona, "foo".to_string());
// Query over a region of size 2x2, anchored at (1, 0). let regionb = AreaBuilder::default() .anchor(Point {x: 1, y: 0}) .dimensions((2, 2)) .build().unwrap(); let mut query = qt.query(regionb);
// The query region (regionb) intersects the region "foo" is associated with // (regiona), so the query iterator returns "foo" by reference. asserteq!(query.next().unwrap().valueref(), "foo"); ```
Please file an issue on GitHub.
See Cargo.toml
.
See CONTRIBUTING.md
and NOTES.md
This project is licensed under the Apache 2.0 license.
This is not an official Google product.