Documentation / @interstellar-tools/equations / meanAnomalyAt
Function: meanAnomalyAt()
ts
function meanAnomalyAt(
orbit: Pick<OrbitInterface, 'e' | 'angle' | 'period'>,
date: Date
): Radians;Defined in: anomalies/anomaly-at.ts:53
The mean anomaly (
Every orbit.angle in the datasets is the true anomaly at J2000 (2000-01-01 12:00 TT), so this advances the orbit from J2000 to date with advanceMeanAnomaly. Dates before J2000 work too.
The time is measured in UTC, as JavaScript dates are, against J2000_UTC. Leap seconds since 2000 are ignored, which moves a body by a few seconds of its orbit at most.
Parameters
| Parameter | Type | Description |
|---|---|---|
orbit | Pick<OrbitInterface, "e" | "angle" |
date | Date | The date to find the body at. |
Returns
The mean anomaly at date, in
Throws
If date is not a valid Date.
Throws
If the orbit's eccentricity is outside
Example
ts
import { PLANETS } from '@interstellar-tools/constants';
import { meanAnomalyAt } from '@interstellar-tools/equations';
const earth = PLANETS.find((planet) => planet.id === 'earth')!;
meanAnomalyAt(earth.orbit!, new Date('2026-10-17T12:00:00Z')); // ≈ 4.934 rad (282.7°)See
trueAnomalyAt for where the body actually is.