Barnes-Hut-Algorithm [Unity - C#]
This simulator uses the Barnes-Hut algorithm to simulate gravity on n bodies. It is notable for having order O(n log n) compared to a direct-sum algorithm which would be O(n2).
This solution, using Barnes-Hut, perform better than the brute force solution.
Despite approximation the behavior remain very similar to the brute force.
Quad-Tree and Center-Gravity visualisation.
The Barnes-Hut Algorithm article by Tom Ventimiglia & Kevin Wayne, was really useful for me to have a good understanding of the Barnes-Hut-Algorithm.
My friend Martin Magakian was building a Barnes-Hut in Rust.
Licensed under Creative Commons Attribution 4.0