OrbitSim
An N-body orbit simulator, optimised with the Barnes-Hut treecode algorithm.
Install / Use
/learn @ron0studios/OrbitSimREADME
OrbitSim
An N-body multithreaded orbit simulator, optimised with the Barnes-Hut treecode algorithm.
Building
cmake -B build
cmake --build build
./build/src/OrbitSim
in action
A spiral galaxy rendered with 100k particles at 10fps on a laptop. notice the bar in the middle, similar to the milky way.
The GUI
https://github.com/ron0studios/OrbitSim/assets/47331292/332809cd-ecd0-485e-b7a7-b80431de3c14
3 smaller (10k) galaxies colliding
an elliptical galaxy generated from the result of the previous galaxy merge
https://github.com/ron0studios/OrbitSim/assets/47331292/e0dd1de7-8974-4398-ad0a-a6325d75f1fe
100k particles spread across 10^8 metres zoom-out
those 100k particles eventually cluster and form something similar to the cosmic web
QuadTree visualisation with 10k asteroid ring (no central planet)
details
- capable of loading up to and over 100k particles without a GPU
- fairly accurate (can create stable orbits)
- capable of creating spirals (almost) and barred galaxies
- particles are rendered as pixel values instead of polygons for efficiency
- multithreading support for updating forces
- A very efficient implementation of the barnes-hut treecode algorithm
- the tree is generated with iteratively (recursion is slower and more memory intensive)
- the tree is stored linearly in an array (faster access, less pointer access)
- the tree nodes only save one pointer and 2-3 doubles for better performance
