Boids & quad trees
Link to repo
Quad trees are data structures for holding spatial information with a complexity of log(N) for collision detection. These are the foundation of every physics engine. They are also great for Boid-Simulations.
I used to have a nice web demo here, but it's no longer compatible, so here is a video with bad compression:
This application is written in rust.
Here is a picture explaining how the tree maps to 2D Space
Each node, in addition to its spatial information, can be one of two types: a Leaf, which is a data container for object references, or a Branch, which can only hold other nodes.