Quadtrees and The Barnes-Hut Algorithm: The Making of a Gravity Simulation
William Y. Feng William Y. Feng
2.95K subscribers
25,466 views
0

 Published On Jan 19, 2022

Have you ever been entranced by the beauty of gravity simulations? In this video, I explain the Barnes-Hut algorithm for quickly computing solutions to the n-body problem.

Code: https://github.com/womogenes/GravitySim
Barnes-hut article: http://arborjs.org/docs/barnes-hut
Collisions explained:    • How to Simulate a Collision  

00:00 Intro
00:27 The physics of gravity
03:38 A naive approach
05:16 Quadtrees
10:00 Barnes-Hut
12:46 Time complexity analysis
14:02 Collisions!
16:25 Outtro

show more

Share/Embed