Calculates state vectors of the solar system's planets at an arbitrary moment in time. Outputs both a 2D model of the system as a PNG and formatted distances in the console.
- Make
- C++17 or higher
make && ./build/main
OR
make run
The program uses two separate strategies to estimate planet vectors.
A.Using properties of a Keplerian Orbit:
- Normalize the Mean Anomaly to the specified date.
- Solve for the Eccentric Anomaly using Newton's Method.
- Convert the position along the orbital plane into heliocentric 3D Cartesian coordinates.
B. Using Newtonian physics and the N-body model:
- Obtain initial state vectors by following the same Keplerian orbit steps used for Terrestrial planets (excluding normalization to the target date).
- Calculate an acceleration vector for each planet by summing the gravitational effects from the Sun and other planets based on their masses and relative positions.
- Use the 4th-order Runge-Kutta method to numerically integrate the acceleration vectors twice — once for velocity and again for position — over the specified time step.
- Iterate over time steps, repeating steps 2–3 until the target time is reached.
Astronomical units (AU) : the mean distance between the Earth and the Sun
Orbital Elements : a set of parameters designed to approximate the planet's orbit at a given epoch
J2000 Epoch : Jan 1, 2000 — the reference point for orbital elements used in this program