https://github.com/benbaarber/quadtree
Generic QuadTree implementation in Rust
https://github.com/benbaarber/quadtree
quadtree
Last synced: 6 months ago
JSON representation
Generic QuadTree implementation in Rust
- Host: GitHub
- URL: https://github.com/benbaarber/quadtree
- Owner: benbaarber
- License: mit
- Created: 2024-08-04T21:27:31.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-06T22:36:26.000Z (12 months ago)
- Last Synced: 2025-09-16T14:47:50.738Z (9 months ago)
- Topics: quadtree
- Language: Rust
- Homepage: https://crates.io/crates/quadtree
- Size: 59.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Quadtree
[](https://crates.io/crates/quadtree)
[](https://docs.rs/quadtree/latest/quadtree/)
This Quadtree library provides efficient spatial querying capabilities for 2D
points. It supports various operations such as insertion, and rectangular and
circular querying, making it suitable for applications in areas such as gaming,
geographical information systems, and real-time simulations.
## Features
- **Generic Implementation**: `Quadtree` works with any data type `T` that
implements the `Point` and `Clone` traits.
- **Spatial Queries**: Supports querying within spatial regions that implement
the `Shape` trait (`Rect` and `Circle` are provided).
- **Dynamic Operations**: Efficiently perform mutating operations without full
rebuilds.
- insert
- insert_many
- delete
- pop
- **Barnes-Hut Approximation**: The `BHQuadtree` is provided for [Barnes-Hut
approximation](https://en.wikipedia.org/wiki/Barnes%E2%80%93Hut_simulation) of
n-body simulations. An interactive explanation of this algorithm can be found
[here](https://jheer.github.io/barnes-hut/). This implementation is heavily
inspired by [DeadlockCode's Barnes-Hut
implementation](https://github.com/DeadlockCode/barnes-hut/tree/improved).
- **Serde Serialization**: Enable the `"serde"` feature to serialize the
Quadtree and provided shapes. A `Quadtree` will serialize into a sequence of
items of type `T`.