Personal project · 2025–26
Digital orrery and transfer planner
0 bad arcs in 14,240 cells
A 3D solar system and mission-planning simulator I built, which runs in the browser. I verified its orbital mechanics core against NASA/JPL's CSPICE toolkit, and its porkchop planner runs on a Lambert solver that gives no bad arcs across a 14,240-cell Earth to Mars grid.
- My role
- Sole developer
- When
- Jun 2025 – present
- Tools
- TypeScript, React, Three.js, Vite, astronomy-engine, NASA SPICE (CSPICE and DE442), Web Workers
- Code
- Public on GitHub (opens in a new tab) (MIT licence) · Open the orrery (opens in a new tab) (it streams several hundred megabytes as you explore, so it is heavy on mobile data)
The full write-up
- The problem
- What I built
- Mars right now
- Result
- What went wrong
- What's next
- Earlier version
The problem
Planning a trip between planets means solving Lambert's problem across a grid of launch and arrival dates (a porkchop plot), then flying the result under the gravity of the Sun and planets. Both steps can fail quietly when the numerics are wrong.
What I built
- The 3D solar system is a TypeScript and React front end on Three.js and Vite, drawn at true scale and true positions with real lighting: inverse-square sunlight, NASA albedos and eclipse umbra and penumbra.
- The orbital core has two-body propagation, orbital elements and a universal-variable Lambert solver. Its Kepler propagation and Lambert solver agree with NASA's CSPICE (DE442) to between 1e-14 and 1e-13.
- The porkchop planner runs on that Lambert solver to find launch windows.
- In the n-body kernel, spacecraft fly under the Sun, 8 planets and the Moon, with a 4th-order Yoshida integrator. The physics is plain JavaScript running in a Web Worker.
- All 130 automated checks pass, across 4 test files: orbital mechanics, porkchop, n-body and the spacecraft kernel.
Mars right now
Today Mars is – million km from Earth, so light takes – minutes to cross one way, and it sits – from the Sun in our sky.
Result
- In a development run on a 14,240-cell Earth to Mars grid, the Lambert solver gave 0 failures and 0 wrong arcs, each checked by an independent adaptive integrator. The automated test runs a 920-cell grid checked the same way.
- Two-body propagation matches NASA/JPL's CSPICE toolkit to 2e-14 on elliptic orbits, 4e-15 on hyperbolic ones and 2.4e-13 near parabolic, and orbital elements match Curtis's worked examples.
- On Mars Science Laboratory's real 2011 launch and arrival dates, with DE440 planet states, the planner gives C3 = 10.69 km²/s² for a 253.6-day Type I arc, and astronomy-engine agrees to 1e-4.
- A 400 km Earth orbit flown in the n-body kernel stays within 0.2 km of the two-body solution over a day.
What went wrong
Before I hardened the Lambert solver, about 21% of the arcs on the 14,240-cell Earth to Mars grid came out bad, nearly all of them transfers longer than 180°. After hardening, none failed or went wrong.
What's next
- The integrator's step follows the local dynamical time but has no error control yet.
- The gravity model uses point masses only, with no gravity-field harmonics, solar radiation pressure, drag or relativity yet.
- The Lambert solver is zero-revolution only, and there is no n-body targeting or capture burn yet, so a planned arc doesn't arrive exactly.
- Real surface maps, Cassini-measured Saturn rings and daily NASA imagery of Earth are built on a branch but not merged yet.
Earlier version
An earlier Python version, interplanetryMissionPlanner (opens in a new tab) (2025, archived), is also public.