Comet Gravity Assist (2D)
2D gravity-assist lab: a comet flies past a planet on an exact Newtonian hyperbolic orbit, integrated with adaptive-step RK4, while a live panel compares the analytic deflection formula against the angle actually measured from the simulated flyby.
This 2D companion drives the same Newtonian gravity-assist physics as the 3D scene through a plain top-down canvas built for reading the orbit rather than orbiting a rendered planet. Rather than launching the comet on an approximate straight line and letting gravity slowly curve it, the sim places it directly on the exact hyperbolic solution of the two-body problem for whatever approach speed, impact parameter and planet mass the sliders currently specify — so the closed-form deflection formula is exact for the starting state, not an approximation. An adaptive-step 4th-order Runge–Kutta integrator then propagates the flight, taking fine steps through the fast periapsis passage and coarse steps through the slow approach and departure, and the live panel puts the analytic prediction for the deflection angle right next to the angle actually measured off the simulated trajectory — along with the energy and angular-momentum drift that would expose a broken integrator — so the slingshot effect that reshapes real spacecraft and comet trajectories is directly verifiable instead of just animated.
2D gravity-assist simulation: the comet starts on the exact Newtonian hyperbola for the chosen approach speed, impact parameter and planet mass, is propagated with adaptive-step RK4 under 1/r² gravity, and a live readout compares the closed-form predicted deflection angle against the angle measured from the simulated flyby, plus energy/angular-momentum drift as an integration accuracy check.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install