Spatial Hashing for Boids
March 2024
Uniform grid spatial hashing to speed up neighbor searches in boids simulation. Without hashing, finding neighbors for each boid is . With spatial hashing, it drops to roughly by only checking nearby cells.
Try adding more boids with the + key and see when it starts to stutter. Toggle hashing on/off with H to feel the difference.
Loading...
Controls:
- H: Toggle spatial hashing
- V: Visualize the hash grid
- +: Add 500 boids
- -: Remove 500 boids