astraeus 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +80 -0
- package/README.md +46 -17
- package/data/ephemerides/planets/planets.json +1 -1
- package/package.json +1 -1
- package/src/api/AstraeusScene.d.ts +1 -1
- package/src/api/AstraeusScene.js +4 -1
- package/src/api/AstraeusScene.node.js +4 -1
- package/src/api/assembleScene.d.ts +2 -0
- package/src/api/assembleScene.js +27 -5
- package/src/api/cameraRequest.d.ts +15 -0
- package/src/api/cameraRequest.js +89 -0
- package/src/api/errors.d.ts +10 -0
- package/src/api/index.d.ts +6 -3
- package/src/api/look.d.ts +49 -0
- package/src/api/lookInput.d.ts +1 -1
- package/src/api/lookInput.js +6 -1
- package/src/api/planCamera.d.ts +35 -7
- package/src/api/planCamera.js +94 -11
- package/src/api/planSkyFigures.d.ts +22 -0
- package/src/api/planSkyFigures.js +145 -0
- package/src/api/planStory.d.ts +2 -2
- package/src/api/planStory.js +14 -9
- package/src/api/planViews.js +1 -1
- package/src/api/scene.d.ts +17 -4
- package/src/api/scene.js +23 -5
- package/src/api/sceneReads.d.ts +21 -2
- package/src/api/skyFigureInput.d.ts +45 -0
- package/src/api/skyFigureInput.js +1 -0
- package/src/api/skyTraceInput.d.ts +33 -0
- package/src/api/skyTraceInput.js +45 -0
- package/src/api/story.d.ts +12 -3
- package/src/api/story.js +44 -1
- package/src/api/viewerCamera.d.ts +4 -3
- package/src/api/viewerCamera.js +10 -32
- package/src/api/viewerHandle.d.ts +34 -5
- package/src/api/viewerHandle.js +7 -0
- package/src/api/viewerLink.d.ts +50 -4
- package/src/api/viewerLink.js +33 -2
- package/src/api/viewerPanels.d.ts +26 -0
- package/src/api/viewerPanels.js +42 -0
- package/src/api/viewerSelection.d.ts +6 -1
- package/src/api/viewerSelection.js +15 -0
- package/src/api/views.d.ts +3 -1
- package/src/api/views.js +5 -1
- package/src/app/App.js +118 -16
- package/src/app/App.node.js +118 -16
- package/src/app/AstraeusScene.d.ts +22 -5
- package/src/app/AstraeusScene.js +3 -3
- package/src/app/CameraController.d.ts +17 -0
- package/src/app/CameraController.js +34 -9
- package/src/app/DeveloperSettings.d.ts +11 -3
- package/src/app/DeveloperSettings.js +13 -3
- package/src/app/SceneLabels.d.ts +20 -2
- package/src/app/SceneLabels.js +46 -6
- package/src/app/SkyFiguresView.d.ts +56 -0
- package/src/app/SkyFiguresView.js +242 -0
- package/src/app/StoryMarkers.d.ts +2 -2
- package/src/app/StoryMarkers.js +2 -2
- package/src/app/displaySwitches.d.ts +13 -3
- package/src/app/displaySwitches.js +17 -3
- package/src/app/experienceDefinition.d.ts +9 -3
- package/src/app/experienceDefinition.js +4 -2
- package/src/app/labelStyle.d.ts +17 -0
- package/src/app/labelStyle.js +13 -0
- package/src/app/liveLook.js +8 -0
- package/src/app/look.d.ts +9 -5
- package/src/app/look.js +11 -0
- package/src/app/lookOut.d.ts +32 -0
- package/src/app/lookOut.js +50 -0
- package/src/app/sceneCamera.d.ts +7 -3
- package/src/app/sceneCamera.js +68 -4
- package/src/app/sceneContentsHooks.d.ts +2 -1
- package/src/app/sceneContentsHooks.js +3 -2
- package/src/app/sceneFrame.d.ts +10 -1
- package/src/app/sceneFrame.js +45 -10
- package/src/app/sceneFraming.d.ts +7 -0
- package/src/app/sceneFraming.js +12 -0
- package/src/app/sceneHooks.d.ts +2 -0
- package/src/app/sceneHooks.js +4 -1
- package/src/app/scenePicking.d.ts +20 -0
- package/src/app/scenePicking.js +49 -0
- package/src/app/scenePointer.d.ts +3 -1
- package/src/app/scenePointer.js +3 -2
- package/src/app/skyFigures.d.ts +73 -0
- package/src/app/skyFigures.js +50 -0
- package/src/app/style.css +2 -1
- package/src/app/viewHiding.d.ts +2 -0
- package/src/app/viewHiding.js +7 -1
- package/src/app/viewLink.d.ts +8 -8
- package/src/app/viewLink.js +24 -4
- package/src/app/viewerPort.d.ts +32 -3
- package/src/app/views.d.ts +2 -0
- package/src/assets/sky.d.ts +13 -4
- package/src/assets/sky.js +33 -8
- package/src/assets/stars/hyg-v42-naked-eye.json +1 -1
- package/src/core/astronomyAdapter.d.ts +1 -1
- package/src/core/astronomyAdapter.js +3 -3
- package/src/core/bodies/index.js +13 -12
- package/src/core/bodies/jupiter.js +1 -1
- package/src/core/bodies/mars.js +1 -1
- package/src/core/bodies/mercury.js +1 -1
- package/src/core/bodies/moonSystem.js +1 -15
- package/src/core/bodies/outerPlanets.d.ts +2 -3
- package/src/core/bodies/outerPlanets.js +4 -13
- package/src/core/bodies/planetMoons.d.ts +0 -2
- package/src/core/bodies/planetMoons.js +1 -18
- package/src/core/bodies/planetRecords.d.ts +8 -2
- package/src/core/bodies/planetRecords.js +13 -5
- package/src/core/bodies/planetTrajectory.d.ts +21 -4
- package/src/core/bodies/planetTrajectory.js +28 -4
- package/src/core/bodies/venus.js +1 -1
- package/src/core/lookValues.d.ts +9 -0
- package/src/core/lookValues.js +24 -0
- package/src/core/planetModels.d.ts +1 -1
- package/src/core/planetModels.js +1 -1
- package/src/core/planetSeries.d.ts +2 -2
- package/src/core/planetSeries.js +1 -1
- package/src/core/readBytes.d.ts +1 -0
- package/src/core/readBytes.js +15 -0
- package/src/core/skyTrace.d.ts +49 -0
- package/src/core/skyTrace.js +39 -0
- package/src/core/startView.d.ts +39 -0
- package/src/core/startView.js +56 -0
- package/src/core/storyPanels.d.ts +51 -3
- package/src/core/storyPanels.js +52 -12
- package/src/shell/AstraeusShell.d.ts +27 -6
- package/src/shell/AstraeusShell.js +104 -18
- package/src/shell/AstraeusShell.node.js +104 -18
- package/src/shell/ObjectControls.js +11 -8
- package/src/shell/StoryPanelView.d.ts +12 -3
- package/src/shell/StoryPanelView.js +2 -2
- package/src/shell/experience.d.ts +24 -0
- package/src/shell/experience.js +4 -1
- package/src/shell/infoModel.js +9 -1
- package/src/shell/objectModel.d.ts +6 -2
- package/src/shell/objectModel.js +10 -1
- package/src/shell/phone.css +1 -1
- package/src/shell/storyPanels.d.ts +1 -1
- package/src/shell/storyPanels.js +1 -1
- package/src/shell/style.css +9 -1
- package/src/shell/topBarIcons.d.ts +1 -0
- package/src/shell/topBarIcons.js +1 -0
- package/src/shell/useStoryPanels.d.ts +9 -6
- package/src/shell/useStoryPanels.js +10 -6
|
@@ -5,7 +5,7 @@ export interface AstronomyAdapter {
|
|
|
5
5
|
earthPositionFromSunKm(timeUtcMs: number): Float64Array;
|
|
6
6
|
sunPositionFromEarthKm(timeUtcMs: number): Float64Array;
|
|
7
7
|
earthFixedToEqjMatrix(timeUtcMs: number): Float64Array;
|
|
8
|
-
/** Planet
|
|
8
|
+
/** Planet system barycentre about the Sun in EQJ km (the planet series, JPL Horizons); throws for a planet the adapter has no model for. */
|
|
9
9
|
planetPositionFromSunKm(planet: PlanetId, timeUtcMs: number): Float64Array;
|
|
10
10
|
/** Days of terrestrial time since J2000 (JD 2451545.0 TT), the epoch the IAU rotation models count from. */
|
|
11
11
|
daysSinceJ2000Tt(timeUtcMs: number): number;
|
|
@@ -61,7 +61,7 @@ export function createOrbAstronomyAdapter() {
|
|
|
61
61
|
const model = planetModels()[planet];
|
|
62
62
|
const ecliptic = model.xyz(new Date(timeUtcMs));
|
|
63
63
|
if (ecliptic.coordinate_keywords !== "ecliptic rectangular j2000" || ecliptic.unit_keywords !== "au") {
|
|
64
|
-
throw new TypeError("
|
|
64
|
+
throw new TypeError("the planet series result changed its heliocentric ecliptic-J2000 au contract (JPL Horizons fit)");
|
|
65
65
|
}
|
|
66
66
|
const state = makeState({
|
|
67
67
|
t: instant,
|
|
@@ -71,8 +71,8 @@ export function createOrbAstronomyAdapter() {
|
|
|
71
71
|
});
|
|
72
72
|
const eqj = transform(state, { frame: "equatorial-j2000" });
|
|
73
73
|
if (eqj.center !== "sun")
|
|
74
|
-
throw new TypeError("Orb
|
|
75
|
-
return finiteVector(eqj.r, `${planet}
|
|
74
|
+
throw new TypeError("Orb ecliptic-to-equatorial transform of the planet series changed its center");
|
|
75
|
+
return finiteVector(eqj.r, `${planet} Horizons planet series`);
|
|
76
76
|
},
|
|
77
77
|
daysSinceJ2000Tt(timeUtcMs) {
|
|
78
78
|
const [jd1, jd2] = instantAt(timeUtcMs).jd2parts("tt");
|
package/src/core/bodies/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { MoonTrajectory } from "../moonTrajectory.js";
|
|
2
|
-
import {
|
|
2
|
+
import { planetBinding } from "./planetTrajectory.js";
|
|
3
3
|
import { createEarthSunTrajectory } from "../sunCentredSources.js";
|
|
4
4
|
import { EARTH } from "./earth.js";
|
|
5
5
|
import { MOON } from "./moon.js";
|
|
6
6
|
import { IO, IO_BINDING } from "./io.js";
|
|
7
|
-
import { CALLISTO, EUROPA, GANYMEDE, MAPPED_MOON_BINDINGS } from "./jupiterMoons.js";
|
|
7
|
+
import { CALLISTO, EUROPA, GANYMEDE, JUPITER_MOON_SYSTEM, MAPPED_MOON_BINDINGS } from "./jupiterMoons.js";
|
|
8
8
|
import { JUPITER, JUPITER_ROTATION } from "./jupiter.js";
|
|
9
9
|
import { MARS, MARS_ROTATION } from "./mars.js";
|
|
10
10
|
import { MERCURY, MERCURY_ROTATION } from "./mercury.js";
|
|
11
|
-
import { NEPTUNE, NEPTUNE_ROTATION, PLUTO, SATURN, SATURN_ROTATION, URANUS, URANUS_ROTATION } from "./outerPlanets.js";
|
|
12
|
-
import { PLANET_MOON_BINDINGS, PLANET_MOON_DEFINITIONS,
|
|
11
|
+
import { NEPTUNE, NEPTUNE_ROTATION, PLUTO, PLUTO_ROTATION, SATURN, SATURN_ROTATION, URANUS, URANUS_ROTATION } from "./outerPlanets.js";
|
|
12
|
+
import { MARS_MOON_SYSTEM, NEPTUNE_MOON_SYSTEM, PLANET_MOON_BINDINGS, PLANET_MOON_DEFINITIONS, PLUTO_MOON_SYSTEM, SATURN_MOON_SYSTEM, URANUS_MOON_SYSTEM } from "./planetMoons.js";
|
|
13
13
|
import { SUN } from "./sun.js";
|
|
14
14
|
import { VENUS, VENUS_ROTATION } from "./venus.js";
|
|
15
15
|
export { EARTH, EARTH_EPHEMERIS } from "./earth.js";
|
|
@@ -28,14 +28,15 @@ export const BUILT_IN_BODIES = Object.freeze([SUN, EARTH, MOON, MERCURY, VENUS,
|
|
|
28
28
|
export const BUILT_IN_BINDINGS = Object.freeze([
|
|
29
29
|
Object.freeze({ body: EARTH.id, create: createEarthSunTrajectory }),
|
|
30
30
|
Object.freeze({ body: MOON.id, create: (adapter) => new MoonTrajectory(adapter) }),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
// Each planet is its system barycentre plus, with its moon system loaded, its own offset from it (O-063 T-290).
|
|
32
|
+
planetBinding("mercury", MERCURY_ROTATION),
|
|
33
|
+
planetBinding("venus", VENUS_ROTATION),
|
|
34
|
+
planetBinding("mars", MARS_ROTATION, MARS_MOON_SYSTEM),
|
|
35
|
+
planetBinding("jupiter", JUPITER_ROTATION, JUPITER_MOON_SYSTEM),
|
|
36
|
+
planetBinding("saturn", SATURN_ROTATION, SATURN_MOON_SYSTEM),
|
|
37
|
+
planetBinding("uranus", URANUS_ROTATION, URANUS_MOON_SYSTEM),
|
|
38
|
+
planetBinding("neptune", NEPTUNE_ROTATION, NEPTUNE_MOON_SYSTEM),
|
|
39
|
+
planetBinding("pluto", PLUTO_ROTATION, PLUTO_MOON_SYSTEM),
|
|
39
40
|
IO_BINDING,
|
|
40
41
|
...MAPPED_MOON_BINDINGS,
|
|
41
42
|
...PLANET_MOON_BINDINGS,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createProvenance } from "../provenance.js";
|
|
2
2
|
import { IAU_REPORT, PLANET_VALIDATED_UTC, planetEphemeris, ROTATION_LIMITATION } from "./planetRecords.js";
|
|
3
|
-
export const JUPITER_EPHEMERIS = planetEphemeris("Jupiter", "
|
|
3
|
+
export const JUPITER_EPHEMERIS = planetEphemeris("Jupiter", "599", "DE441 with the Jupiter satellite ephemeris jup365_merged", "With the Jupiter moon package loaded (it covers 1950 to 2029), within 0.5 km of Horizons' Jupiter on 2 January of each year 1972 to 2029 and 0.22 to 0.24 km at the Voyager 1 and 2 closest approaches (O-063 T-290).", "Until the Jupiter moon package is loaded for the date Jupiter sits at its system barycentre, up to 216 km from its centre (measured 1972 to 2044).");
|
|
4
4
|
/** Jupiter pole and prime meridian from the IAU 2015 report: degrees, pole per Julian century, W per day, from J2000 TDB. */
|
|
5
5
|
export const JUPITER_ROTATION = Object.freeze({
|
|
6
6
|
poleRaDeg: [268.056595, -0.006499],
|
package/src/core/bodies/mars.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createProvenance } from "../provenance.js";
|
|
2
2
|
import { IAU_REPORT, PLANET_VALIDATED_UTC, planetEphemeris, ROTATION_LIMITATION } from "./planetRecords.js";
|
|
3
|
-
export const MARS_EPHEMERIS = planetEphemeris("Mars", "
|
|
3
|
+
export const MARS_EPHEMERIS = planetEphemeris("Mars", "499", "DE441 with the Mars satellite ephemeris mar099", "Within 0.6 km of Horizons' Mars on 2 January of each year 1972 to 2044, with or without the Mars moon package (O-063 T-290).", "Until the Mars moon package is loaded (it covers 2010 to 2029) Mars sits at its system barycentre, under a metre from its centre.");
|
|
4
4
|
/** Mars pole and prime meridian from the IAU 2015 report: degrees, pole per Julian century, W per day, from J2000 TDB. */
|
|
5
5
|
export const MARS_ROTATION = Object.freeze({
|
|
6
6
|
poleRaDeg: [317.269202, -0.10927547],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createProvenance } from "../provenance.js";
|
|
2
2
|
import { IAU_REPORT, PLANET_VALIDATED_UTC, planetEphemeris, ROTATION_LIMITATION } from "./planetRecords.js";
|
|
3
|
-
export const MERCURY_EPHEMERIS = planetEphemeris("Mercury", "
|
|
3
|
+
export const MERCURY_EPHEMERIS = planetEphemeris("Mercury", "199", "DE441 (Mercury has no moons: its barycentre, 1, is the planet)", "Within 0.4 km of Horizons' Mercury on 2 January of each year 1972 to 2044 (O-063 T-290); the fit is within 0.62 km of Horizons at independent dates 1950 to 2045.");
|
|
4
4
|
/** Mercury pole and prime meridian from the IAU 2015 report: degrees, pole per Julian century, W per day, from J2000 TDB. */
|
|
5
5
|
export const MERCURY_ROTATION = Object.freeze({
|
|
6
6
|
poleRaDeg: [281.0103, -0.0328],
|
|
@@ -3,6 +3,7 @@ import { ChebyshevEphemeris, parseEphemerisIndex } from "../chebyshevEphemeris.j
|
|
|
3
3
|
import { iauOrientation } from "../iauRotation.js";
|
|
4
4
|
import { periodAboutBalanceS } from "../orbitPeriod.js";
|
|
5
5
|
import { NotLoadedError } from "../planetSeries.js";
|
|
6
|
+
import { fetchBytesOf } from "../readBytes.js";
|
|
6
7
|
import { createProvenance } from "../provenance.js";
|
|
7
8
|
import { assertUtcUnixMs, createState } from "../state.js";
|
|
8
9
|
/** The span the committed fits cover (T-096, T-114: 2010-01-01 to 2030-01-01 TDB, chunked per calendar year; the same for every system). */
|
|
@@ -53,21 +54,6 @@ const HISTORY_MARGIN = 1.05;
|
|
|
53
54
|
const DECODE_SLICE_MS = 8;
|
|
54
55
|
/** Half the time step (s) the orbit-derived tidal-lock orientation looks along the orbit, as Io's mean-element orientation did. */
|
|
55
56
|
const ORIENTATION_STEP_S = 1800;
|
|
56
|
-
/** Reads a `file:` address with Node's own module (found at run time, so a browser bundle never resolves it); Node's `fetch` does not serve `file:`. */
|
|
57
|
-
async function readFileUrl(url) {
|
|
58
|
-
const nodeFs = globalThis.process?.getBuiltinModule?.("node:fs/promises");
|
|
59
|
-
if (nodeFs === undefined)
|
|
60
|
-
throw new Error(`moon fit chunk ${url}: this runtime cannot read a file: address`);
|
|
61
|
-
return new Uint8Array(await nodeFs.readFile(new URL(url)));
|
|
62
|
-
}
|
|
63
|
-
const fetchBytesOf = async (url) => {
|
|
64
|
-
if (url.startsWith("file:"))
|
|
65
|
-
return readFileUrl(url);
|
|
66
|
-
const response = await fetch(url);
|
|
67
|
-
if (!response.ok)
|
|
68
|
-
throw new Error(`moon fit chunk ${url}: HTTP ${response.status}`);
|
|
69
|
-
return new Uint8Array(await response.arrayBuffer());
|
|
70
|
-
};
|
|
71
57
|
export function createMoonSystem(config) {
|
|
72
58
|
let installed = null;
|
|
73
59
|
let loadIndex = config.loadIndex;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Saturn, Uranus, Neptune and Pluto (O-033 T-116): defined once here, placed Sun-centred from the planet curve fits (`data/ephemerides/planets/`,
|
|
3
|
-
*
|
|
3
|
+
* each the system barycentre as JPL Horizons reports the planet, O-063 T-290), turned by the IAU pole and prime meridian. Their radii and
|
|
4
4
|
* gravitational parameters are the Horizons physical-data headers saved in each system's moon index (`data/ephemerides/<planet>-moons/index.json`).
|
|
5
|
-
*
|
|
5
|
+
* Each is placed at the system barycentre plus its own offset when its moon system is loaded: that binding is `planetBinding` in `planetTrajectory.ts`.
|
|
6
6
|
*/
|
|
7
7
|
import type { CelestialBodyDefinition, EphemerisRecord } from "../body.js";
|
|
8
8
|
import type { IauRotationElements } from "../iauRotation.js";
|
|
@@ -14,7 +14,6 @@ export declare const PLUTO_ROTATION: IauRotationElements;
|
|
|
14
14
|
export declare const SATURN_EPHEMERIS: EphemerisRecord;
|
|
15
15
|
export declare const URANUS_EPHEMERIS: EphemerisRecord;
|
|
16
16
|
export declare const NEPTUNE_EPHEMERIS: EphemerisRecord;
|
|
17
|
-
/** Pluto has no VSOP87 series: its barycentre is a curve fit of Horizons states (T-114, T-116), and its own wobble about it comes from its system's fits. */
|
|
18
17
|
export declare const PLUTO_EPHEMERIS: EphemerisRecord;
|
|
19
18
|
export declare const SATURN: CelestialBodyDefinition;
|
|
20
19
|
export declare const URANUS: CelestialBodyDefinition;
|
|
@@ -30,19 +30,10 @@ export const SATURN_ROTATION = Object.freeze({ poleRaDeg: [40.589, -0.036], pole
|
|
|
30
30
|
export const URANUS_ROTATION = Object.freeze({ poleRaDeg: [257.311, 0], poleDecDeg: [-15.175, 0], primeMeridianDeg: [203.81, -501.1600928], citation: IAU_REPORT });
|
|
31
31
|
export const NEPTUNE_ROTATION = Object.freeze({ poleRaDeg: [299.36, 0], poleDecDeg: [43.46, 0], primeMeridianDeg: [249.978, 541.1397757], citation: IAU_REPORT });
|
|
32
32
|
export const PLUTO_ROTATION = Object.freeze({ poleRaDeg: [132.993, 0], poleDecDeg: [-6.163, 0], primeMeridianDeg: [302.695, 56.3625225], citation: IAU_REPORT });
|
|
33
|
-
export const SATURN_EPHEMERIS = planetEphemeris("Saturn", "
|
|
34
|
-
export const URANUS_EPHEMERIS = planetEphemeris("Uranus", "
|
|
35
|
-
export const NEPTUNE_EPHEMERIS = planetEphemeris("Neptune", "
|
|
36
|
-
|
|
37
|
-
export const PLUTO_EPHEMERIS = {
|
|
38
|
-
provenance: createProvenance({
|
|
39
|
-
sourceType: "ephemeris",
|
|
40
|
-
sources: ["JPL Horizons API 1.2 (https://ssd.jpl.nasa.gov/api/horizons.api), COMMAND=9 (Pluto system barycentre) CENTER=500@10, VECTORS geometric ICRF km TDB, fetched 2026-10-20, fitted as piecewise Chebyshev series (tools/import/planet-fits.mjs); US Government work, credit NASA/JPL-Caltech Solar System Dynamics"],
|
|
41
|
-
accuracy: "The system barycentre reproduces Horizons within 1 km at independent dates 1950 to 2045. Pluto's centre is that point plus its own offset from the system's fits (within a metre 2010 to 2030); with the system not loaded Pluto is drawn at the barycentre, up to about 2,100 km from its centre.",
|
|
42
|
-
notes: "Geometric position about the Sun's centre; no light-time or aberration.",
|
|
43
|
-
}),
|
|
44
|
-
knownLimitations: ["No velocity is modelled for planets, so they have no speed readout.", "Until Pluto's system fits are loaded Pluto sits at the system barycentre, up to about 2,100 km from its centre."],
|
|
45
|
-
};
|
|
33
|
+
export const SATURN_EPHEMERIS = planetEphemeris("Saturn", "699", "DE441 with the Saturn satellite ephemeris sat441l", "With the Saturn moon package loaded (it covers 1950 to 2029), within 0.5 km of Horizons' Saturn on 2 January of each year 1972 to 2029 and 0.11 to 0.31 km at the Voyager 1 and 2 closest approaches (O-063 T-290).", "Until the Saturn moon package is loaded for the date Saturn sits at its system barycentre, up to 304 km from its centre (measured 1972 to 2044).");
|
|
34
|
+
export const URANUS_EPHEMERIS = planetEphemeris("Uranus", "799", "DE441 with the Uranus satellite ephemeris ura184_merged, whose system barycentre differs from DE441's barycentre body 7 by up to about 3,400 km away from the 1986 Voyager 2 encounter; the series follows Horizons' Uranus", "With the Uranus moon package loaded (it covers 1950 to 2029), within 0.6 km of Horizons' Uranus on 2 January of each year 1972 to 2029 and 0.20 km at Voyager 2's closest approach (O-063 T-290).", "Until the Uranus moon package is loaded for the date Uranus sits at its system barycentre, up to 45 km from its centre (measured 1972 to 2044).");
|
|
35
|
+
export const NEPTUNE_EPHEMERIS = planetEphemeris("Neptune", "899", "DE441 with the Neptune satellite ephemeris nep098_merged, whose system barycentre differs from DE441's barycentre body 8 by up to about 740 km away from the 1989 Voyager 2 encounter; the series follows Horizons' Neptune", "With the Neptune moon package loaded (it covers 1950 to 2029), within 0.5 km of Horizons' Neptune on 2 January of each year 1972 to 2029 and 0.27 km at Voyager 2's closest approach (O-063 T-290).", "Until the Neptune moon package is loaded for the date Neptune sits at its system barycentre, up to 74 km from its centre (measured 1972 to 2044).");
|
|
36
|
+
export const PLUTO_EPHEMERIS = planetEphemeris("Pluto", "999", "DE441 with the Pluto satellite ephemeris plu060_merged (whose barycentre agrees with DE441's body 9: the fit's bytes are the same as T-116's fit of body 9)", "With the Pluto moon package loaded (it covers 2010 to 2029), within 1.5 km of Horizons' Pluto at the archived dates 2010 to 2030 (tests/planetMoonSystems.test.ts); the barycentre fit is within 0.79 km of Horizons at independent dates 1950 to 2045.", "Until Pluto's moon package is loaded for the date Pluto sits at its system barycentre, up to about 2,100 km from its centre.");
|
|
46
37
|
export const SATURN = giantPlanet("saturn", "Saturn", { mean: 58232, equatorial: 60268, polar: 54364 }, 37_931_206.234, { radius: "Equat. radius (1 bar) = 60268+-4 km, Polar radius (km) = 54364+-10, Vol. Mean Radius (km) = 58232+-6", gm: "GM (km^3/s^2) = 37931206.234" }, SATURN_EPHEMERIS, [GAS_BAND("Saturn")]);
|
|
47
38
|
export const URANUS = giantPlanet("uranus", "Uranus", { mean: 25362, equatorial: 25559, polar: 24973 }, 5_793_950.6103, { radius: "Equat. radius (1 bar) = 25559+-4 km, Polar radius (km) = 24973+-20, Vol. Mean Radius (km) = 25362+-12", gm: "GM (km^3/s^2) = 5793950.6103" }, URANUS_EPHEMERIS, [GAS_BAND("Uranus")]);
|
|
48
39
|
export const NEPTUNE = giantPlanet("neptune", "Neptune", { mean: 24624, equatorial: 24766, polar: 24342 }, 6_835_099.97, { radius: "Equat. radius (1 bar) = 24766+-15 km, Polar radius (km) = 24342+-30, Vol. mean radius (km) = 24624+-21", gm: "GM (km^3/s^2) = 6835099.97" }, NEPTUNE_EPHEMERIS, [GAS_BAND("Neptune")]);
|
|
@@ -24,5 +24,3 @@ export declare const CHARON: import("../body.js").CelestialBodyDefinition;
|
|
|
24
24
|
/** The mapped moons by system, in the order the moon lists give them. */
|
|
25
25
|
export declare const PLANET_MOON_DEFINITIONS: readonly import("../body.js").CelestialBodyDefinition[];
|
|
26
26
|
export declare const PLANET_MOON_BINDINGS: readonly StateSourceBinding[];
|
|
27
|
-
/** Pluto: the planet fits give the system barycentre; its own offset is added once its system's fits are loaded. */
|
|
28
|
-
export declare const PLUTO_BINDING: StateSourceBinding;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { iauElementsFromRecord } from "../iauRotation.js";
|
|
2
2
|
import { recordPeriodDays } from "../siderealPeriod.js";
|
|
3
|
-
import { createPlanetSunTrajectory } from "./planetTrajectory.js";
|
|
4
3
|
import { MARS } from "./mars.js";
|
|
5
4
|
import { createMoonSystem, HISTORICAL_MOON_FIT_SPAN, moonFitSource } from "./moonSystem.js";
|
|
6
|
-
import { NEPTUNE, PLUTO,
|
|
5
|
+
import { NEPTUNE, PLUTO, SATURN, URANUS } from "./outerPlanets.js";
|
|
7
6
|
import charonOrbit from "../../../data/orbits/charon.json" with { type: "json" };
|
|
8
7
|
import dioneOrbit from "../../../data/orbits/dione.json" with { type: "json" };
|
|
9
8
|
import enceladusOrbit from "../../../data/orbits/enceladus.json" with { type: "json" };
|
|
@@ -60,19 +59,3 @@ export const PLANET_MOON_BINDINGS = Object.freeze([
|
|
|
60
59
|
NEPTUNE_MOON_SYSTEM.binding(TRITON.id, iauElementsFromRecord(tritonOrbit.rotation)),
|
|
61
60
|
PLUTO_MOON_SYSTEM.binding(CHARON.id, iauElementsFromRecord(charonOrbit.rotation)),
|
|
62
61
|
]);
|
|
63
|
-
/**
|
|
64
|
-
* Pluto's own offset from the system barycentre at `timeUtcMs`, from its system's centre series, or null while the system is not loaded or the
|
|
65
|
-
* time lies outside the loaded chunks (Pluto then stays at the barycentre, which its position record says).
|
|
66
|
-
*/
|
|
67
|
-
function plutoOffsetKm(timeUtcMs) {
|
|
68
|
-
if (!PLUTO_MOON_SYSTEM.isLoaded())
|
|
69
|
-
return null;
|
|
70
|
-
try {
|
|
71
|
-
return PLUTO_MOON_SYSTEM.ephemeris().centreOffsetKm(timeUtcMs);
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
/** Pluto: the planet fits give the system barycentre; its own offset is added once its system's fits are loaded. */
|
|
78
|
-
export const PLUTO_BINDING = Object.freeze({ body: PLUTO.id, create: (adapter) => createPlanetSunTrajectory("pluto", PLUTO_ROTATION, adapter, plutoOffsetKm) });
|
|
@@ -4,5 +4,11 @@ import type { TimeBounds } from "../trajectory.js";
|
|
|
4
4
|
export declare const PLANET_VALIDATED_UTC: TimeBounds;
|
|
5
5
|
export declare const IAU_REPORT = "Archinal et al., Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2015, Celestial Mechanics and Dynamical Astronomy 130, article 22 (2018), as transcribed in NAIF pck00011.tpc (2022-12-27)";
|
|
6
6
|
export declare const ROTATION_LIMITATION = "Orientation is the IAU pole direction (linear in time) and prime meridian (linear in time) only; the report's periodic nutation and libration terms are left out, and TT stands in for TDB.";
|
|
7
|
-
/**
|
|
8
|
-
export declare
|
|
7
|
+
/** The date the Horizons states behind the planet series were retrieved (O-063 T-290). */
|
|
8
|
+
export declare const PLANET_SERIES_RETRIEVED = "2026-11-10";
|
|
9
|
+
/**
|
|
10
|
+
* Position provenance shared by the planets (O-063 T-290): the series is the planet's system barycentre as JPL Horizons reports the planet, and a
|
|
11
|
+
* planet with a moon system adds its own offset from that barycentre from its moon package when that is loaded. `body` names the Horizons
|
|
12
|
+
* target, `centreSource` how Horizons places it, `measured` the figures against Horizons, `withoutPackage` what changes without the package.
|
|
13
|
+
*/
|
|
14
|
+
export declare function planetEphemeris(label: string, body: string, centreSource: string, measured: string, withoutPackage?: string): EphemerisRecord;
|
|
@@ -3,17 +3,25 @@ import { createProvenance } from "../provenance.js";
|
|
|
3
3
|
export const PLANET_VALIDATED_UTC = Object.freeze({ startUtcMs: Date.UTC(1969, 6, 21), endUtcMs: Date.UTC(2030, 5, 1) });
|
|
4
4
|
export const IAU_REPORT = "Archinal et al., Report of the IAU Working Group on Cartographic Coordinates and Rotational Elements: 2015, Celestial Mechanics and Dynamical Astronomy 130, article 22 (2018), as transcribed in NAIF pck00011.tpc (2022-12-27)";
|
|
5
5
|
export const ROTATION_LIMITATION = "Orientation is the IAU pole direction (linear in time) and prime meridian (linear in time) only; the report's periodic nutation and libration terms are left out, and TT stands in for TDB.";
|
|
6
|
-
/**
|
|
7
|
-
export
|
|
6
|
+
/** The date the Horizons states behind the planet series were retrieved (O-063 T-290). */
|
|
7
|
+
export const PLANET_SERIES_RETRIEVED = "2026-11-10";
|
|
8
|
+
/** Before 1972 the engine and Horizons label the same instant differently; measured 1950 to 1971 against Horizons (tests/planetAccuracyFlybys.test.ts). */
|
|
9
|
+
const PRE_1972_LIMITATION = "Before 1972 a date is read on the engine's smooth TT - UTC, while Horizons labels times in UT1 (to 1962) and in UTC's rubber seconds (to 1972): the same label can be up to 0.7 s apart, so a planet can sit up to that much travel away from Horizons' position for that label (measured 1950 to 1971: Mercury 34.5 km, Venus 24.3, Mars 16.8, Jupiter 8.5, Saturn 6.2, Uranus 4.7, Neptune 3.5).";
|
|
10
|
+
/**
|
|
11
|
+
* Position provenance shared by the planets (O-063 T-290): the series is the planet's system barycentre as JPL Horizons reports the planet, and a
|
|
12
|
+
* planet with a moon system adds its own offset from that barycentre from its moon package when that is loaded. `body` names the Horizons
|
|
13
|
+
* target, `centreSource` how Horizons places it, `measured` the figures against Horizons, `withoutPackage` what changes without the package.
|
|
14
|
+
*/
|
|
15
|
+
export function planetEphemeris(label, body, centreSource, measured, withoutPackage) {
|
|
8
16
|
return {
|
|
9
17
|
provenance: createProvenance({
|
|
10
18
|
sourceType: "ephemeris",
|
|
11
19
|
sources: [
|
|
12
|
-
|
|
20
|
+
`JPL Horizons API 1.2 (https://ssd.jpl.nasa.gov/api/horizons.api), ${label} (${body}) about the Sun's centre (CENTER=500@10)${withoutPackage === undefined ? "" : " and about its system barycentre"}, VECTORS geometric ICRF km TDB, 6-hourly 1950 to 2046, retrieved ${PLANET_SERIES_RETRIEVED}: ${centreSource}; the system barycentre fitted as piecewise Chebyshev series within 1 km (tools/import/planet-fits.mjs). US Government work, credit NASA/JPL-Caltech Solar System Dynamics`,
|
|
13
21
|
],
|
|
14
|
-
accuracy:
|
|
22
|
+
accuracy: measured,
|
|
15
23
|
notes: "Geometric position about the Sun's centre; no light-time or aberration.",
|
|
16
24
|
}),
|
|
17
|
-
knownLimitations: ["No velocity is modelled for planets, so they have no speed readout.", ...
|
|
25
|
+
knownLimitations: ["No velocity is modelled for planets, so they have no speed readout.", ...(withoutPackage === undefined ? [] : [withoutPackage]), PRE_1972_LIMITATION],
|
|
18
26
|
};
|
|
19
27
|
}
|
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import type { AstronomyAdapter, PlanetId } from "../astronomyAdapter.js";
|
|
2
|
+
import type { StateSourceBinding } from "../body.js";
|
|
3
|
+
import type { ChebyshevEphemeris } from "../chebyshevEphemeris.js";
|
|
2
4
|
import { type IauRotationElements } from "../iauRotation.js";
|
|
3
5
|
import type { Trajectory } from "../trajectory.js";
|
|
4
6
|
/**
|
|
5
|
-
* A planet in its one native centre, the Sun:
|
|
6
|
-
* No velocity is modelled (a State carries none from this source), so a planet has no speed readout.
|
|
7
|
-
* `offsetKm`, when given and not null at a time, is added to the series position:
|
|
8
|
-
*
|
|
7
|
+
* A planet in its one native centre, the Sun: the planet series position (the system barycentre, from JPL Horizons) and IAU-rotation orientation
|
|
8
|
+
* from the adapter's time scale. No velocity is modelled (a State carries none from this source), so a planet has no speed readout.
|
|
9
|
+
* `offsetKm`, when given and not null at a time, is added to the series position: the planet's own offset from its system's barycentre,
|
|
10
|
+
* available only once its moon system's fits are loaded.
|
|
9
11
|
*/
|
|
10
12
|
export declare function createPlanetSunTrajectory(planet: PlanetId, rotation: IauRotationElements, adapter: AstronomyAdapter, offsetKm?: (timeUtcMs: number) => ArrayLike<number> | null): Trajectory;
|
|
13
|
+
/** The part of a moon system the planet binding reads: whether a set is installed, and the set. */
|
|
14
|
+
export interface BarycentreOffsetSource {
|
|
15
|
+
isLoaded(): boolean;
|
|
16
|
+
ephemeris(): ChebyshevEphemeris;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The planet's own offset from its system barycentre at `timeUtcMs`, from its moon system's centre series, or null while the system is not loaded
|
|
20
|
+
* or the time lies outside the loaded chunks (the planet then stays at the barycentre, which its position record says).
|
|
21
|
+
*/
|
|
22
|
+
export declare function barycentreOffsetKm(system: BarycentreOffsetSource): (timeUtcMs: number) => ArrayLike<number> | null;
|
|
23
|
+
/**
|
|
24
|
+
* The one planet binding (O-063 T-290; Pluto's since O-033 T-116): the planet series gives the system barycentre, and a planet with a moon system
|
|
25
|
+
* adds its own offset from that barycentre once the system's fits are loaded. Mercury and Venus have no moon system: barycentre and centre agree.
|
|
26
|
+
*/
|
|
27
|
+
export declare function planetBinding(planet: PlanetId, rotation: IauRotationElements, system?: BarycentreOffsetSource): StateSourceBinding;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { iauOrientation } from "../iauRotation.js";
|
|
2
2
|
import { assertUtcUnixMs, createState, EQJ } from "../state.js";
|
|
3
3
|
/**
|
|
4
|
-
* A planet in its one native centre, the Sun:
|
|
5
|
-
* No velocity is modelled (a State carries none from this source), so a planet has no speed readout.
|
|
6
|
-
* `offsetKm`, when given and not null at a time, is added to the series position:
|
|
7
|
-
*
|
|
4
|
+
* A planet in its one native centre, the Sun: the planet series position (the system barycentre, from JPL Horizons) and IAU-rotation orientation
|
|
5
|
+
* from the adapter's time scale. No velocity is modelled (a State carries none from this source), so a planet has no speed readout.
|
|
6
|
+
* `offsetKm`, when given and not null at a time, is added to the series position: the planet's own offset from its system's barycentre,
|
|
7
|
+
* available only once its moon system's fits are loaded.
|
|
8
8
|
*/
|
|
9
9
|
export function createPlanetSunTrajectory(planet, rotation, adapter, offsetKm) {
|
|
10
10
|
return Object.freeze({
|
|
@@ -29,3 +29,27 @@ export function createPlanetSunTrajectory(planet, rotation, adapter, offsetKm) {
|
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* The planet's own offset from its system barycentre at `timeUtcMs`, from its moon system's centre series, or null while the system is not loaded
|
|
34
|
+
* or the time lies outside the loaded chunks (the planet then stays at the barycentre, which its position record says).
|
|
35
|
+
*/
|
|
36
|
+
export function barycentreOffsetKm(system) {
|
|
37
|
+
return (timeUtcMs) => {
|
|
38
|
+
if (!system.isLoaded())
|
|
39
|
+
return null;
|
|
40
|
+
try {
|
|
41
|
+
return system.ephemeris().centreOffsetKm(timeUtcMs);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The one planet binding (O-063 T-290; Pluto's since O-033 T-116): the planet series gives the system barycentre, and a planet with a moon system
|
|
50
|
+
* adds its own offset from that barycentre once the system's fits are loaded. Mercury and Venus have no moon system: barycentre and centre agree.
|
|
51
|
+
*/
|
|
52
|
+
export function planetBinding(planet, rotation, system) {
|
|
53
|
+
const offsetKm = system === undefined ? undefined : barycentreOffsetKm(system);
|
|
54
|
+
return Object.freeze({ body: planet, create: (adapter) => createPlanetSunTrajectory(planet, rotation, adapter, offsetKm) });
|
|
55
|
+
}
|
package/src/core/bodies/venus.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createProvenance } from "../provenance.js";
|
|
2
2
|
import { IAU_REPORT, PLANET_VALIDATED_UTC, planetEphemeris, ROTATION_LIMITATION } from "./planetRecords.js";
|
|
3
|
-
export const VENUS_EPHEMERIS = planetEphemeris("Venus", "
|
|
3
|
+
export const VENUS_EPHEMERIS = planetEphemeris("Venus", "299", "DE441 (Venus has no moons: its barycentre, 2, is the planet)", "Within 0.6 km of Horizons' Venus on 2 January of each year 1972 to 2044 (O-063 T-290); the fit is within 0.75 km of Horizons at independent dates 1950 to 2045.");
|
|
4
4
|
/** Venus pole and prime meridian from the IAU 2015 report: degrees, pole per Julian century, W per day, from J2000 TDB. */
|
|
5
5
|
export const VENUS_ROTATION = Object.freeze({
|
|
6
6
|
poleRaDeg: [272.76, 0],
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** True for a hex colour, a comma-form `rgb()`, `rgba()`, `hsl()` or `hsla()` or a named colour. */
|
|
2
|
+
export declare function isCssColour(value: unknown): value is string;
|
|
3
|
+
/** True for a non-blank font family text (any CSS font-family list, or `inherit`). */
|
|
4
|
+
export declare function isFontFamily(value: unknown): value is string;
|
|
5
|
+
/** Label size range in pixels: small enough for a crowded sky, large enough to read on a phone. */
|
|
6
|
+
export declare const LABEL_SIZE_LIMITS: Readonly<{
|
|
7
|
+
min: 8;
|
|
8
|
+
max: 24;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// What a look may hold (O-065 T-296): whether a text is a CSS colour the viewer would take, checked here without a browser so a bad colour fails at `setLook` / `addSkyFigures` in Node too (API-04, API-05).
|
|
2
|
+
const NAMED = new Set(("aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan "
|
|
3
|
+
+ "darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink "
|
|
4
|
+
+ "deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush "
|
|
5
|
+
+ "lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow "
|
|
6
|
+
+ "lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin "
|
|
7
|
+
+ "navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue "
|
|
8
|
+
+ "saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen").split(" "));
|
|
9
|
+
const HEX = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
|
|
10
|
+
// The comma forms only: the drawing library that paints the lines reads these (and hex and names), not the space-separated or newer colour functions.
|
|
11
|
+
const FUNCTION = /^(?:rgb|hsl)a?\(\s*[\d.]+%?\s*,\s*[\d.]+%?\s*,\s*[\d.]+%?\s*(?:,\s*[\d.]+%?\s*)?\)$/i;
|
|
12
|
+
/** True for a hex colour, a comma-form `rgb()`, `rgba()`, `hsl()` or `hsla()` or a named colour. */
|
|
13
|
+
export function isCssColour(value) {
|
|
14
|
+
if (typeof value !== "string")
|
|
15
|
+
return false;
|
|
16
|
+
const text = value.trim();
|
|
17
|
+
return HEX.test(text) || FUNCTION.test(text) || NAMED.has(text.toLowerCase());
|
|
18
|
+
}
|
|
19
|
+
/** True for a non-blank font family text (any CSS font-family list, or `inherit`). */
|
|
20
|
+
export function isFontFamily(value) {
|
|
21
|
+
return typeof value === "string" && value.trim() !== "" && !/[;{}]/.test(value);
|
|
22
|
+
}
|
|
23
|
+
/** Label size range in pixels: small enough for a crowded sky, large enough to read on a phone. */
|
|
24
|
+
export const LABEL_SIZE_LIMITS = Object.freeze({ min: 8, max: 24 });
|
|
@@ -4,7 +4,7 @@ import type { TimeBounds } from "./trajectory.js";
|
|
|
4
4
|
export declare function planetSeriesSpan(): TimeBounds;
|
|
5
5
|
/**
|
|
6
6
|
* The planet models from the stored curve fits (`data/ephemerides/planets/`, O-025 T-101): heliocentric ecliptic-J2000 positions as piecewise
|
|
7
|
-
* Chebyshev series in TT
|
|
7
|
+
* Chebyshev series in TT of each planet's system barycentre as JPL Horizons reports the planet, within 1 km (O-063 T-290; tools/import/planet-fits.mjs). UTC to TT uses the table stored
|
|
8
8
|
* beside them. Dates outside the fitted span (1950 to 2045) throw rather than extrapolate. Only planetSeries.ts imports this, lazily.
|
|
9
9
|
*/
|
|
10
10
|
export declare function createPlanetModels(): PlanetModels;
|
package/src/core/planetModels.js
CHANGED
|
@@ -32,7 +32,7 @@ export function planetSeriesSpan() {
|
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* The planet models from the stored curve fits (`data/ephemerides/planets/`, O-025 T-101): heliocentric ecliptic-J2000 positions as piecewise
|
|
35
|
-
* Chebyshev series in TT
|
|
35
|
+
* Chebyshev series in TT of each planet's system barycentre as JPL Horizons reports the planet, within 1 km (O-063 T-290; tools/import/planet-fits.mjs). UTC to TT uses the table stored
|
|
36
36
|
* beside them. Dates outside the fitted span (1950 to 2045) throw rather than extrapolate. Only planetSeries.ts imports this, lazily.
|
|
37
37
|
*/
|
|
38
38
|
export function createPlanetModels() {
|
|
@@ -11,7 +11,7 @@ export declare class PlanetFitsUncoveredError extends RangeError {
|
|
|
11
11
|
export type PlanetId = "mercury" | "venus" | "mars" | "jupiter" | "saturn" | "uranus" | "neptune" | "pluto";
|
|
12
12
|
export declare const PLANET_IDS: readonly PlanetId[];
|
|
13
13
|
export declare function isPlanetId(id: string): id is PlanetId;
|
|
14
|
-
/** One planet's heliocentric ecliptic-J2000 model (curve fits of
|
|
14
|
+
/** One planet's heliocentric ecliptic-J2000 model (curve fits of its system barycentre from JPL Horizons), as the astronomy adapter reads it. */
|
|
15
15
|
export interface PlanetModel {
|
|
16
16
|
xyz(date: Date): {
|
|
17
17
|
readonly x: number;
|
|
@@ -25,7 +25,7 @@ export type PlanetModels = {
|
|
|
25
25
|
readonly [P in PlanetId]: PlanetModel;
|
|
26
26
|
};
|
|
27
27
|
/**
|
|
28
|
-
* Builds the planet models, once, from the stored curve fits of
|
|
28
|
+
* Builds the planet models, once, from the stored curve fits of JPL Horizons states (O-025 T-101, O-033 T-114, O-063 T-290; before O-063 the full VSOP87A series; the library's compact
|
|
29
29
|
* default tables are off by tens of thousands of km, docs/ASTRONOMY_VALIDATION.md, and its full series were about 0.8 MB of code).
|
|
30
30
|
* The fits are a separate chunk fetched only when a mounted composition contains a planet; an experience without one never
|
|
31
31
|
* downloads them (I-022).
|
package/src/core/planetSeries.js
CHANGED
|
@@ -20,7 +20,7 @@ let loading;
|
|
|
20
20
|
let models;
|
|
21
21
|
let span;
|
|
22
22
|
/**
|
|
23
|
-
* Builds the planet models, once, from the stored curve fits of
|
|
23
|
+
* Builds the planet models, once, from the stored curve fits of JPL Horizons states (O-025 T-101, O-033 T-114, O-063 T-290; before O-063 the full VSOP87A series; the library's compact
|
|
24
24
|
* default tables are off by tens of thousands of km, docs/ASTRONOMY_VALIDATION.md, and its full series were about 0.8 MB of code).
|
|
25
25
|
* The fits are a separate chunk fetched only when a mounted composition contains a planet; an experience without one never
|
|
26
26
|
* downloads them (I-022).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fetchBytesOf: (url: string) => Promise<Uint8Array>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Reads the bytes at a bundled address: a `file:` address with Node's own module (found at run time, so a browser bundle never resolves it; Node's `fetch` does not serve `file:`), anything else by `fetch`. One reader for every bundled file the engine loads (moon fit chunks, the star list). */
|
|
2
|
+
async function readFileUrl(url) {
|
|
3
|
+
const nodeFs = globalThis.process?.getBuiltinModule?.("node:fs/promises");
|
|
4
|
+
if (nodeFs === undefined)
|
|
5
|
+
throw new Error(`${url}: this runtime cannot read a file: address`);
|
|
6
|
+
return new Uint8Array(await nodeFs.readFile(new URL(url)));
|
|
7
|
+
}
|
|
8
|
+
export const fetchBytesOf = async (url) => {
|
|
9
|
+
if (url.startsWith("file:"))
|
|
10
|
+
return readFileUrl(url);
|
|
11
|
+
const response = await fetch(url);
|
|
12
|
+
if (!response.ok)
|
|
13
|
+
throw new Error(`${url}: HTTP ${response.status}`);
|
|
14
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
15
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** What follows a trace: the traced lines stay, or fade away. (Removing a trace at any time is `clearSkyTrace`.) */
|
|
2
|
+
export type SkyTraceAfter = "stay" | "fade";
|
|
3
|
+
export declare const SKY_TRACE_AFTER: readonly SkyTraceAfter[];
|
|
4
|
+
/** How long a trace takes, in seconds, when the app does not say. */
|
|
5
|
+
export declare const DEFAULT_TRACE_SECONDS = 2;
|
|
6
|
+
/** The range of `durationSeconds` a trace accepts. */
|
|
7
|
+
export declare const TRACE_SECONDS_LIMITS: Readonly<{
|
|
8
|
+
min: 0.1;
|
|
9
|
+
max: 60;
|
|
10
|
+
}>;
|
|
11
|
+
/** How long a `fade` takes after the trace, in seconds. */
|
|
12
|
+
export declare const TRACE_FADE_SECONDS = 1;
|
|
13
|
+
/** How long sky lines and their names take to fade in when they appear, in seconds, when the look does not say (owner, T-306). */
|
|
14
|
+
export declare const DEFAULT_SKY_FADE_IN_SECONDS = 0.5;
|
|
15
|
+
/** The longest step one frame moves the fade-in on, in seconds, so a frame after an idle spell (the scene draws only when needed) does not skip the fade. */
|
|
16
|
+
export declare const SKY_FADE_IN_STEP_LIMIT = 0.1;
|
|
17
|
+
/** The share of a fade-in shown after one more step: `from` moved on by `deltaSeconds` (capped at `SKY_FADE_IN_STEP_LIMIT`) of `seconds`; 0 seconds shows it all at once. */
|
|
18
|
+
export declare function stepFadeIn(from: number, deltaSeconds: number, seconds: number): number;
|
|
19
|
+
/** One trace in progress. `reduced`: the person asked for less motion, so the whole figure shows at once. */
|
|
20
|
+
export interface SkyTraceRun {
|
|
21
|
+
readonly seconds: number;
|
|
22
|
+
readonly after: SkyTraceAfter;
|
|
23
|
+
readonly reduced: boolean;
|
|
24
|
+
/** Real seconds since the trace began. */
|
|
25
|
+
elapsed: number;
|
|
26
|
+
}
|
|
27
|
+
/** What one step of a trace says to draw. */
|
|
28
|
+
export interface SkyTraceFrame {
|
|
29
|
+
/** The share of the figure's segments drawn, 0 to 1 (segments in order, each growing from its first end). */
|
|
30
|
+
readonly drawn: number;
|
|
31
|
+
/** How far the lines have faded, 0 to 1 (0: the traced colour; 1: the faded colour, then gone). */
|
|
32
|
+
readonly fade: number;
|
|
33
|
+
/** True: the trace is over and its lines go (`clear`, or a finished `fade`). */
|
|
34
|
+
readonly done: boolean;
|
|
35
|
+
/** True: this step changed what is drawn, so the scene must draw this frame. */
|
|
36
|
+
readonly moving: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** Moves a trace on by `deltaSeconds` of real time and says what to draw. A `stay` trace holds its drawn figure for good (until the app traces it again). */
|
|
39
|
+
export declare function stepTrace(run: SkyTraceRun, deltaSeconds: number): SkyTraceFrame;
|
|
40
|
+
/** A trace on its way out because the host asked to clear it: eases from the fade it had to 1 over `seconds` (0: gone this step). */
|
|
41
|
+
export interface SkyHideRun {
|
|
42
|
+
readonly seconds: number;
|
|
43
|
+
/** The fade the trace had when the request was taken, 0 to 1. */
|
|
44
|
+
readonly from: number;
|
|
45
|
+
/** Real seconds since the request was taken. */
|
|
46
|
+
elapsed: number;
|
|
47
|
+
}
|
|
48
|
+
/** Moves a hide on by `deltaSeconds` of real time; `drawn` is the share the trace had reached, which a hide holds. */
|
|
49
|
+
export declare function stepHide(run: SkyHideRun, deltaSeconds: number, drawn: number): SkyTraceFrame;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// How a sky-figure trace runs (O-065 T-297): pure arithmetic with no drawing, shared by the host call's checks (`src/api`) and the frame stage (`src/app`). Wall time only: the scene clock never enters.
|
|
2
|
+
export const SKY_TRACE_AFTER = Object.freeze(["stay", "fade"]);
|
|
3
|
+
/** How long a trace takes, in seconds, when the app does not say. */
|
|
4
|
+
export const DEFAULT_TRACE_SECONDS = 2;
|
|
5
|
+
/** The range of `durationSeconds` a trace accepts. */
|
|
6
|
+
export const TRACE_SECONDS_LIMITS = Object.freeze({ min: 0.1, max: 60 });
|
|
7
|
+
/** How long a `fade` takes after the trace, in seconds. */
|
|
8
|
+
export const TRACE_FADE_SECONDS = 1;
|
|
9
|
+
/** How long sky lines and their names take to fade in when they appear, in seconds, when the look does not say (owner, T-306). */
|
|
10
|
+
export const DEFAULT_SKY_FADE_IN_SECONDS = 0.5;
|
|
11
|
+
/** The longest step one frame moves the fade-in on, in seconds, so a frame after an idle spell (the scene draws only when needed) does not skip the fade. */
|
|
12
|
+
export const SKY_FADE_IN_STEP_LIMIT = 0.1;
|
|
13
|
+
/** The share of a fade-in shown after one more step: `from` moved on by `deltaSeconds` (capped at `SKY_FADE_IN_STEP_LIMIT`) of `seconds`; 0 seconds shows it all at once. */
|
|
14
|
+
export function stepFadeIn(from, deltaSeconds, seconds) {
|
|
15
|
+
if (seconds <= 0)
|
|
16
|
+
return 1;
|
|
17
|
+
return Math.min(1, from + Math.min(SKY_FADE_IN_STEP_LIMIT, Math.max(0, deltaSeconds)) / seconds);
|
|
18
|
+
}
|
|
19
|
+
/** Moves a trace on by `deltaSeconds` of real time and says what to draw. A `stay` trace holds its drawn figure for good (until the app traces it again). */
|
|
20
|
+
export function stepTrace(run, deltaSeconds) {
|
|
21
|
+
const unsettled = run.elapsed < run.seconds; // a `stay` trace changes only until it is fully drawn
|
|
22
|
+
run.elapsed += Math.max(0, deltaSeconds);
|
|
23
|
+
const drawn = run.reduced ? 1 : Math.min(1, run.elapsed / run.seconds);
|
|
24
|
+
if (run.elapsed < run.seconds)
|
|
25
|
+
return { drawn, fade: 0, done: false, moving: true };
|
|
26
|
+
if (run.after === "stay")
|
|
27
|
+
return { drawn: 1, fade: 0, done: false, moving: unsettled };
|
|
28
|
+
if (run.reduced)
|
|
29
|
+
return { drawn: 1, fade: 1, done: true, moving: true };
|
|
30
|
+
const fade = Math.min(1, (run.elapsed - run.seconds) / TRACE_FADE_SECONDS);
|
|
31
|
+
return { drawn: 1, fade, done: fade >= 1, moving: true };
|
|
32
|
+
}
|
|
33
|
+
/** Moves a hide on by `deltaSeconds` of real time; `drawn` is the share the trace had reached, which a hide holds. */
|
|
34
|
+
export function stepHide(run, deltaSeconds, drawn) {
|
|
35
|
+
run.elapsed += Math.max(0, deltaSeconds);
|
|
36
|
+
const share = run.seconds <= 0 ? 1 : Math.min(1, run.elapsed / run.seconds);
|
|
37
|
+
const fade = run.from + (1 - run.from) * share;
|
|
38
|
+
return { drawn, fade, done: share >= 1, moving: true };
|
|
39
|
+
}
|