quadtree cellsslow starsfast starscentral mass
Couldn't start the 3D scene.

Barnes-Hut Tree Code for a Spiral Galaxy: Opening Angle, Force Error and N log N Cost

Computing the gravity of every star on every other star costs N squared operations; the Barnes-Hut tree code replaces distant groups of stars by a single point mass and needs only about N log N. Set the number of stars, the opening angle theta, the softening length and the initial spiral and watch a Blender-built hologram table carry a rotating galaxy whose quadtree grid is drawn beneath it, while the force error against direct summation, the interaction count and the rotation curve update live. Checked against direct summation, error growth with theta, N log N scaling and the Kepler period of a leapfrog orbit.

Made with 🟠 Blender · Three.js