/** * A position or direction as `[x, y, z]`, in the scene's axes (x toward the vernal equinox, y north). * * @example * ```ts * import type { Vec3 } from "@johnmorrisdotca/chikyu-earth/space"; * * const origin: Vec3 = [0, 0, 0]; * console.log(origin); * ``` */ export type Vec3 = [number, number, number]; /** * The planets drawn, nearest the Sun first. * * @example * ```ts * import { PLANETS } from "@johnmorrisdotca/chikyu-earth/space"; * * console.log(PLANETS.join(", ")); * ``` */ export declare const PLANETS: readonly ["Mercury", "Venus", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto"]; /** * One of the planets drawn (Pluto too), by name. * * @example * ```ts * import { orbitPath, type PlanetName } from "@johnmorrisdotca/chikyu-earth/space"; * * const planet: PlanetName = "Mars"; * console.log(orbitPath(planet, Date.UTC(2026, 10, 2), 8).length); * ``` */ export type PlanetName = (typeof PLANETS)[number]; /** * Where everything is at one moment: positions in astronomical units from the Earth's centre, in scene axes (x to the vernal equinox, y north, z toward -y of the equator). * * @example * ```ts * import { frameAt, type Frame } from "@johnmorrisdotca/chikyu-earth/space"; * * const frame: Frame = frameAt(Date.UTC(2026, 10, 2, 12)); * console.log(Object.keys(frame.planets).length, frame.spin.toFixed(0)); * ``` */ export interface Frame { ms: number; sun: Vec3; moon: Vec3; planets: Record; /** Greenwich sidereal time, in degrees: how far the Earth has turned against the stars. */ spin: number; } /** * The Earth's radius in kilometres, the unit of the scene's distances. * * @example * ```ts * import { EARTH_RADIUS_KM } from "@johnmorrisdotca/chikyu-earth/space"; * * console.log(EARTH_RADIUS_KM); * ``` */ export declare const EARTH_RADIUS_KM = 6371; /** * Earth radii in one astronomical unit. * * @example * ```ts * import { AU_IN_EARTH_RADII } from "@johnmorrisdotca/chikyu-earth/space"; * * console.log(Math.round(AU_IN_EARTH_RADII)); * ``` */ export declare const AU_IN_EARTH_RADII: number; /** * The state of the sky at `ms`: nine vectors and an angle, in a few tenths of a millisecond. It needs astronomy-engine (an optional peer dependency). * * @param ms - A moment, in milliseconds since the Unix epoch. * @returns The Sun, the Moon and the planets as seen from the Earth's centre, and how far the Earth has turned. * * @example * ```ts * import { frameAt } from "@johnmorrisdotca/chikyu-earth/space"; * * const frame = frameAt(Date.UTC(2026, 10, 2, 12)); * console.log(frame.moon.map((n) => n.toFixed(4))); * ``` */ export declare function frameAt(ms: number): Frame; /** * A frame between two others, `t` from 0 to 1. The spin advances by how far the Earth turns in that time, so a step of a second takes the short way and a step of a day is a full turn. * * @param a - The earlier frame. * @param b - The later frame. * @param t - How far from `a` to `b`, from 0 to 1. * @returns The frame at that fraction. * * @example * ```ts * import { blend, frameAt } from "@johnmorrisdotca/chikyu-earth/space"; * * const start = Date.UTC(2026, 10, 2); * const middle = blend(frameAt(start), frameAt(start + 1000), 0.5); * console.log(middle.ms - start); * ``` */ export declare function blend(a: Frame, b: Frame, t: number): Frame; /** * Answers for any moment from two real ones: `at(ms)` asks astronomy-engine only when `ms` leaves the span the last two answers cover, and then looks * `stepMs` ahead, so playing time at a steady rate costs one pair of lookups every `stepMs` and every draw in between is arithmetic. * * @param initialStepMs - How far ahead the second answer looks, in milliseconds. * @returns A track: `at(ms)` for a frame, `lookups` for how many times the ephemeris was asked, `ends()` for the two answers it is between (undefined before the first `at`), `reset()` and `setStep(ms)`. * * @example * ```ts * import { createTrack } from "@johnmorrisdotca/chikyu-earth/space"; * * const track = createTrack(1000); * const start = Date.UTC(2026, 10, 2); * for (let step = 0; step < 10; step += 1) track.at(start + step * 50); * console.log(track.lookups); * ``` */ export declare function createTrack(initialStepMs?: number): { at(ms: number): Frame; /** The two answers the track is between now (undefined before the first), for working out which way something is going. */ ends(): [Frame, Frame] | undefined; /** How many times astronomy-engine has been asked for a frame. */ readonly lookups: number; reset(): void; /** Look further ahead (a faster game clock): the next lookup uses it. */ setStep(ms: number): void; }; /** The path a planet takes round the Sun, as `count` points around the orbit that starts where the planet is at `ms`, relative to the Sun (scene axes, AU). * * @param name - The planet. * @param ms - The moment the orbit starts at, in milliseconds since the Unix epoch. * @param count - How many segments to cut the orbit into. * @returns `count + 1` points, the last on the first. * * @example * ```ts * import { orbitPath } from "@johnmorrisdotca/chikyu-earth/space"; * * const points = orbitPath("Jupiter", Date.UTC(2026, 10, 2), 12); * console.log(points.length); * ``` */ export declare function orbitPath(name: PlanetName, ms: number, count?: number): Vec3[]; /** The Earth's own place relative to the Sun, for placing the orbits round the Sun's place in the Earth-centred scene. */