This is a gravity simulation using the runge kutter integration method.
To start a new simulation, change path
in cnf.py
to where you want your simulations to be stored, {}
is a placeholder for the simulation id. (WARNING: SIMULATION FILES CAN GET VERY BIG)
Then you can run the simulation using simulate.py
.
To render the simulation, run render.py
and enter the path of the simulation.
To create an own simulation environment, change environment.py
to what you want it to be. X (shape=[?, 2]) is the array for the positions, V (shape=[?, 2]) is the array for the velocities, M (shape=[?, 2]) is the array for the masses of the particles, COLOR (shape=[?, 3]) is the array for the colors.
cnf.py
has all the settings for simulating the environment.
cnfrender.py
stores the settings for rendering a simulation.
There are 2 algorithms implemented for the simulation at the moment, the standard bruteforce algorithm and the barnes-hut-algorithm. The bruteforce algorithm is faster in most cases, to use it set use_barnes_hut
in cnf.py
to False. To use the barnes-hut algorithm, set it to true.