This project simulates the behaviour of a system of particles under gravitational forces (essentially a N-body simulation).
nbodysim.mp4
In the project root-
mkdir build
cd buildConfigure with CMake-
cmake ..Build the project -
cmake --build .Run the simulation
./OpenGLApp| Control | Type | Description |
|---|---|---|
| Pause / Resume | Button | Toggle simulation run state |
| Generate New Galaxy | Button | Re-generate galaxy with current settings |
| Enable/Disable Camera | Button | Toggles free-fly camera mode |
| Camera Speed | Slider | Adjust movement speed |
| Reset Camera | Button | Reset camera to initial position |
| WASD / QE / Mouse | Text Info | Control camera movement |
| Space | Text Info | Pause/resume simulation |
| Esc | Text Info | Exit simulation |
- Supports simulation types: [Sequential (O(N²)), Barnes-Hut (O(N log N))]
- Adjustable physics parameters: [Speed, Time Step, Theta]
- Galaxy types: [Random, Disk, Spiral, Collision, Dense]
- Adjustable particle count and real-time galaxy regeneration
- Barnes-Hut extras: [Adaptive Theta, Tree Rebuild Frequency, Profiling Output]
- Exposure, chromatic aberration and adjustable post-processing control
- Star density, blackhole mass adjustment
- Free-fly 3D camera, camera paramters adjustment
- Detailed performance logging
- Barnes, J., & Hut, P. (1986) – A hierarchical O(N log N) force-calculation algorithm. Nature, 324(6096), 446–449.
- Hernquist, L., & Katz, N. (1989) – TREESPH: A unification of SPH with the hierarchical tree method. The Astrophysical Journal Supplement Series, 70, 419–446.
- Springel, V. (2005) – The cosmological simulation code GADGET-2. Monthly Notices of the Royal Astronomical Society, 364(4), 1105–1134.
- OpenGL Documentation
- Dear ImGui
- Barnes-Hut explanation – ArborJS
- Barnes-Hut Lecture Slides – Colorado State University