An interactive n-body simulation created in Rust using Macroquad and egui.
Makes use of a (lightly) multithreaded implementation of the Barnes-Hut algorithm to effectively simulate tens of thousands of gravitational interactions between particles.
Initial conditions of the simulation are defined using TOML files, sample configs can be found in /samples
.
The gif above uses the config located here.
First, make sure to have rust and cargo installed. If not, instructions can be found here.
Next, simply clone this repo to a desired location, and run the following command:
cargo run --release [example.toml]
Replace [example.toml]
with the path to your own toml config file.
Before using the command above, make use of the shell.nix
file by running:
nix-shell
This starts a development environment where Ya-nbody can be built and run.