Barnes-Hut Simulation

Barnes-Hut Simulation

A simulation of the Barnes-Hut algorithm for gravitational force calculations.

About the Project

While this probably should be in the Basilisk Engine page, I put it here because I thought it was a notable feature not many people would use. Earlier today in my graphics class, my professor mentioned Barnes-Hut and I thought it would be cool to showcase that I had already made it. In short here's how it works:

  1. Hijack the spacial partitioning system and make each AABB store the mass of all rigids contained in it.
  2. When computing gravity, use the mass of untraveled leaves to approximate the gravitational contribution of all contained rigids.
  3. Using all collected gravities during the traversal, compute the net gravitational force on the current rigid.
  4. Cinema