This is a simple 2-body simulation of bodies in space and how their gravitation impacts the trajectories of one another.
Change in distance calcualted from:
Distance between the two bodies calculated from:
Force between the two bodies calculated from:
Horizontal and Vertical components of Force calculated from:
Angle(theta) between the two bodies calcualted from:
Horizontal and Vertical Components of acceleration calculated from:
Initial and final velocities calculated from:
Change in position calculated from:
Make sure you follow the instructions at matplotlibcpp to setup the matplotlib extension for C++. This is what is being used to produce the visual output.