Reference · Journey mode: transfers, launch windows and flip-and-burn trips
windowsfunction
The next dates a craft can leave one planet for another on a Hohmann transfer: the days on which the destination will be where the craft arrives. Found by scanning day by day and bisecting each crossing, from the planets' real positions.
Import it
import { windows } from "@johnmorrisdotca/uchusen-rockets/journey";
Definition
function windows(source: BodySource, from: string, to: string, afterMs: number, count: number): Window[]
Parameters
| Name | Type | Description |
|---|---|---|
source | BodySource | Where the planets are. |
from | string | The starting planet's id. |
to | string | The destination planet's id. |
afterMs | number | The earliest date, milliseconds since 1970. |
count | number | How many windows. |
Returns
Window[]
The windows, soonest first.
Examples
import { windows, type BodySource } from "@johnmorrisdotca/uchusen-rockets/journey";
declare const source: BodySource;
console.log(windows(source, "earth", "mars", Date.UTC(2026, 10, 4), 2).map((one) => new Date(one.dateMs).toISOString().slice(0, 10)));