Approachtype
The closest two bodies come in a span: the moment of the minimum and the separation then.
Import it
import type { Approach } from "@johnmorrisdotca/wakusei-planets/nearest";
Definition
interface Approach {
a: BodyId;
b: BodyId;
time: Date;
angle?: number;
uncertaintyArcseconds?: number;
distanceKm?: number;
distanceAu?: number;
uncertaintyKm?: number;
uncertaintySeconds: number;
atEdge: boolean;
}
Members
| Name | Type | Description |
|---|---|---|
a | BodyId | |
b | BodyId | |
time | Date | The moment of the minimum, to about a second of time. |
angle (optional) | number | undefined | Degrees, for |
uncertaintyArcseconds (optional) | number | undefined | The accuracy to expect of |
distanceKm (optional) | number | undefined | Kilometres, for |
distanceAu (optional) | number | undefined | Astronomical units, for |
uncertaintyKm (optional) | number | undefined | The accuracy to expect of |
uncertaintySeconds | number | How far the moment may be off, in seconds: the position's accuracy over how fast the two move past each other. |
atEdge | boolean | True when the smallest separation in the span is at its start or end, not a minimum inside it. |
Examples
import { closestApproach, type Approach } from "@johnmorrisdotca/wakusei-planets/nearest";
const found: Approach = closestApproach("jupiter", "saturn", { from: Date.UTC(2020, 11, 1), to: Date.UTC(2021, 0, 1) });
console.log(found.time.toISOString(), found.angle?.toFixed(2));2020-12-21T18:25:35.939Z 0.10What it prints (run when this page was built)