orbital-mechanics-kit
v1.2.0
Published
Two-body orbital mechanics helpers: Kepler equation solver, orbital elements, and vis-viva.
Maintainers
Readme
orbital-mechanics-kit
Small, dependency-free toolkit for classical two-body orbital mechanics. It covers the pieces you keep re-deriving: a Kepler-equation solver, anomaly conversions, period / mean-motion, the vis-viva equation, apsides, and a Hohmann transfer estimator.
All angles are in radians (helpers degToRad / radToDeg are provided).
Lengths are in km and the default gravitational parameter is Earth's.
Install
npm install orbital-mechanics-kitUsage
import {
solveKepler,
meanToTrue,
orbitalPeriod,
hohmannTransfer,
MU_EARTH,
} from "orbital-mechanics-kit";
// Eccentric anomaly for M = 60deg, e = 0.3
const E = solveKepler(Math.PI / 3, 0.3);
// Period of a 7000 km circular orbit (seconds)
const T = orbitalPeriod(7000);
// LEO -> GEO Hohmann budget
const { total } = hohmannTransfer(6678, 42164, MU_EARTH);API
solveKepler(M, e, tol?, maxIter?)— Newton solve ofM = E - e sin E.eccentricToTrue(E, e)/meanToTrue(M, e)— anomaly conversions.orbitalPeriod(a, mu?),meanMotion(a, mu?).visViva(r, a, mu?)— orbital speed at radiusr.apsides(a, e)/elementsFromApsides(rp, ra).hohmannTransfer(r1, r2, mu?)—{ dv1, dv2, total, transferTime }.
References
- Vallado, Fundamentals of Astrodynamics and Applications, 4th ed.
- Curtis, Orbital Mechanics for Engineering Students, 3rd ed.
License
MIT
