spacecraftEarthDistancefunction
A craft's distance from the Earth's centre at a moment, in kilometres: the craft's path from Horizons and the Earth from VSOP87B (a few thousand kilometres at most), both for the same instant, with no allowance for the light's travel.
Import it
import { spacecraftEarthDistance } from "@johnmorrisdotca/wakusei-planets/spacecraft";
Definition
function spacecraftEarthDistance(id: SpacecraftId, when: When): number
Parameters
| Name | Type | Description |
|---|---|---|
id | "voyager1" | "voyager2" | "newhorizons" | "pioneer10" | "pioneer11" | "cassini" | "galileo" | "juno" | "parker" | "webb" | The craft. |
when | When | A |
Returns
number
The distance.
Examples
import { loadSpacecraft, spacecraftEarthDistance } from "@johnmorrisdotca/wakusei-planets/spacecraft";
await loadSpacecraft("webb");
console.log((spacecraftEarthDistance("webb", Date.UTC(2026, 10, 8)) / 1e6).toFixed(2), "million km");1.64 million kmWhat it prints (run when this page was built)