Re:Functional Flocking Quadtree in ClojureScript
by robto on Monday December 22, 2025 @02:31AM
(#46352064)
I think the flocking behavior of birds is one of the most entrancing natural phenomena, it's great to see it play out in such an intuitive way here. Is a quadtree generalizable to three dimensions? This looks like so much fun, thank you for sharing, I'm looking forward to playing with this over the holiday.
[ Parent
| on HN ]
Re:Functional Flocking Quadtree in ClojureScript
by thfuran on Monday December 22, 2025 @11:03AM
(#46355199)
And the same approach of just splitting in half in every dimension at each tree level can extend to arbitrary dimension, but usually something else like a kdtree is used instead.
Re:Functional Flocking Quadtree in ClojureScript
by markstock on Monday December 22, 2025 @09:45AM
(#46354500)
The general algorithm used here (of computing attraction and repulsion forces between pairs of particles) is very similar to that used in simulations of many interesting phenomena in physics. Start with Smoothed Particle Hydrodynamics (https://en.wikipedia.org/wiki/Smoothed-particle_hydrodynamic...) and then check out Lagrangian Vortex Particle Methods and other N-Body problems (https://en.wikipedia.org/wiki/N-body_problem).
And the algorithms to solve these quickly is another deep area of research.
Re:Functional Flocking Quadtree in ClojureScript
by markstock on Monday December 22, 2025 @09:50AM
(#46354543)
Quadtrees and octrees are themselves quite deep research areas. If the acceleration data structures interest you, I highly recommend Hanan Samet's book "Foundations of Multidimensional and Metric Data Structures". It's from 2006, but is basically the bible for the field.