star-sim

Barnes-Hut gravity simulation.
Log | Files | Refs | README | LICENSE

commit aad157e7b09a726c947f9326a353d6bdb72b0f05
parent 98f8a98736e0ac1f7121694388a43c6292709fbd
Author: Amin Mesbah <mesbahamin@gmail.com>
Date:   Sun, 30 Jul 2017 01:27:59 -0700

Release version 0.1.0.

Diffstat:
MREADME.md | 23+++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md @@ -1,16 +1,23 @@ ![Gif of lazily wandering stars](https://cloud.githubusercontent.com/assets/5744114/24231758/af94bcbe-0f43-11e7-83ef-9e937b498c78.gif) -### Barnes Hut Simulation +This is a simulation of gravitational attraction between lots of 'stars'. -I'm currently working on implementing the [Barnes-Hut Algorithm](https://en.wikipedia.org/wiki/Barnes%E2%80%93Hut_simulation). - -I've made a quadtree that I use to recursively partition the simulation space. +The [Barnes-Hut Algorithm](http://arborjs.org/docs/barnes-hut) is used to +efficiently calculate the forces acting on each star. ![Gif of recursive partition grid](https://cloud.githubusercontent.com/assets/5744114/25370870/6c51d2e8-2942-11e7-8a0b-929a185b768c.gif) -Now I just have to use that tree to simplify the gravitational attraction -calculations between distant groups of stars. -Dependencies ------------- +### Keyboard Shortcuts + +- `b`: Toggle brute-force mode. Stars turn blue when this mode is active, and + gravitational attraction is calculated for every single pair of stars. The + Barnes-Hut grid is not updated. +- `g`: Toggle Barnes-Hut grid rendering. +- `p`: Pause/unpause simulation. +- `t`: Toggle star trail rendering. + + +### Dependencies + - [SDL 2.0.5](https://www.libsdl.org/download-2.0.php)