Kerbal Sandbox
README.md
OrbMath
Orbital mechanics + atmosphere math for Orbiteer. Pure functions over state vectors relative to an explicit body center — no engine state.
gravityAccel(mu, px,py,pz, cx,cy,cz)— point-mass gravitational acceleration.atmoDensity(rho0, scaleH, atmoTop, alt)— exponential atmosphere, zero above the cutoff.elements(mu, surfaceR, px,py,pz, vx,vy,vz)— Keplerian elements: sma, ecc, apo/peri (radius and altitude), period, energy, angular-momentum and eccentricity vectors, speed, radial velocity. Branches on energy sign so degenerate radial ellipses stay bound.samplePath(el, cx,cy,cz, mu, n?)— polyline of the current orbit (full ellipse, or the reachable arc when hyperbolic) plus apoapsis/periapsis sample indices. Drives the map view.deltaV(ve, m0, m1)— Tsiolkovsky.circularSpeed(mu, r)— circular orbital speed.vlen / vdot / vcross— vec3 helpers on scalar triples.