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<T>
works with any data typeT
that implements thePoint
andClone
traits. - Spatial Queries: Supports querying within spatial regions that implement
the
Shape
trait (Rect
andCircle
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 of n-body simulations. An interactive explanation of this algorithm can be found here. This implementation is heavily inspired by DeadlockCode's Barnes-Hut implementation. - Serde Serialization: Enable the
"serde"
feature to serialize the Quadtree and provided shapes. AQuadtree<T>
will serialize into a sequence of items of typeT
.