Fly a spacecraft past a planet with no fuel. Choose the planet, approach speed, how close to pass and the approach angle, and read how the planet's gravity turns your velocity and changes your speed in the Sun's frame.
The science
Patched conics. In the planet's frame the spacecraft follows a hyperbola with excess speed v∞ (the speed far from the planet). Eccentricity e = 1 + rp v∞² / μ, turn angle δ = 2 asin(1/e), periapsis speed vp = √(v∞² + 2μ/rp). Far from the planet |v∞| is the same before and after: gravity only rotates the vector.
Sun frame. Add the planet's orbital velocity V: vin = V + v∞,in, vout = V + v∞,out. Because |v∞| is unchanged, |vout|² − |vin|² = 2 V·(v∞,out − v∞,in): the speed change is the planet's momentum exchange. The planet's own speed changes by a negligible amount (its mass is vastly larger).
Numerical trajectory. The drawn path is an RK4 integration of r̈ = −μ r / r³ with an adaptive step proportional to r/v, started at 40 rp on the incoming leg. The check table compares the integrated turn angle, periapsis and energy with the closed form.
Simplifications. Planar encounter, point-mass planet (no oblateness, atmosphere or moons), circular coplanar planetary orbit with the speeds shown, the Sun's gravity ignored during the (hours long) encounter, instantaneous patching. Planet constants are rounded fact-sheet values. The thin rings are a schematic gravity-potential picture, not magnetic field lines. Models built with Blender, scene by Three.js. Orbital physics only.