Skip to content

OrangeTurtle77/NBody-Simulator

Repository files navigation

N-Body Simulator

Purpose

This C++ program simulates planetary motion and renders it using OpenGL.

Configuration can be found in the Config.h in /src. Configurable values include:

  • Number of Planets
  • Simulation Speed
  • Δt (Delta Time / Time Step)
  • Window Size (on launch)
  • Method / Solver
  • Debug Mode

Methods

Various methods can be applied through Config.h, primarily the SOLVER variable, of which can be any option in the list directly above its declaration.

Implemented

  • Euler's Method (First Order Accuracy)
    • Euler's Method is prone to energy drift, making it unstable for prolonged orbits.
  • Velocity Verlet (Second Order Accuracy)
    • Velocity Verlet is algebraically equivalent to Leapfrog, another second order accurate method.

Planned

  • Runge-Kutta 4 (Fourth Order Accuracy)
    • Runge-Kutta 4 is prone to energy drift, making it unstable for prolonged orbits and thus making it less reliable than Velocity Verlet.

Rendering

All visual output is rendered through OpenGL. Use WASD/Arrow Keys allows for the movement of the camera and E/+ and Q/- for zooming in and out, respectively.

Development

This program currently demonstrates approximately O(n^2) time complexity, but is in the process of being reduced to about O(nlog(n)) through the use of the Barnes-Hut Approximation Model.

About

No description or website provided.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors