🌑 Orbital Mechanics — Gravity Assist & Lagrange Points

Explore two key concepts in spacecraft navigation: the gravitational slingshot (gravity assist) where a spacecraft steals orbital energy from a planet, and the 5 Lagrange equilibrium points of a two-body system where gravitational forces balance.

🇺🇦 Українська

Preset orbit

Orbital elements

State (vis-viva & Kepler)

Period T
Speed (vis-viva)
Apoapsis
Periapsis
Two-body motion:
a = -GM · r / |r|^3
integrated with velocity-Verlet.

Kepler 3: T = 2π√(a^3/GM)
Vis-viva: v = √(GM(2/r - 1/a))
Angular momentum L = r × v is conserved; sweeps equal areas in equal time (Kepler 2).
Drag to orbit the camera.

How Gravity Assists Work

A gravity assist (gravitational slingshot) uses a planet's gravity and orbital motion to accelerate or decelerate a spacecraft — essentially "stealing" kinetic energy from the planet's enormous mass. In the planet's reference frame, the spacecraft's speed is unchanged but its direction rotates. In the Sun's frame, the change in direction produces a net speed gain of up to 2·v_planet. NASA used this technique to send Voyager 1 & 2 on trajectories that would otherwise be impossible with available propellant. Lagrange points L1–L3 are unstable saddle points; L4 and L5 (equilateral triangle with the two masses) are stable if the mass ratio m₂/m₁ < 0.0385 (Routh criterion).

About this Simulation

This simulator visualises a satellite on a classical two-body Kepler orbit around a fixed central mass (GM = 1 in scaled units), driven by orbital elements rather than a numerically integrated force field. Each frame the mean anomaly M advances at the constant rate n = 2π/T set by Kepler's third law, then eight Newton–Raphson iterations solve Kepler's transcendental equation M = E − e⋅sin(E) for the eccentric anomaly E. That E is mapped straight onto the ellipse (focus at the origin) using the semi-major axis a and eccentricity e, then rotated into 3D by the inclination i and argument of periapsis ω. Instantaneous speed follows the vis-viva equation, and the Burn button applies a simplified prograde Δv by nudging a and e upward.

What it shows

A live 3D ellipse with apoapsis/periapsis markers, a fading trail, and readouts for orbital period T, instantaneous vis-viva speed, apoapsis and periapsis — all recomputed every frame directly from the current a, e, i and ω.

How to use it

Pick a preset (Circular, Elliptical, Transfer, Polar) or drag the four element sliders, fire a Δv burn to raise the orbit, pause/resume time, and drag on the canvas to orbit the camera around the scene.

Did you know?

Kepler's equation M = E − e⋅sin(E) has no algebraic inverse — every orbit propagator, from this simulator to real mission-planning software, must solve it iteratively, exactly as the 8 Newton–Raphson steps here do each animation frame.

Frequently Asked Questions

What orbital elements does the simulator use, and what do they control?

The simulator represents the orbit with four classical elements: semi-major axis a (overall size), eccentricity e (how elongated the ellipse is, 0 = circle), inclination i (tilt of the orbital plane about the X axis), and argument of periapsis ω (rotation of the ellipse within that plane). Dragging any slider rebuilds the ellipse geometry and periapsis/apoapsis markers instantly; the four presets (Circular, Elliptical, Transfer, Polar) simply load different a/e/i/ω combinations.

How does the simulator calculate the satellite's position without a full physics engine?

Instead of numerically integrating forces frame by frame, it uses the analytic two-body Kepler solution. The mean anomaly M advances at the constant rate n = 2π/T, where T comes from Kepler's third law. Each frame, 8 iterations of Newton–Raphson solve Kepler's equation M = E − e⋅sin(E) for the eccentric anomaly E, and E is converted directly into an (x, y) position on the ellipse via a and e — no step-by-step force integration is needed because the two-body orbit has a closed-form trajectory.

What does the "Burn +Δv" button actually change?

It is a simplified stand-in for a prograde rocket burn: clicking it increases the semi-major axis a by 0.25 (capped at 3.5 R) and the eccentricity e by 0.08 (capped at 0.85), which raises the apoapsis while the periapsis stays close to its previous value — the same qualitative effect a real prograde burn near periapsis has on an orbit, without integrating the actual thrust impulse.

Why does the satellite move faster near periapsis than near apoapsis?

The simulator computes instantaneous speed from the vis-viva equation, v = √(GM⋅(2/r − 1/a)), evaluated every frame using the satellite's current distance r from the focus. Because r is smallest at periapsis, 2/r is largest there, giving the highest speed; at apoapsis r is largest, so speed drops to its minimum. This is a direct visualisation of Kepler's second law: the orbit sweeps equal areas in equal time, so it must move faster when closer to the mass.

What is Kepler's equation, and why does it need iterative solving?

Kepler's equation, M = E − e⋅sin(E), links the mean anomaly M (which advances uniformly with time) to the eccentric anomaly E (which locates the satellite on the ellipse). It is transcendental — E appears both inside and outside a trigonometric function — so there is no algebraic formula to invert it. The simulator's solveKepler() function instead starts from an initial guess and refines it with 8 Newton–Raphson iterations, converging to machine precision well within a single animation frame.