astraeus 0.5.0 → 0.5.1
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 +12 -0
- package/README.md +3 -3
- package/package.json +1 -1
- package/src/api/scene.js +21 -14
- package/src/api/story.d.ts +4 -0
- package/src/api/story.js +10 -1
- package/src/app/AstraeusScene.js +3 -1
- package/src/app/LayeredRender.js +1 -0
- package/src/app/OrbitSetView.js +5 -0
- package/src/app/SceneLabels.d.ts +8 -0
- package/src/app/SceneLabels.js +15 -1
- package/src/app/SkyView.js +2 -0
- package/src/assets/bodies/jupiter.js +2 -0
- package/src/assets/bodies/outerPlanetCatalogues.d.ts +1 -5
- package/src/assets/bodies/outerPlanetCatalogues.js +2 -6
- package/src/assets/bodies/outerPlanetRings.d.ts +5 -0
- package/src/assets/bodies/outerPlanetRings.js +6 -0
- package/src/assets/bodies/planetSystemMaps.js +6 -3
- package/src/assets/compositions.js +2 -1
- package/src/assets/visual.d.ts +1 -1
- package/src/core/bodies/io.js +1 -0
- package/src/core/bodies/jupiterMoons.js +5 -4
- package/src/core/bodies/moon.d.ts +2 -0
- package/src/core/bodies/moon.js +4 -0
- package/src/core/bodies/moonSystem.d.ts +2 -0
- package/src/core/bodies/moonSystem.js +1 -0
- package/src/core/bodies/outerPlanetData.d.ts +0 -3
- package/src/core/bodies/outerPlanetData.js +1 -7
- package/src/core/bodies/outerPlanetRingData.d.ts +3 -0
- package/src/core/bodies/outerPlanetRingData.js +10 -0
- package/src/core/bodies/planetMoons.js +11 -10
- package/src/core/body.d.ts +4 -0
- package/src/core/events.d.ts +2 -0
- package/src/core/satelliteMeanElements.d.ts +2 -8
- package/src/core/satelliteMeanElements.js +2 -15
- package/src/core/siderealPeriod.d.ts +27 -0
- package/src/core/siderealPeriod.js +18 -0
- package/src/shell/AstraeusShell.js +6 -2
- package/src/shell/AstraeusShell.node.js +6 -2
- package/src/synthetic/syntheticJourneyScene.js +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Versions follow [semantic versioning](https://semver.org). While the version starts with `0.`, the public API (the names exported from `astraeus`) may still change between minor versions; each change is listed here.
|
|
4
4
|
|
|
5
|
+
## 0.5.1 (2026-10-31)
|
|
6
|
+
|
|
7
|
+
First download of the packed example (`npm run measure:example`): 1,618,563 bytes raw, 461,100 bytes gzip (code and styles loaded on first open).
|
|
8
|
+
|
|
9
|
+
Near planets stay visible and ringed planets show their rings (O-048, G-014), from a second round of findings sent back by the outside interplanetary probe app built on 0.5.0.
|
|
10
|
+
|
|
11
|
+
- A planet or moon near the camera now stays visible however far the camera has zoomed out (O-048 T-204, I-117). The renderer uses a logarithmic depth buffer, so a Sun-centred scene whose far plane reaches a 170 AU path no longer loses Saturn at 0.01 AU to depth precision. Every custom shader in the engine carries the log-depth chunks, and a test fails for one that does not.
|
|
12
|
+
- Jupiter, Saturn, Uranus and Neptune now carry their rings in their one catalogue definition (O-048 T-205, I-118), so a scene that adds the planet through the public API draws the rings with their NSSDC fact-sheet source; the ring bands and the ring look sliders are unchanged. The planets demo no longer attaches rings itself. First download of the packed example (`npm run measure:example`) grows from 1,608,313 to 1,617,005 bytes raw and from 457,901 to 460,652 bytes gzip (the ring data now ships with the engine).
|
|
13
|
+
- `addBody(moon, { orbit: true })` draws the orbit line of any catalogued moon, not only the Moon and Io (O-048 T-206, I-119). One rule: one lap of the period the moon's catalogue definition carries (`orbitPeriodDays`, read once from its mean-element record), drawn about its planet; the Moon and Io draw as before, and a moon with no period (Phobos, Deimos) throws `no-orbit`. First download grows by 786 bytes raw, 243 bytes gzip (1,617,005 to 1,617,791 raw; 460,652 to 460,895 gzip).
|
|
14
|
+
- `addEvents` takes an optional `object` (a body or trajectory id) per event (O-048 T-207, I-120): the timeline's Go to, Previous and Next seek to the event and frame that object as `camera.lookAt` does; an event without one seeks as before, and an `object` the scene lacks throws `bad-event` naming the event and the id. Only code already in the first download changed; size is not re-measured.
|
|
15
|
+
- Overlapping labels no longer flicker at fast playback (O-048 T-208, I-121). One rule for every label: a label hidden by an overlap needs 14 px more clearance than the plain 6 px gap before it shows again, so two labels crossing swap winner once per crossing; the selected object's label still always wins and labels switched off stay hidden. Layout only; no State change and no new files in the package.
|
|
16
|
+
|
|
5
17
|
## 0.5.0 (2026-10-31)
|
|
6
18
|
|
|
7
19
|
First download of the packed example (`npm run measure:example`): 1,608,131 bytes raw, 457,845 bytes gzip (code and styles loaded on first open).
|
package/README.md
CHANGED
|
@@ -76,13 +76,13 @@ The full reference, generated from the types and doc comments, is at <https://as
|
|
|
76
76
|
| Call | What it does |
|
|
77
77
|
|---|---|
|
|
78
78
|
| `new Scene()` | An empty scene. Every method below returns the scene, so calls chain. |
|
|
79
|
-
| `scene.addBody(body, { orbit?, enlarge?, showLabel?, labelReach?, description?, color?, knownLimitations? })` | Adds a catalogued body: a ready-made one (`sun`, `mercury`, `venus`, `earth`, `moon`, `mars`, `jupiter`, `saturn`, `uranus`, `neptune`, `pluto`, and the moons `io`, `europa`, `ganymede`, `callisto`, `mimas`, `enceladus`, `tethys`, `dione`, `rhea`, `titan`, `iapetus`, `triton`, `charon`, `phobos`, `deimos`) or its id. The first body added is the scene's centre. `{ orbit: true }` also draws its orbit line: `moon`
|
|
79
|
+
| `scene.addBody(body, { orbit?, enlarge?, showLabel?, labelReach?, description?, color?, knownLimitations? })` | Adds a catalogued body: a ready-made one (`sun`, `mercury`, `venus`, `earth`, `moon`, `mars`, `jupiter`, `saturn`, `uranus`, `neptune`, `pluto`, and the moons `io`, `europa`, `ganymede`, `callisto`, `mimas`, `enceladus`, `tethys`, `dione`, `rhea`, `titan`, `iapetus`, `triton`, `charon`, `phobos`, `deimos`) or its id. The first body added is the scene's centre. `{ orbit: true }` also draws its orbit line: any catalogued moon with a period in its data (`moon`, `io`, `europa`, `ganymede`, `callisto`, `mimas`, `enceladus`, `tethys`, `dione`, `rhea`, `titan`, `iapetus`, `triton`, `charon`) about its planet, one lap of that period (the planet must be in the scene; `phobos` and `deimos` have no period in the catalogue and throw `no-orbit`), or, with `sun` in the scene, one turn round the Sun of any body that circles it (the planets, Earth's year, a body from `addBodyFromElements`), from the opening time: one full turn of the body's own positions where they cover a whole turn, else (Uranus and Neptune, whose turn outlasts the planet series) the two-body ellipse osculating at the opening time, which the info card says; anything else throws `no-orbit`. `camera.fitOrbit` follows the same rule. `enlarge` (a number of at least 1) draws the body that many times larger than life (in a Sun-centred scene the viewer then offers its "Solar system" scale, true distances with the named bodies enlarged, as the second scale in place of Readable); `showLabel: false` starts its label off; `labelReach` (a positive number, in the camera's distance units) shows its label only within that distance of the camera, in place of the scene's shared rule. A scene whose first body is the Sun sets no label reach, so labels stay when zoomed out, and it can hold a path (`addTrajectory`, drawn with `lineFixedTo: "sun"`). `color` (a hex colour such as `"#9fd8ff"`) sets the colour on its info card and label; `knownLimitations` (a list of non-empty texts) replaces the catalogue's limits shown with its provenance; a bad value throws `bad-body`. Jupiter, Saturn, Uranus and Neptune are drawn with their rings (bands at the NASA NSSDC ring fact sheet radii) whenever you add them; Mercury, Venus, Earth, Mars and Pluto have none. |
|
|
80
80
|
| `scene.addTrajectory({ id, label?, color?, center?, plane?, lineFixedTo?, labelReach?, samples, provenance?, provenanceSpans?, description?, knownLimitations?, anchors?, readouts? })` | A recorded path. Each sample is `{ time, positionKm, velocityKmS? }` measured from `center` (default: the scene's centre, its first body, so a Sun-first scene reads them from the Sun and an Earth-first one from Earth; Earth if no body is added) in equatorial J2000 (EQJ) axes; `plane: "ecliptic-j2000"` instead takes ecliptic J2000 vectors as JPL Horizons publishes them and rotates them to EQJ once on the way in (positions and velocities, from samples or a provider; a provider's `orientation` quaternion passes through unrotated, a known limit; any other `plane` throws `bad-trajectory`); `lineFixedTo` names the body the line is drawn against (default the scene centre): each sample is placed from that body at the sample's own time, then the line is carried to that body's place from the scene centre at the clock time, so `"sun"` fixes a probe's line to the Sun in any scene, Sun-centred ones included, and a body the scene does not hold throws `bad-trajectory`; `labelReach` (a positive number, in the camera's distance units) limits how far from the camera its name shows, in place of the scene's shared rule; a bad value throws `bad-trajectory`; `time` is ISO text, a `Date` or Unix milliseconds. Instead of `samples` you may give `provider` (an object with `stateAt(timeUtcMs)`) and `bounds: { start, end }`. `description` and `knownLimitations` (a list of sentences) go on its info card with `provenance`. `anchors: [{ id, time }]` draw labelled dots where the source published a point (the time must fall within the path). `readouts` are bars on the card, in order: `{ kind: "range", marker? }` (distance from the centre; `marker` names a body to mark), `{ kind: "speed" }`, `{ kind: "distance", to }` and `{ kind: "altitude", above }`; a named body must be in the scene. `provenanceSpans` (a list of `{ start, end, provenance }`, sorted, not overlapping, inside the path) gives each stretch its own provenance, shown with the path as time moves (as an activity's `provenance`); where no span covers the time, `provenance` (or the illustrative default) shows; a fault throws `bad-trajectory` naming the index. |
|
|
81
81
|
| `scene.addBodyFromElements(record, options?)` | Your own body that circles the Sun, from published orbit elements: `record` is `{ id, label, elements: { semiMajorAxisAu, eccentricity, inclinationDeg, ascendingNodeDeg, argumentOfPerihelionDeg, meanAnomalyDeg or perihelionJdTdb }, epoch: { jd, timeScale, ttMinusUtcSeconds? }, frame: "ecliptic-j2000", source: { name, url, solution, accessed }, radius?, accuracy: { classification, statement, validFromUtc, validToUtc, limitations }, marker?: { color, sizePx } }`. Drawn as a marker on unperturbed two-body motion about the Sun; the source, accuracy and limits show on its info card, with a live "Distance from Sun" row. `options` are `addBody`'s (`{ orbit: true }` draws its whole orbit from periapsis, smooth even for a sharp comet orbit). A bad record throws `bad-element` naming the field; a repeated id throws `duplicate-id`. |
|
|
82
82
|
| `scene.addGroup({ id, orbits, label?, center?, plane?, color?, dotSizePx?, referenceTime?, seed?, clump?, refillAfterMs?, refillSliceMs?, provenance?, description?, knownLimitations? })` | A list of orbits drawn as one group of dots: `orbits` is `[{ id, semiMajorAxisKm, eccentricity, inclinationDeg, raanDeg, argumentOfPeriapsisDeg, time? }]` (bound orbits, ids distinct), measured about `center` (default the scene's centre; it must be in the scene) in `plane` (`"ecliptic-j2000"` default, or `"EQJ"`). One colour (`color`, a hex colour), dot size (`dotSizePx`), menu item, info card, provenance and known limits. Where each dot sits along its orbit is a drawing choice, marked illustrative: an even spread shuffled by `seed`, fixed at `referenceTime` (default the opening time), then two-body motion. `clump: { near, fraction, widthDeg }` draws a share of the dots near a body's place along its orbit (a model; the body must be in the scene and not the centre; it may be one added with `addBodyFromElements` before the group). `refillAfterMs` is how often the dots are placed again; `refillSliceMs` (0 or more) is how much of a frame may go on computing the next fill ahead of time. The group's card shows "illustrative" as its source type, with the elements' own type in the accuracy sentence. The id joins the camera menu (`focus-<id>`, `follow-<id>`) and may be a panel's `object`. A mistake throws `bad-group`. |
|
|
83
83
|
| `scene.setTime(time)` | The moment the scene opens at. |
|
|
84
84
|
| `scene.setScale(trueScale \| readableScale \| solarSystemScale, { only? })` | The opening scale; the viewer can switch to the other unless `{ only: true }` offers that scale alone. `solarSystemScale` (true distances, enlarged bodies drawn larger) needs a Sun-centred scene with an enlarged body, else `bad-scale`; such a scene offers it second in place of `readableScale`. |
|
|
85
|
-
| `scene.addEvents(events, { provenance? })` | Timed events on the timeline: `[{ id, label, time, type?, provenance? }]`, ids unique. `provenance` says where the times come from; an event's own `provenance` wins over the batch's. A provenance `sourceType` is `ephemeris`, `observed`, `reconstructed`, `modelled` or `illustrative`; `modelled` is shown as "Modelled". Batch and per-event provenance are checked: a malformed one throws `bad-event`. May be called more than once. |
|
|
85
|
+
| `scene.addEvents(events, { provenance? })` | Timed events on the timeline: `[{ id, label, time, type?, provenance?, object? }]`, ids unique. `object` is the id of a body or trajectory in the scene the event is about: the timeline's Go to (and Previous/Next) seeks to the event and frames that object as `camera.lookAt` does (it is selected and Focus shows pressed); an event without one only seeks. An `object` the scene lacks throws `bad-event` naming the event and the id when the scene is built. `provenance` says where the times come from; an event's own `provenance` wins over the batch's. A provenance `sourceType` is `ephemeris`, `observed`, `reconstructed`, `modelled` or `illustrative`; `modelled` is shown as "Modelled". Batch and per-event provenance are checked: a malformed one throws `bad-event`. May be called more than once. |
|
|
86
86
|
| `scene.addStoryPanels({ pauseSeconds?, autoOpen?, panels })` | Story panels that open as playback reaches them: `{ id, at: { utc } \| { event } \| { anchor }, title, body, details?, badge, sources, object? }`. `badge` is `observed`, `modelled` or `illustrative`; `sources` is never empty. A mistake throws `bad-panels` naming the panel and field. |
|
|
87
87
|
| `scene.setTimeline({ start, end, rates?, rate?, loop?, pacing? })` | The timeline's span, the playback speeds offered (simulated seconds per real second) and the one it opens at. `{ none: true, at?, rate? }` draws no timeline bar: time is frozen at `at`, or runs on at `rate`. The speed menu shows exactly the `rates` you give (ascending), and no others; without `rates` it offers 1 minute, 1 hour and 1 day per second. `pacing` slows playback for encounters and speeds it up for cruise, see "Paced playback" below. With a timeline bar and no `loop`, playback stops on the timeline's end instead of running past it. |
|
|
88
88
|
| `scene.addActivity({ id, label, unit, start, end, samples, peak?, provenance?, type?, peakLabel? })` | A period of activity on the timeline: a rate curve `samples: [{ time, value }]` (at least two, sorted, inside `start` to `end`; straight lines between) that the timeline glows by, with an optional `peak` mark and `provenance: [{ start, end, provenance }]` for where each stretch comes from. A group's `readouts: [{ kind: "rate", activity? }]` shows the live rate (unavailable outside the period) against the peak on its card. Without `setTimeline` the timeline spans the activities. A repeated id or a bad curve, peak or source throws `bad-activity`; a rate readout with no activity is `bad-readout`. |
|
|
@@ -197,7 +197,7 @@ window.addEventListener("vite:preloadError", () => window.location.reload());
|
|
|
197
197
|
|
|
198
198
|
For tests, the package has a `node` export condition: Node and Vitest's Node environment import a copy of the package without the stylesheet import, so `new Scene()...toDefinition()` works with no `test.server.deps.inline` setting. The jsdom and happy-dom Vitest environments also take the `node` condition, so the viewer's CSS is not loaded there; this does not matter for tests that check scene definitions or behaviour. Bundlers do not use the `node` condition and load the normal build.
|
|
199
199
|
|
|
200
|
-
First download: the packed `examples/hello-scene` loads 1,
|
|
200
|
+
First download: the packed `examples/hello-scene` loads 1,618,563 bytes (461,100 gzip) of code and styles, measured at this commit on first open (`npm run measure:example`; pictures and data files are not counted).
|
|
201
201
|
|
|
202
202
|
## What `astraeus-data` adds
|
|
203
203
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astraeus",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "A 3D solar system engine for the browser: place bodies and recorded paths in a scene, mount it, and get time controls, camera, scale choice and body info. Planet positions and the main pictures included.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/src/api/scene.js
CHANGED
|
@@ -9,8 +9,7 @@ import { createOrbAstronomyAdapter } from "../core/astronomyAdapter.js";
|
|
|
9
9
|
import { isPlanetId, loadPlanetSeries, planetSeriesLoaded, planetSeriesSpan } from "../core/planetSeries.js";
|
|
10
10
|
import { catalogue as builtInCatalogue, extendCatalogue, rootBodyId } from "../assets/catalogue.js";
|
|
11
11
|
import { buildElementsBody, ElementsBodyError, parseElementsBodyRecord } from "../core/elementsBody.js";
|
|
12
|
-
import { createComposition
|
|
13
|
-
import { IO_PERIOD_DAYS } from "../core/bodies/io.js";
|
|
12
|
+
import { createComposition } from "../assets/compositions.js";
|
|
14
13
|
import { bodyMetrics } from "../app/bodyMetrics.js";
|
|
15
14
|
import { needsPlanetSeries } from "../app/planetNeeds.js";
|
|
16
15
|
import { catalogueItem } from "../app/catalogueItem.js";
|
|
@@ -24,13 +23,20 @@ import { SceneError } from "./errors.js";
|
|
|
24
23
|
import { toUtcMs } from "./time.js";
|
|
25
24
|
import { switchesOf } from "./switches.js";
|
|
26
25
|
import { TimeScaleOutOfRangeError } from "../core/timeScale.js";
|
|
27
|
-
import { eventProvenanceOf, eventsOf, pacingFor, panelsOf, timelineOf } from "./story.js";
|
|
26
|
+
import { checkEventObjects, eventProvenanceOf, eventsOf, pacingFor, panelsOf, timelineOf } from "./story.js";
|
|
28
27
|
export { toUtcMs } from "./time.js";
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
/**
|
|
29
|
+
* The orbit line of a catalogued moon, by one rule: one lap of the period its catalogue definition carries (`orbitPeriodDays`, read once from the record or mean
|
|
30
|
+
* elements), drawn about its parent. Undefined where the definition gives no period. A moon closes its loop (Io's look) unless its definition says its line fades (the Moon's, as before).
|
|
31
|
+
*/
|
|
32
|
+
function moonOrbitPath(catalogue, id) {
|
|
33
|
+
if (!catalogue.has(id))
|
|
34
|
+
return undefined;
|
|
35
|
+
const { orbitPeriodDays, orbitLineFades, parentId } = catalogue.get(id).definition;
|
|
36
|
+
if (orbitPeriodDays === undefined || parentId === undefined)
|
|
37
|
+
return undefined;
|
|
38
|
+
return { spanMs: orbitPeriodDays * 86_400_000, ...(orbitLineFades === true ? {} : { look: { endFadeOn: false } }) };
|
|
39
|
+
}
|
|
34
40
|
const DEFAULT_COLOR = "#ffd27a";
|
|
35
41
|
const DAY_MS = 86_400_000;
|
|
36
42
|
const PROVIDER_PATH_SAMPLES = 128;
|
|
@@ -179,8 +185,8 @@ export class Scene {
|
|
|
179
185
|
return this;
|
|
180
186
|
}
|
|
181
187
|
#register(call, id, ref, options) {
|
|
182
|
-
if (options.orbit === true &&
|
|
183
|
-
throw new SceneError("no-orbit", `${call}("${id}", { orbit: true }): the engine draws the orbit line of
|
|
188
|
+
if (options.orbit === true && moonOrbitPath(this.#catalogue, id) === undefined && !(circlesTheSun(this.#catalogue, id)))
|
|
189
|
+
throw new SceneError("no-orbit", `${call}("${id}", { orbit: true }): the engine draws the orbit line of any catalogued moon whose data give a period about its planet and of any body that circles the Sun (every planet: its own source over a full turn where the source covers one, else the two-body ellipse osculating at the opening time)`);
|
|
184
190
|
if (!this.#catalogue.has(id))
|
|
185
191
|
throw new SceneError("unknown-body", `${call}("${id}"): not a catalogued body (known: ${this.#catalogue.ids().join(", ")})`);
|
|
186
192
|
if (this.#taken(id))
|
|
@@ -485,12 +491,12 @@ export class Scene {
|
|
|
485
491
|
}
|
|
486
492
|
/** The engine's own orbit loops (the Moon's and Io's) the scene asked for. */
|
|
487
493
|
#moonPaths() {
|
|
488
|
-
return [...this.#orbits].filter((id) =>
|
|
489
|
-
const orbit =
|
|
494
|
+
return [...this.#orbits].filter((id) => moonOrbitPath(this.#catalogue, id) !== undefined).map((id) => {
|
|
495
|
+
const orbit = moonOrbitPath(this.#catalogue, id);
|
|
490
496
|
const parent = this.#catalogue.get(id).definition.parentId;
|
|
491
497
|
if (parent === undefined || !this.#bodies.has(parent))
|
|
492
498
|
throw new SceneError("no-orbit", `addBody("${id}", { orbit: true }): the orbit is drawn about ${parent}, which has not been added to the scene`);
|
|
493
|
-
return { body: id, ...orbit
|
|
499
|
+
return { body: id, ...orbit };
|
|
494
500
|
});
|
|
495
501
|
}
|
|
496
502
|
/** Whether the scene is centred on the Sun. */
|
|
@@ -518,7 +524,7 @@ export class Scene {
|
|
|
518
524
|
}
|
|
519
525
|
/** The bodies that asked for a Sun-orbit line, checked: the Sun must be in the scene and the line's id free. */
|
|
520
526
|
#sunOrbitIds(ids) {
|
|
521
|
-
return [...this.#orbits].filter((id) =>
|
|
527
|
+
return [...this.#orbits].filter((id) => moonOrbitPath(this.#catalogue, id) === undefined).map((id) => {
|
|
522
528
|
if (!ids.includes(rootBodyId(this.#catalogue)))
|
|
523
529
|
throw new SceneError("no-orbit", `addBody("${id}", { orbit: true }): the orbit is drawn about the Sun, which has not been added to the scene`);
|
|
524
530
|
if (this.#taken(sunOrbitIdOf(id)))
|
|
@@ -610,6 +616,7 @@ export class Scene {
|
|
|
610
616
|
const layers = this.#deferredRead(ids, window, fault, [], () => [...this.#groupLayers(ids, window, startUtcMs, (plan) => !late(plan))]);
|
|
611
617
|
const labelled = [...this.#bodies.values(), ...tracked, ...[...this.#groups.values()]].map(({ id, label }) => ({ id, label }));
|
|
612
618
|
const catalogue = this.#catalogue;
|
|
619
|
+
checkEventObjects(this.#events, new Set(labelled.map(({ id }) => id)));
|
|
613
620
|
const definition = {
|
|
614
621
|
experience: {
|
|
615
622
|
objects: [
|
package/src/api/story.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export interface EventInput {
|
|
|
13
13
|
readonly type?: string;
|
|
14
14
|
/** Where this event's time comes from. Shown with the event; an event without one shows the `provenance` of `addEvents`. Malformed: `addEvents` throws "bad-event" naming the event. */
|
|
15
15
|
readonly provenance?: Provenance;
|
|
16
|
+
/** The body or trajectory (its id) this event is about. Go to this event seeks to its time and frames the object as `camera.lookAt` does. Not in the scene when the scene is built (`mount`): "bad-event" naming the event and the id. Without one, Go to only seeks. */
|
|
17
|
+
readonly object?: string;
|
|
16
18
|
}
|
|
17
19
|
/** Options of `addEvents`. */
|
|
18
20
|
export interface AddEventsOptions {
|
|
@@ -94,6 +96,8 @@ export interface StoryPanelsInput {
|
|
|
94
96
|
readonly autoOpen?: boolean;
|
|
95
97
|
readonly panels: readonly unknown[];
|
|
96
98
|
}
|
|
99
|
+
/** Throws "bad-event" naming the first event whose `object` is not among the scene's `objectIds`. */
|
|
100
|
+
export declare function checkEventObjects(events: readonly TimelineEvent[], objectIds: ReadonlySet<string>): void;
|
|
97
101
|
/** Checks a provenance given to `addEvents` (for the whole batch, or for the event `eventId`) and returns it frozen; throws "bad-event" when malformed. */
|
|
98
102
|
export declare function eventProvenanceOf(value: unknown, eventId?: string): Provenance;
|
|
99
103
|
/** The events merged with `inputs`, sorted by time; each needs a distinct non-empty id and label and a valid moment. */
|
package/src/api/story.js
CHANGED
|
@@ -3,6 +3,13 @@ import { createProvenance } from "../core/provenance.js";
|
|
|
3
3
|
import { parseStoryPanels, StoryPanelError } from "../shell/storyPanels.js";
|
|
4
4
|
import { SceneError } from "./errors.js";
|
|
5
5
|
import { toUtcMs } from "./time.js";
|
|
6
|
+
/** Throws "bad-event" naming the first event whose `object` is not among the scene's `objectIds`. */
|
|
7
|
+
export function checkEventObjects(events, objectIds) {
|
|
8
|
+
for (const event of events) {
|
|
9
|
+
if (event.object !== undefined && !objectIds.has(event.object))
|
|
10
|
+
throw new SceneError("bad-event", `addEvents: event "${event.id}" object "${event.object}" is not a body or trajectory in the scene`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
6
13
|
/** Checks a provenance given to `addEvents` (for the whole batch, or for the event `eventId`) and returns it frozen; throws "bad-event" when malformed. */
|
|
7
14
|
export function eventProvenanceOf(value, eventId) {
|
|
8
15
|
const where = eventId === undefined ? "addEvents: provenance" : `addEvents: event "${eventId}" provenance`;
|
|
@@ -27,7 +34,9 @@ export function eventsOf(inputs, known) {
|
|
|
27
34
|
throw new SceneError("bad-event", `addEvents: event "${input.id}" appears twice`);
|
|
28
35
|
ids.add(input.id);
|
|
29
36
|
const timeUtcMs = toUtcMs(input.time, `addEvents: event "${input.id}" time`);
|
|
30
|
-
|
|
37
|
+
if (input.object !== undefined && (typeof input.object !== "string" || input.object === ""))
|
|
38
|
+
throw new SceneError("bad-event", `addEvents: event "${input.id}" object must be a non-empty id`);
|
|
39
|
+
return { id: input.id, label: input.label, timeUtcMs, ...(input.type === undefined ? {} : { type: input.type }), ...(input.object === undefined ? {} : { object: input.object }) };
|
|
31
40
|
});
|
|
32
41
|
return createEvents([...known, ...added].sort((a, b) => a.timeUtcMs - b.timeUtcMs));
|
|
33
42
|
}
|
package/src/app/AstraeusScene.js
CHANGED
|
@@ -19,7 +19,9 @@ export function AstraeusScene(props) {
|
|
|
19
19
|
const lightLayers = useMemo(() => runtime.bodies.filter((id) => catalogue.get(id).visual.light !== undefined).map((id) => layers.get(id)), [runtime.bodies, layers, catalogue]);
|
|
20
20
|
// One frame state for the whole canvas: the scene contents decide whether a frame is drawn and the layered render obeys.
|
|
21
21
|
const frameState = useRef(createFrameState(props.controls.policy.id));
|
|
22
|
-
return (_jsxs(Canvas, { camera: { fov: 45, near: 0.05, far: runtime.cameraReach.far ?? DEFAULT_CAMERA_FAR },
|
|
22
|
+
return (_jsxs(Canvas, { camera: { fov: 45, near: 0.05, far: runtime.cameraReach.far ?? DEFAULT_CAMERA_FAR },
|
|
23
|
+
// Logarithmic depth (O-048 T-204, I-117): a planet near the camera keeps its depth precision however far the far plane reaches. Every custom shader in src/app carries the log-depth chunks (tests/logDepth.test.ts).
|
|
24
|
+
gl: { antialias: true, logarithmicDepthBuffer: true }, style: { background: "#000000" }, "data-testid": "earth-moon-canvas", "data-scene-center": runtime.sceneCenter, "data-bodies": runtime.bodies.join(","), "data-lighting": "per-body", "data-composition-paths": runtime.composition?.paths?.length ?? 0, "data-point-groups": runtime.groups.length, "data-sun-centred": (runtime.sun === undefined ? 0 : 1) + (runtime.paths?.length ?? 0), "data-rings": runtime.bodies.map((id) => (runtime.overrides?.get(id)?.rings ?? catalogue.get(id).visual.rings)?.bands.length ?? 0).reduce((sum, n) => sum + n, 0), children: [_jsx(SceneContents, { ...props, layers: layers, frameState: frameState }), _jsx(LayeredRender, { lightLayers: lightLayers, state: frameState })] }));
|
|
23
25
|
}
|
|
24
26
|
function SceneContents({ runtime, controls, readout, layers, frameState }) {
|
|
25
27
|
const catalogue = runtime.catalogue ?? builtInCatalogue;
|
package/src/app/LayeredRender.js
CHANGED
|
@@ -30,6 +30,7 @@ export function LayeredRender({ lightLayers, state }) {
|
|
|
30
30
|
gl.autoClear = previousAutoClear;
|
|
31
31
|
state.current.framesDrawn += 1;
|
|
32
32
|
gl.domElement.dataset.framesDrawn = String(state.current.framesDrawn);
|
|
33
|
+
gl.domElement.dataset.depthMode = gl.capabilities.logarithmicDepthBuffer ? "logarithmic" : "linear"; // read by the browser checks (O-048 T-209)
|
|
33
34
|
}, 1);
|
|
34
35
|
return null;
|
|
35
36
|
}
|
package/src/app/OrbitSetView.js
CHANGED
|
@@ -28,6 +28,8 @@ const JUMP_SHARE = 0.25;
|
|
|
28
28
|
/** Least re-sampling step and jump (simulation ms), for a path with no history loaded. */
|
|
29
29
|
const MIN_STEP_MS = 60_000;
|
|
30
30
|
const VERTEX = /* glsl */ `
|
|
31
|
+
#include <common>
|
|
32
|
+
#include <logdepthbuf_pars_vertex>
|
|
31
33
|
attribute float aFamily;
|
|
32
34
|
attribute float aSize;
|
|
33
35
|
attribute float aFade;
|
|
@@ -44,10 +46,13 @@ void main() {
|
|
|
44
46
|
float zoom = clamp((distanceRatio - 1.0) / (uFar - 1.0), 0.0, 1.0);
|
|
45
47
|
vColor = vec4(uColors[family], aFade * min(1.0, (uBase + zoom * uBoost) * uGains[family]));
|
|
46
48
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
49
|
+
#include <logdepthbuf_vertex>
|
|
47
50
|
}`;
|
|
48
51
|
const FRAGMENT = /* glsl */ `
|
|
52
|
+
#include <logdepthbuf_pars_fragment>
|
|
49
53
|
varying vec4 vColor;
|
|
50
54
|
void main() {
|
|
55
|
+
#include <logdepthbuf_fragment>
|
|
51
56
|
gl_FragColor = vColor;
|
|
52
57
|
#include <colorspace_fragment>
|
|
53
58
|
}`;
|
package/src/app/SceneLabels.d.ts
CHANGED
|
@@ -10,6 +10,14 @@ interface Rect {
|
|
|
10
10
|
}
|
|
11
11
|
/** Added to the selected object's label priority; larger than any labelPriority, so it is never the label hidden by an overlap. */
|
|
12
12
|
export declare const SELECTED_PRIORITY = 1000;
|
|
13
|
+
/** Screen gap (px) a label keeps from a higher-priority label it is not hiding behind. */
|
|
14
|
+
export declare const LABEL_PADDING_PX = 6;
|
|
15
|
+
/**
|
|
16
|
+
* Hysteresis (I-121): a label the last layout hid by overlap needs this much more clearance (px, on top of LABEL_PADDING_PX) before it shows again,
|
|
17
|
+
* while a label already shown keeps its place at the plain padding. So a pair crossing at fast playback swaps winner once per crossing, not every frame.
|
|
18
|
+
* One rule for every label; the selected label is placed first and never loses a collision (I-108).
|
|
19
|
+
*/
|
|
20
|
+
export declare const LABEL_REAPPEAR_MARGIN_PX = 14;
|
|
13
21
|
/** App adapter that places configured labels; the label presentation itself stays generic. */
|
|
14
22
|
export declare class SceneLabelLayer {
|
|
15
23
|
#private;
|
package/src/app/SceneLabels.js
CHANGED
|
@@ -3,12 +3,22 @@ import { createLabelElement } from "../shell/Label.js";
|
|
|
3
3
|
import { projectToScreen } from "./AnchorLabels.js";
|
|
4
4
|
/** Added to the selected object's label priority; larger than any labelPriority, so it is never the label hidden by an overlap. */
|
|
5
5
|
export const SELECTED_PRIORITY = 1_000;
|
|
6
|
+
/** Screen gap (px) a label keeps from a higher-priority label it is not hiding behind. */
|
|
7
|
+
export const LABEL_PADDING_PX = 6;
|
|
8
|
+
/**
|
|
9
|
+
* Hysteresis (I-121): a label the last layout hid by overlap needs this much more clearance (px, on top of LABEL_PADDING_PX) before it shows again,
|
|
10
|
+
* while a label already shown keeps its place at the plain padding. So a pair crossing at fast playback swaps winner once per crossing, not every frame.
|
|
11
|
+
* One rule for every label; the selected label is placed first and never loses a collision (I-108).
|
|
12
|
+
*/
|
|
13
|
+
export const LABEL_REAPPEAR_MARGIN_PX = 14;
|
|
6
14
|
/** App adapter that places configured labels; the label presentation itself stays generic. */
|
|
7
15
|
export class SceneLabelLayer {
|
|
8
16
|
#root = document.createElement("div");
|
|
9
17
|
#entries;
|
|
10
18
|
#local = new Vector3();
|
|
11
19
|
#shown = new Map();
|
|
20
|
+
/** Per object id, whether the latest layout showed it; absent when it was not a candidate (unplaced, out of reach or switched off). */
|
|
21
|
+
#lastShown = new Map();
|
|
12
22
|
constructor(host, objects) {
|
|
13
23
|
this.#root.className = "scene-labels";
|
|
14
24
|
this.#entries = objects.map((object) => {
|
|
@@ -32,6 +42,8 @@ export class SceneLabelLayer {
|
|
|
32
42
|
update(positionFor, camera, widthPx, heightPx, origin, selectedObjectId, hiddenIds) {
|
|
33
43
|
camera.updateMatrixWorld(true);
|
|
34
44
|
this.#shown.clear();
|
|
45
|
+
const previous = new Map(this.#lastShown);
|
|
46
|
+
this.#lastShown.clear();
|
|
35
47
|
const candidates = this.#entries.flatMap((entry) => {
|
|
36
48
|
if (hiddenIds?.has(entry.object.id) === true) {
|
|
37
49
|
entry.element.hidden = true;
|
|
@@ -57,15 +69,17 @@ export class SceneLabelLayer {
|
|
|
57
69
|
for (const candidate of candidates) {
|
|
58
70
|
candidate.element.hidden = false;
|
|
59
71
|
let placed = null;
|
|
72
|
+
const padding = LABEL_PADDING_PX + (previous.get(candidate.object.id) === false ? LABEL_REAPPEAR_MARGIN_PX : 0);
|
|
60
73
|
for (const [dx, dy] of [[8, 0], [-8, 0], [0, -20]]) {
|
|
61
74
|
candidate.element.style.transform = `translate(${candidate.screen.x + dx}px, ${candidate.screen.y + dy}px) translate(${dx < 0 ? "-100%" : "0"}, -50%)`;
|
|
62
75
|
const bounds = candidate.element.getBoundingClientRect();
|
|
63
76
|
const rect = { left: bounds.left, top: bounds.top, right: bounds.right, bottom: bounds.bottom };
|
|
64
|
-
if (occupied.every((other) => !overlapsWithPadding(rect, other,
|
|
77
|
+
if (occupied.every((other) => !overlapsWithPadding(rect, other, padding))) {
|
|
65
78
|
placed = rect;
|
|
66
79
|
break;
|
|
67
80
|
}
|
|
68
81
|
}
|
|
82
|
+
this.#lastShown.set(candidate.object.id, placed !== null);
|
|
69
83
|
if (placed === null) {
|
|
70
84
|
candidate.element.hidden = true;
|
|
71
85
|
}
|
package/src/app/SkyView.js
CHANGED
|
@@ -14,6 +14,8 @@ const PICTURE_GAIN = 1;
|
|
|
14
14
|
const PICTURE_DIM = 0.04;
|
|
15
15
|
/** A fixed render-frame direction used to read the sky back: where it lands on screen depends only on the camera orientation. */
|
|
16
16
|
const PROBE_DIRECTION = new Vector3(0.62, 0.35, -0.7).normalize();
|
|
17
|
+
// The sky shaders carry no log-depth chunks on purpose: both materials are drawn with depthTest and depthWrite off, so they never read or write depth
|
|
18
|
+
// (their clip position is only used to place the sky on screen, which the logarithmic depth buffer leaves unchanged).
|
|
17
19
|
const PICTURE_VERTEX = `
|
|
18
20
|
varying vec2 vUv;
|
|
19
21
|
void main() {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { JUPITER } from "../../core/bodies/jupiter.js";
|
|
2
|
+
import { JUPITER_RINGS } from "./jupiterRings.js";
|
|
2
3
|
const jupiterTextureUrl = new URL("../textures/jupiter-2k.jpg", import.meta.url).href;
|
|
3
4
|
/** Donor material (src/entities/jupiter.ts); the fallback colour under and without the texture. */
|
|
4
5
|
export const JUPITER_MATERIAL = Object.freeze({ color: "#d4a97a", roughness: 0.85, metalness: 0 });
|
|
@@ -28,6 +29,7 @@ export const JUPITER_VISUAL = Object.freeze({
|
|
|
28
29
|
texture: JUPITER_TEXTURE,
|
|
29
30
|
material: JUPITER_MATERIAL,
|
|
30
31
|
textureYawRad: 0,
|
|
32
|
+
rings: JUPITER_RINGS,
|
|
31
33
|
light: Object.freeze({ ambient: 0.08, directional: 1.4 }),
|
|
32
34
|
});
|
|
33
35
|
export const JUPITER_ENTRY = Object.freeze({ body: JUPITER.id, visual: JUPITER_VISUAL });
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { type MoonCatalogue } from "../moonCatalogue.js";
|
|
2
|
-
import { type RingSystem } from "../rings.js";
|
|
3
2
|
/** The moon lists by family of Saturn (292), Uranus (28), Neptune (16) and Pluto (5): data/moons/<planet>.json (T-115). Core data: an experience chooses which to show. */
|
|
4
3
|
export declare const SATURN_MOON_CATALOGUE: MoonCatalogue;
|
|
5
4
|
export declare const URANUS_MOON_CATALOGUE: MoonCatalogue;
|
|
6
5
|
export declare const NEPTUNE_MOON_CATALOGUE: MoonCatalogue;
|
|
7
6
|
export declare const PLUTO_MOON_CATALOGUE: MoonCatalogue;
|
|
8
|
-
|
|
9
|
-
export declare const SATURN_RINGS: RingSystem;
|
|
10
|
-
export declare const URANUS_RINGS: RingSystem;
|
|
11
|
-
export declare const NEPTUNE_RINGS: RingSystem;
|
|
7
|
+
export { NEPTUNE_RINGS, SATURN_RINGS, URANUS_RINGS } from "./outerPlanetRings.js";
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import { NEPTUNE_MOON_CATALOGUE_FILE,
|
|
1
|
+
import { NEPTUNE_MOON_CATALOGUE_FILE, PLUTO_MOON_CATALOGUE_FILE, SATURN_MOON_CATALOGUE_FILE, URANUS_MOON_CATALOGUE_FILE } from "../../core/bodies/outerPlanetData.js";
|
|
2
2
|
import { parseMoonCatalogue } from "../moonCatalogue.js";
|
|
3
|
-
import { parseRingSystem } from "../rings.js";
|
|
4
3
|
/** The moon lists by family of Saturn (292), Uranus (28), Neptune (16) and Pluto (5): data/moons/<planet>.json (T-115). Core data: an experience chooses which to show. */
|
|
5
4
|
export const SATURN_MOON_CATALOGUE = parseMoonCatalogue(SATURN_MOON_CATALOGUE_FILE);
|
|
6
5
|
export const URANUS_MOON_CATALOGUE = parseMoonCatalogue(URANUS_MOON_CATALOGUE_FILE);
|
|
7
6
|
export const NEPTUNE_MOON_CATALOGUE = parseMoonCatalogue(NEPTUNE_MOON_CATALOGUE_FILE);
|
|
8
7
|
export const PLUTO_MOON_CATALOGUE = parseMoonCatalogue(PLUTO_MOON_CATALOGUE_FILE);
|
|
9
|
-
|
|
10
|
-
export const SATURN_RINGS = parseRingSystem(SATURN_RING_FILE);
|
|
11
|
-
export const URANUS_RINGS = parseRingSystem(URANUS_RING_FILE);
|
|
12
|
-
export const NEPTUNE_RINGS = parseRingSystem(NEPTUNE_RING_FILE);
|
|
8
|
+
export { NEPTUNE_RINGS, SATURN_RINGS, URANUS_RINGS } from "./outerPlanetRings.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type RingSystem } from "../rings.js";
|
|
2
|
+
/** Ring bands from the NASA NSSDC ring fact sheets with the donor's looks (data/rings/<planet>.json, T-118). Pluto has none. Core data: the planet's catalogue visual carries them. */
|
|
3
|
+
export declare const SATURN_RINGS: RingSystem;
|
|
4
|
+
export declare const URANUS_RINGS: RingSystem;
|
|
5
|
+
export declare const NEPTUNE_RINGS: RingSystem;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { NEPTUNE_RING_FILE, SATURN_RING_FILE, URANUS_RING_FILE } from "../../core/bodies/outerPlanetRingData.js";
|
|
2
|
+
import { parseRingSystem } from "../rings.js";
|
|
3
|
+
/** Ring bands from the NASA NSSDC ring fact sheets with the donor's looks (data/rings/<planet>.json, T-118). Pluto has none. Core data: the planet's catalogue visual carries them. */
|
|
4
|
+
export const SATURN_RINGS = parseRingSystem(SATURN_RING_FILE);
|
|
5
|
+
export const URANUS_RINGS = parseRingSystem(URANUS_RING_FILE);
|
|
6
|
+
export const NEPTUNE_RINGS = parseRingSystem(NEPTUNE_RING_FILE);
|
|
@@ -4,6 +4,7 @@ import { withPicture } from "../pictures.js";
|
|
|
4
4
|
const neptuneUrl = new URL("../textures/neptune-2k.jpg", import.meta.url).href;
|
|
5
5
|
const saturnUrl = new URL("../textures/saturn-2k.jpg", import.meta.url).href;
|
|
6
6
|
const uranusUrl = new URL("../textures/uranus-2k.jpg", import.meta.url).href;
|
|
7
|
+
import { NEPTUNE_RINGS, SATURN_RINGS, URANUS_RINGS } from "./outerPlanetRings.js";
|
|
7
8
|
/**
|
|
8
9
|
* Saturn, Uranus, Neptune and Pluto, nine moons with maps, and Phobos and Deimos without (O-033 T-116). The maps are copied from Planetary Explorer
|
|
9
10
|
* (the owner's own project, donor commit 84f8d3e), byte for byte where shippable (SHA-256 equal to `data/bodies/<body>/map.json`); Dione, Triton and
|
|
@@ -30,12 +31,14 @@ const sphere = (url, widthPx, heightPx, licence, color, roughness, textureYawRad
|
|
|
30
31
|
light: LIGHT,
|
|
31
32
|
});
|
|
32
33
|
/** A sphere whose picture (and its licence) ships in astraeus-data and is registered by name; without it the sphere is a flat colour. */
|
|
34
|
+
/** A planet drawn with its rings: the ring bands (and their recorded sources) belong to the planet's one catalogue definition. */
|
|
35
|
+
const ringed = (visual, rings) => Object.freeze({ ...visual, rings });
|
|
33
36
|
const pictured = (picture, color, roughness, textureYawRad = 0) => withPicture(picture, { kind: "sphere", material: Object.freeze({ color, roughness, metalness: 0 }), textureYawRad, light: LIGHT });
|
|
34
37
|
/** Phobos and Deimos: grey spheres at their mean radius, with no map (the donor draws them as dots; no map of either is shipped). */
|
|
35
38
|
const greyBall = (color) => Object.freeze({ kind: "sphere", material: Object.freeze({ color, roughness: 0.97, metalness: 0 }), light: LIGHT });
|
|
36
|
-
export const SATURN_VISUAL = sphere(saturnUrl, 2048, 1024, solarSystemScope("Saturn", "Solar System Scope Saturn texture (donor saturn-2k.jpg, derived locally from its saturn-4k.jpg, which is the 4096x2048 file the Solar System Scope download endpoint gave; donor README: License CC BY 4.0 per the Solar System Scope textures page)"), "#d8c090", 0.85);
|
|
37
|
-
export const URANUS_VISUAL = sphere(uranusUrl, 2048, 1024, solarSystemScope("Uranus", "Solar System Scope 2k_uranus.jpg (byte-identical to the donor's uranus-2k.jpg; no donor README entry, source recorded by Astraeus in tools/import/planetary-explorer-map-sources.json)"), "#9fd5df", 0.85);
|
|
38
|
-
export const NEPTUNE_VISUAL = sphere(neptuneUrl, 2048, 1024, solarSystemScope("Neptune", "Solar System Scope 2k_neptune.jpg (byte-identical to the donor's neptune-2k.jpg; no donor README entry, source recorded by Astraeus in tools/import/planetary-explorer-map-sources.json)"), "#4a6fd0", 0.85);
|
|
39
|
+
export const SATURN_VISUAL = ringed(sphere(saturnUrl, 2048, 1024, solarSystemScope("Saturn", "Solar System Scope Saturn texture (donor saturn-2k.jpg, derived locally from its saturn-4k.jpg, which is the 4096x2048 file the Solar System Scope download endpoint gave; donor README: License CC BY 4.0 per the Solar System Scope textures page)"), "#d8c090", 0.85), SATURN_RINGS);
|
|
40
|
+
export const URANUS_VISUAL = ringed(sphere(uranusUrl, 2048, 1024, solarSystemScope("Uranus", "Solar System Scope 2k_uranus.jpg (byte-identical to the donor's uranus-2k.jpg; no donor README entry, source recorded by Astraeus in tools/import/planetary-explorer-map-sources.json)"), "#9fd5df", 0.85), URANUS_RINGS);
|
|
41
|
+
export const NEPTUNE_VISUAL = ringed(sphere(neptuneUrl, 2048, 1024, solarSystemScope("Neptune", "Solar System Scope 2k_neptune.jpg (byte-identical to the donor's neptune-2k.jpg; no donor README entry, source recorded by Astraeus in tools/import/planetary-explorer-map-sources.json)"), "#4a6fd0", 0.85), NEPTUNE_RINGS);
|
|
39
42
|
export const PLUTO_VISUAL = pictured("pluto", "#c4a58a", 0.95, Math.PI);
|
|
40
43
|
export const MIMAS_VISUAL = pictured("mimas", "#a8a8a8", 0.95);
|
|
41
44
|
export const ENCELADUS_VISUAL = pictured("enceladus", "#e8eef0", 0.9);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { IO_PERIOD_DAYS } from "../core/bodies/io.js";
|
|
2
|
+
import { MOON_SIDEREAL_PERIOD_DAYS } from "../core/bodies/moon.js";
|
|
2
3
|
import { catalogue } from "./catalogue.js";
|
|
3
4
|
import { resolveOrbitLook } from "./orbitLook.js";
|
|
4
5
|
/** One sidereal month, the span the Moon's orbit path covers. */
|
|
5
|
-
export const SIDEREAL_MONTH_MS =
|
|
6
|
+
export const SIDEREAL_MONTH_MS = MOON_SIDEREAL_PERIOD_DAYS * 86_400_000;
|
|
6
7
|
export class CompositionError extends RangeError {
|
|
7
8
|
constructor(message) {
|
|
8
9
|
super(message);
|
package/src/assets/visual.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export interface BodyVisual {
|
|
|
46
46
|
readonly marker?: {
|
|
47
47
|
readonly sizePx: number;
|
|
48
48
|
};
|
|
49
|
-
/** Flat ring bands in the body's equator plane, at their real radii;
|
|
49
|
+
/** Flat ring bands in the body's equator plane, at their real radii; a ringed planet carries them in its catalogue visual, so every scene that adds it draws them (an override may still replace them). */
|
|
50
50
|
readonly rings?: RingSystem;
|
|
51
51
|
/** This body's own lights in its render pass. */
|
|
52
52
|
readonly light?: {
|
package/src/core/bodies/io.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { iauElementsFromRecord } from "../iauRotation.js";
|
|
2
|
+
import { recordPeriodDays } from "../siderealPeriod.js";
|
|
2
3
|
import { JUPITER } from "./jupiter.js";
|
|
3
4
|
import { chunksNeeded, createMoonSystem, HISTORICAL_MOON_FIT_SPAN, moonFitSource } from "./moonSystem.js";
|
|
4
5
|
import callistoOrbit from "../../../data/orbits/callisto.json" with { type: "json" };
|
|
@@ -27,10 +28,10 @@ export const FITTED_MOON_TIDAL_LOCK = JUPITER_MOON_SYSTEM.tidalLockNote;
|
|
|
27
28
|
export const fittedMoonPosition = JUPITER_MOON_SYSTEM.position;
|
|
28
29
|
/** The Galilean moons turn synchronously: their prime meridians are the IAU records saved with their orbits (`data/orbits/`), the one source. */
|
|
29
30
|
export const IO_ROTATION = iauElementsFromRecord(ioOrbit.rotation);
|
|
30
|
-
const jupiterMoon = (id, label, radiusKm, gmKm3S2, worstM, header) => JUPITER_MOON_SYSTEM.mappedMoon({ id, label, radiusKm, gmKm3S2, worstM, header, span: HISTORICAL_MOON_FIT_SPAN });
|
|
31
|
-
export const EUROPA = jupiterMoon("europa", "Europa", 1560.8, 3202.7121, 0.163, "Mean radius (km) = 1560.8 +- 0.3, GM (km^3/s^2) = 3202.7121 +- 0.0054");
|
|
32
|
-
export const GANYMEDE = jupiterMoon("ganymede", "Ganymede", 2631.2, 9887.8328, 0.1206, "Mean radius (km) = 2631.2 +- 1.7, GM (km^3/s^2) = 9887.8328 +- 0.0074");
|
|
33
|
-
export const CALLISTO = jupiterMoon("callisto", "Callisto", 2410.3, 7179.2834, 0.0947, "Mean radius (km) = 2410.3 +- 1.5, GM (km^3/s^2) = 7179.2834 +- 0.0097");
|
|
31
|
+
const jupiterMoon = (id, label, radiusKm, gmKm3S2, worstM, header, orbit) => JUPITER_MOON_SYSTEM.mappedMoon({ id, label, radiusKm, gmKm3S2, worstM, header, orbitPeriodDays: recordPeriodDays(orbit), span: HISTORICAL_MOON_FIT_SPAN });
|
|
32
|
+
export const EUROPA = jupiterMoon("europa", "Europa", 1560.8, 3202.7121, 0.163, "Mean radius (km) = 1560.8 +- 0.3, GM (km^3/s^2) = 3202.7121 +- 0.0054", europaOrbit);
|
|
33
|
+
export const GANYMEDE = jupiterMoon("ganymede", "Ganymede", 2631.2, 9887.8328, 0.1206, "Mean radius (km) = 2631.2 +- 1.7, GM (km^3/s^2) = 9887.8328 +- 0.0074", ganymedeOrbit);
|
|
34
|
+
export const CALLISTO = jupiterMoon("callisto", "Callisto", 2410.3, 7179.2834, 0.0947, "Mean radius (km) = 2410.3 +- 1.5, GM (km^3/s^2) = 7179.2834 +- 0.0097", callistoOrbit);
|
|
34
35
|
/** Io's binding is in `io.ts` with its definition; the three below are the same pattern. */
|
|
35
36
|
export const IO_FITTED_BINDING = JUPITER_MOON_SYSTEM.binding("io", IO_ROTATION);
|
|
36
37
|
export const MAPPED_MOON_BINDINGS = Object.freeze([
|
|
@@ -8,4 +8,6 @@ export declare const MOON_IAU_REPORT = "Archinal et al., Report of the IAU Worki
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const MOON_ROTATION: IauRotationElements;
|
|
10
10
|
export declare const MOON_EPHEMERIS: EphemerisRecord;
|
|
11
|
+
/** One sidereal month, days: the Moon's period about Earth. */
|
|
12
|
+
export declare const MOON_SIDEREAL_PERIOD_DAYS = 27.321661;
|
|
11
13
|
export declare const MOON: CelestialBodyDefinition;
|
package/src/core/bodies/moon.js
CHANGED
|
@@ -36,6 +36,8 @@ export const MOON_EPHEMERIS = {
|
|
|
36
36
|
"No velocity is modelled for the Moon, so it has no speed readout.",
|
|
37
37
|
],
|
|
38
38
|
};
|
|
39
|
+
/** One sidereal month, days: the Moon's period about Earth. */
|
|
40
|
+
export const MOON_SIDEREAL_PERIOD_DAYS = 27.321661;
|
|
39
41
|
export const MOON = Object.freeze({
|
|
40
42
|
id: "moon",
|
|
41
43
|
label: "Moon",
|
|
@@ -43,6 +45,8 @@ export const MOON = Object.freeze({
|
|
|
43
45
|
radiusKm: 1737.4,
|
|
44
46
|
gmKm3S2: 4902.800066,
|
|
45
47
|
parentId: "earth",
|
|
48
|
+
orbitPeriodDays: MOON_SIDEREAL_PERIOD_DAYS,
|
|
49
|
+
orbitLineFades: true,
|
|
46
50
|
orientation: "iau-rotation",
|
|
47
51
|
accuracy: Object.freeze({
|
|
48
52
|
dimensions: createProvenance({
|
|
@@ -102,6 +102,8 @@ export interface MappedMoonFacts {
|
|
|
102
102
|
/** Absent when the source prints a mass only. */
|
|
103
103
|
readonly gmKm3S2?: number;
|
|
104
104
|
readonly worstM: number;
|
|
105
|
+
/** Sidereal period about the centre, days, from the moon's mean-element record; absent where there is none. */
|
|
106
|
+
readonly orbitPeriodDays?: number;
|
|
105
107
|
/** The years this moon's committed fits cover; absent means `MOON_FIT_SPAN`. */
|
|
106
108
|
readonly span?: TimeBounds;
|
|
107
109
|
/** The physical-properties lines of the Horizons header the numbers are read from. */
|
|
@@ -184,6 +184,7 @@ export function createMoonSystem(config) {
|
|
|
184
184
|
radiusKm: moon.radiusKm,
|
|
185
185
|
...(moon.gmKm3S2 === undefined ? {} : { gmKm3S2: moon.gmKm3S2 }),
|
|
186
186
|
parentId: config.centre,
|
|
187
|
+
...(moon.orbitPeriodDays === undefined ? {} : { orbitPeriodDays: moon.orbitPeriodDays }),
|
|
187
188
|
orientation: "tidal-lock",
|
|
188
189
|
accuracy: Object.freeze({
|
|
189
190
|
dimensions: createProvenance({
|
|
@@ -2,6 +2,3 @@ export declare const SATURN_MOON_CATALOGUE_FILE: unknown;
|
|
|
2
2
|
export declare const URANUS_MOON_CATALOGUE_FILE: unknown;
|
|
3
3
|
export declare const NEPTUNE_MOON_CATALOGUE_FILE: unknown;
|
|
4
4
|
export declare const PLUTO_MOON_CATALOGUE_FILE: unknown;
|
|
5
|
-
export declare const SATURN_RING_FILE: unknown;
|
|
6
|
-
export declare const URANUS_RING_FILE: unknown;
|
|
7
|
-
export declare const NEPTUNE_RING_FILE: unknown;
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Saturn's, Uranus's, Neptune's and Pluto's core data files as they are read (O-033 T-118; moon data is core): the moon lists by family
|
|
3
|
-
* (data/moons/<planet>.json, T-115)
|
|
3
|
+
* (data/moons/<planet>.json, T-115). Raw JSON: src/assets parses and checks them (layer rule:
|
|
4
4
|
* assets reach data through core), as `jupiterData.ts` does for Jupiter.
|
|
5
5
|
*/
|
|
6
6
|
import neptuneMoons from "../../../data/moons/neptune.json" with { type: "json" };
|
|
7
7
|
import plutoMoons from "../../../data/moons/pluto.json" with { type: "json" };
|
|
8
8
|
import saturnMoons from "../../../data/moons/saturn.json" with { type: "json" };
|
|
9
9
|
import uranusMoons from "../../../data/moons/uranus.json" with { type: "json" };
|
|
10
|
-
import neptuneRings from "../../../data/rings/neptune.json" with { type: "json" };
|
|
11
|
-
import saturnRings from "../../../data/rings/saturn.json" with { type: "json" };
|
|
12
|
-
import uranusRings from "../../../data/rings/uranus.json" with { type: "json" };
|
|
13
10
|
export const SATURN_MOON_CATALOGUE_FILE = saturnMoons;
|
|
14
11
|
export const URANUS_MOON_CATALOGUE_FILE = uranusMoons;
|
|
15
12
|
export const NEPTUNE_MOON_CATALOGUE_FILE = neptuneMoons;
|
|
16
13
|
export const PLUTO_MOON_CATALOGUE_FILE = plutoMoons;
|
|
17
|
-
export const SATURN_RING_FILE = saturnRings;
|
|
18
|
-
export const URANUS_RING_FILE = uranusRings;
|
|
19
|
-
export const NEPTUNE_RING_FILE = neptuneRings;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Saturn's, Uranus's and Neptune's ring bands as they are read (data/rings/<planet>.json, O-033 T-118). Raw JSON in its own file, apart from the moon lists
|
|
3
|
+
* in `outerPlanetData.ts`, so a planet that carries its rings in the catalogue (O-048 T-205) does not pull the moon lists into the first download.
|
|
4
|
+
*/
|
|
5
|
+
import neptuneRings from "../../../data/rings/neptune.json" with { type: "json" };
|
|
6
|
+
import saturnRings from "../../../data/rings/saturn.json" with { type: "json" };
|
|
7
|
+
import uranusRings from "../../../data/rings/uranus.json" with { type: "json" };
|
|
8
|
+
export const SATURN_RING_FILE = saturnRings;
|
|
9
|
+
export const URANUS_RING_FILE = uranusRings;
|
|
10
|
+
export const NEPTUNE_RING_FILE = neptuneRings;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { iauElementsFromRecord } from "../iauRotation.js";
|
|
2
|
+
import { recordPeriodDays } from "../siderealPeriod.js";
|
|
2
3
|
import { createPlanetSunTrajectory } from "./planetTrajectory.js";
|
|
3
4
|
import { MARS } from "./mars.js";
|
|
4
5
|
import { createMoonSystem, HISTORICAL_MOON_FIT_SPAN, moonFitSource } from "./moonSystem.js";
|
|
@@ -34,16 +35,16 @@ const marsMoon = (id, label, radiusKm, massKg, worstM, header) => MARS_MOON_SYST
|
|
|
34
35
|
});
|
|
35
36
|
export const PHOBOS = marsMoon("phobos", "Phobos", 11.08, 1.08e16, 0.0593, "Radius (km) = 13.1 x11.1 x9.3 Density (g cm^-3) = 1.90 +- 0.08; Mass (10^20 kg ) = 1.08 (10^-4)");
|
|
36
37
|
export const DEIMOS = marsMoon("deimos", "Deimos", 6.2, 1.8e15, 0.5101, "Radius (km) = 7.8 x 6.0 x 5.1 Density (g cm^-3) = 1.76 +- 0.30; Mass (10^20 kg ) = 1.80 (10^-5)");
|
|
37
|
-
const saturnMoon = (id, label, radiusKm, gmKm3S2, worstM, header) => SATURN_MOON_SYSTEM.mappedMoon({ id, label, radiusKm, gmKm3S2, worstM, header, span: HISTORICAL_MOON_FIT_SPAN });
|
|
38
|
-
export const MIMAS = saturnMoon("mimas", "Mimas", 198.8, 2.503489, 0.1777, "Mean Radius (km) = 198.8 +- 1.5, GM (km^3/s^2) = 2.503489");
|
|
39
|
-
export const ENCELADUS = saturnMoon("enceladus", "Enceladus", 252.3, 7.210367, 0.155, "Mean Radius (km) = 252.3 +- 0.6, GM (km^3/s^2) = 7.210367");
|
|
40
|
-
export const TETHYS = saturnMoon("tethys", "Tethys", 536.3, 41.21, 0.1733, "Mean Radius (km) = 536.3 +- 1.5, GM (km^3/s^2) = 41.21 +- 0.007");
|
|
41
|
-
export const DIONE = saturnMoon("dione", "Dione", 562.5, 73.116, 0.1322, "Mean Radius (km) = 562.5 +- 5, GM (km^3/s^2) = 73.116 +- 0.02");
|
|
42
|
-
export const RHEA = saturnMoon("rhea", "Rhea", 764.5, 153.94, 0.1271, "Mean Radius (km) = 764.5 +- 2, GM (km^3/s^2) = 153.94 +- 0.16");
|
|
43
|
-
export const TITAN = saturnMoon("titan", "Titan", 2575.5, 8978.14, 0.5305, "Mean Radius (km) = 2575.5 +- 2.0, GM (km^3/s^2) = 8978.14 +- 0.06");
|
|
44
|
-
export const IAPETUS = saturnMoon("iapetus", "Iapetus", 734.5, 120.52, 0.0715, "Radius (km) = 734.5 +- 4.0, GM (km^3/s^2) = 120.52 +- 0.03");
|
|
45
|
-
export const TRITON = NEPTUNE_MOON_SYSTEM.mappedMoon({ id: "triton", label: "Triton", radiusKm: 1352.6, gmKm3S2: 1428.495, worstM: 0.5118, span: HISTORICAL_MOON_FIT_SPAN, header: "Mean radius (km) = 1352.6 +- 2.4, GM (km^3/s^2) = 1428.495 +- 0.62" });
|
|
46
|
-
export const CHARON = PLUTO_MOON_SYSTEM.mappedMoon({ id: "charon", label: "Charon", radiusKm: 606, gmKm3S2: 106.10, worstM: 0.6237, header: "GM (km^3/s^2) = 106.10 +- 0.3, Radius (km, IAU2015) = 606 +- 0.5" });
|
|
38
|
+
const saturnMoon = (id, label, radiusKm, gmKm3S2, worstM, header, orbit) => SATURN_MOON_SYSTEM.mappedMoon({ id, label, radiusKm, gmKm3S2, worstM, header, orbitPeriodDays: recordPeriodDays(orbit), span: HISTORICAL_MOON_FIT_SPAN });
|
|
39
|
+
export const MIMAS = saturnMoon("mimas", "Mimas", 198.8, 2.503489, 0.1777, "Mean Radius (km) = 198.8 +- 1.5, GM (km^3/s^2) = 2.503489", mimasOrbit);
|
|
40
|
+
export const ENCELADUS = saturnMoon("enceladus", "Enceladus", 252.3, 7.210367, 0.155, "Mean Radius (km) = 252.3 +- 0.6, GM (km^3/s^2) = 7.210367", enceladusOrbit);
|
|
41
|
+
export const TETHYS = saturnMoon("tethys", "Tethys", 536.3, 41.21, 0.1733, "Mean Radius (km) = 536.3 +- 1.5, GM (km^3/s^2) = 41.21 +- 0.007", tethysOrbit);
|
|
42
|
+
export const DIONE = saturnMoon("dione", "Dione", 562.5, 73.116, 0.1322, "Mean Radius (km) = 562.5 +- 5, GM (km^3/s^2) = 73.116 +- 0.02", dioneOrbit);
|
|
43
|
+
export const RHEA = saturnMoon("rhea", "Rhea", 764.5, 153.94, 0.1271, "Mean Radius (km) = 764.5 +- 2, GM (km^3/s^2) = 153.94 +- 0.16", rheaOrbit);
|
|
44
|
+
export const TITAN = saturnMoon("titan", "Titan", 2575.5, 8978.14, 0.5305, "Mean Radius (km) = 2575.5 +- 2.0, GM (km^3/s^2) = 8978.14 +- 0.06", titanOrbit);
|
|
45
|
+
export const IAPETUS = saturnMoon("iapetus", "Iapetus", 734.5, 120.52, 0.0715, "Radius (km) = 734.5 +- 4.0, GM (km^3/s^2) = 120.52 +- 0.03", iapetusOrbit);
|
|
46
|
+
export const TRITON = NEPTUNE_MOON_SYSTEM.mappedMoon({ id: "triton", label: "Triton", radiusKm: 1352.6, gmKm3S2: 1428.495, worstM: 0.5118, orbitPeriodDays: recordPeriodDays(tritonOrbit), span: HISTORICAL_MOON_FIT_SPAN, header: "Mean radius (km) = 1352.6 +- 2.4, GM (km^3/s^2) = 1428.495 +- 0.62" });
|
|
47
|
+
export const CHARON = PLUTO_MOON_SYSTEM.mappedMoon({ id: "charon", label: "Charon", radiusKm: 606, gmKm3S2: 106.10, worstM: 0.6237, orbitPeriodDays: recordPeriodDays(charonOrbit), header: "GM (km^3/s^2) = 106.10 +- 0.3, Radius (km, IAU2015) = 606 +- 0.5" });
|
|
47
48
|
/** The mapped moons by system, in the order the moon lists give them. */
|
|
48
49
|
export const PLANET_MOON_DEFINITIONS = Object.freeze([PHOBOS, DEIMOS, MIMAS, ENCELADUS, TETHYS, DIONE, RHEA, TITAN, IAPETUS, TRITON, CHARON]);
|
|
49
50
|
export const PLANET_MOON_BINDINGS = Object.freeze([
|
package/src/core/body.d.ts
CHANGED
|
@@ -26,6 +26,10 @@ export interface CelestialBodyDefinition {
|
|
|
26
26
|
readonly gmKm3S2?: number;
|
|
27
27
|
/** The one centre this body's own provider computes in; absent only for the root. */
|
|
28
28
|
readonly parentId?: BodyId;
|
|
29
|
+
/** A moon's sidereal period about its parent, days, from its catalogue record or mean elements: what an orbit line spans (read once; absent where the data give none). */
|
|
30
|
+
readonly orbitPeriodDays?: number;
|
|
31
|
+
/** True when this moon's orbit line keeps the default fading end instead of closing its loop (the Moon's, which is not drawn from a full-lap record). */
|
|
32
|
+
readonly orbitLineFades?: boolean;
|
|
29
33
|
readonly orientation: OrientationModel;
|
|
30
34
|
/** What is claimed, over which dates, and what is known to be off. Never affects State. */
|
|
31
35
|
readonly accuracy: {
|
package/src/core/events.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export interface TimelineEvent {
|
|
|
4
4
|
readonly id: string;
|
|
5
5
|
readonly label: string;
|
|
6
6
|
readonly type?: string;
|
|
7
|
+
/** The id of an object in the scene the event is about; Go to frames it. */
|
|
8
|
+
readonly object?: string;
|
|
7
9
|
}
|
|
8
10
|
/** Validates and returns a frozen copy: times sorted ascending (ties allowed), ids unique. */
|
|
9
11
|
export declare function createEvents(input: readonly TimelineEvent[]): readonly TimelineEvent[];
|
|
@@ -38,14 +38,8 @@ export interface MeanElementRecord {
|
|
|
38
38
|
readonly gmKm3S2: number;
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
* `table`: P is already the sidereal period (the Saturn and Neptune rows; Mimas 0.942422 d is the known sidereal period).
|
|
44
|
-
* `apsis-corrected`: P is the period of M alone and the periapsis also moves once round per `apsisPeriodYears`; the mean longitude
|
|
45
|
-
* then turns once per 1 / (1/P - 1/Papsis), the rule Io's definition uses (the Jovian rows).
|
|
46
|
-
*/
|
|
47
|
-
export type PeriodRule = "table" | "apsis-corrected" | "iau-rate";
|
|
48
|
-
export declare function siderealPeriodDaysFor(record: MeanElementRecord, rule: PeriodRule): number;
|
|
41
|
+
import { siderealPeriodDaysFor, type PeriodRule } from "./siderealPeriod.js";
|
|
42
|
+
export { siderealPeriodDaysFor, type PeriodRule };
|
|
49
43
|
/** The instant the elements hold, UTC milliseconds: JD(TDB) taken as TT, less TT minus UTC. */
|
|
50
44
|
export declare function epochUtcMsOf(record: MeanElementRecord): number;
|
|
51
45
|
/**
|
|
@@ -5,21 +5,8 @@ import { createOrbTwoBodyAdapter } from "./twoBodyAdapter.js";
|
|
|
5
5
|
const DEGREES = Math.PI / 180;
|
|
6
6
|
const DAY_MS = 86_400_000;
|
|
7
7
|
const UNIX_EPOCH_JD = 2440587.5;
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
const { periodDays, apsisPeriodYears } = record.elements;
|
|
11
|
-
if (rule === "table")
|
|
12
|
-
return periodDays;
|
|
13
|
-
if (rule === "iau-rate") {
|
|
14
|
-
const rate = record.rotation?.primeMeridianDeg.perDay;
|
|
15
|
-
if (rate === undefined || rate === 0)
|
|
16
|
-
throw new RangeError(`${record.id}: no IAU rotation rate`);
|
|
17
|
-
return 360 / Math.abs(rate);
|
|
18
|
-
}
|
|
19
|
-
if (apsisPeriodYears === null)
|
|
20
|
-
throw new RangeError(`${record.id}: the table gives no period of the apsides`);
|
|
21
|
-
return 1 / (1 / periodDays - 1 / (apsisPeriodYears * DAYS_PER_YEAR));
|
|
22
|
-
}
|
|
8
|
+
import { siderealPeriodDaysFor } from "./siderealPeriod.js";
|
|
9
|
+
export { siderealPeriodDaysFor };
|
|
23
10
|
/** The instant the elements hold, UTC milliseconds: JD(TDB) taken as TT, less TT minus UTC. */
|
|
24
11
|
export function epochUtcMsOf(record) {
|
|
25
12
|
return Math.round((record.epoch.jdTdb - UNIX_EPOCH_JD) * DAY_MS - record.epoch.ttMinusUtcSeconds * 1000);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** The fields of a `data/orbits/*.json` record the period reads. */
|
|
2
|
+
export interface PeriodRecord {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly elements: {
|
|
5
|
+
readonly periodDays: number;
|
|
6
|
+
readonly apsisPeriodYears: number | null;
|
|
7
|
+
};
|
|
8
|
+
readonly rotation?: {
|
|
9
|
+
readonly primeMeridianDeg: {
|
|
10
|
+
readonly perDay: number;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* How the table's period P becomes the rate of the mean longitude of a fixed ellipse.
|
|
16
|
+
* `table`: P is already the sidereal period (the Saturn and Neptune rows; Mimas 0.942422 d is the known sidereal period).
|
|
17
|
+
* `apsis-corrected`: P is the period of M alone and the periapsis also moves once round per `apsisPeriodYears`; the mean longitude
|
|
18
|
+
* then turns once per 1 / (1/P - 1/Papsis), the rule Io's definition uses (the Jovian rows).
|
|
19
|
+
*/
|
|
20
|
+
export type PeriodRule = "table" | "apsis-corrected" | "iau-rate";
|
|
21
|
+
export declare function siderealPeriodDaysFor(record: PeriodRecord, rule: PeriodRule): number;
|
|
22
|
+
/** The record's sidereal period, days, by the rule the record itself names (`model.periodRule`). */
|
|
23
|
+
export declare const recordPeriodDays: (record: PeriodRecord & {
|
|
24
|
+
readonly model: {
|
|
25
|
+
readonly periodRule: string;
|
|
26
|
+
};
|
|
27
|
+
}) => number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// A mean-element record's sidereal period, kept apart from the propagator so a body definition can read it without loading the two-body code.
|
|
2
|
+
const DAYS_PER_YEAR = 365.25;
|
|
3
|
+
export function siderealPeriodDaysFor(record, rule) {
|
|
4
|
+
const { periodDays, apsisPeriodYears } = record.elements;
|
|
5
|
+
if (rule === "table")
|
|
6
|
+
return periodDays;
|
|
7
|
+
if (rule === "iau-rate") {
|
|
8
|
+
const rate = record.rotation?.primeMeridianDeg.perDay;
|
|
9
|
+
if (rate === undefined || rate === 0)
|
|
10
|
+
throw new RangeError(`${record.id}: no IAU rotation rate`);
|
|
11
|
+
return 360 / Math.abs(rate);
|
|
12
|
+
}
|
|
13
|
+
if (apsisPeriodYears === null)
|
|
14
|
+
throw new RangeError(`${record.id}: the table gives no period of the apsides`);
|
|
15
|
+
return 1 / (1 / periodDays - 1 / (apsisPeriodYears * DAYS_PER_YEAR));
|
|
16
|
+
}
|
|
17
|
+
/** The record's sidereal period, days, by the rule the record itself names (`model.periodRule`). */
|
|
18
|
+
export const recordPeriodDays = (record) => siderealPeriodDaysFor(record, record.model.periodRule);
|
|
@@ -192,9 +192,9 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
};
|
|
195
|
-
const activatePreset = (preset) => {
|
|
195
|
+
const activatePreset = (preset, atUtcMs = snapshot.timeUtcMs) => {
|
|
196
196
|
if (preset.request.kind !== "overview") {
|
|
197
|
-
const target = availableObjectById(experience, preset.request.target,
|
|
197
|
+
const target = availableObjectById(experience, preset.request.target, atUtcMs);
|
|
198
198
|
if (target === undefined)
|
|
199
199
|
return;
|
|
200
200
|
setSelectedObjectId(target.id);
|
|
@@ -205,6 +205,10 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
205
205
|
};
|
|
206
206
|
const seekToEvent = (event) => {
|
|
207
207
|
seek(event.timeUtcMs);
|
|
208
|
+
// The event's own object, framed as the picker's Focus does (and `camera.lookAt` opens): the event, never a default body, names it.
|
|
209
|
+
const object = event.object === undefined ? undefined : availableObjectById(experience, event.object, event.timeUtcMs);
|
|
210
|
+
if (object !== undefined)
|
|
211
|
+
activatePreset(focusPresetFor(experience, object), event.timeUtcMs);
|
|
208
212
|
if (info?.kind === "event")
|
|
209
213
|
setInfo({ kind: "event", id: event.id });
|
|
210
214
|
};
|
|
@@ -188,9 +188,9 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
|
-
const activatePreset = (preset) => {
|
|
191
|
+
const activatePreset = (preset, atUtcMs = snapshot.timeUtcMs) => {
|
|
192
192
|
if (preset.request.kind !== "overview") {
|
|
193
|
-
const target = availableObjectById(experience, preset.request.target,
|
|
193
|
+
const target = availableObjectById(experience, preset.request.target, atUtcMs);
|
|
194
194
|
if (target === undefined)
|
|
195
195
|
return;
|
|
196
196
|
setSelectedObjectId(target.id);
|
|
@@ -201,6 +201,10 @@ export function AstraeusShell({ experience, snapshot, developerMode, onDeveloper
|
|
|
201
201
|
};
|
|
202
202
|
const seekToEvent = (event) => {
|
|
203
203
|
seek(event.timeUtcMs);
|
|
204
|
+
// The event's own object, framed as the picker's Focus does (and `camera.lookAt` opens): the event, never a default body, names it.
|
|
205
|
+
const object = event.object === undefined ? undefined : availableObjectById(experience, event.object, event.timeUtcMs);
|
|
206
|
+
if (object !== undefined)
|
|
207
|
+
activatePreset(focusPresetFor(experience, object), event.timeUtcMs);
|
|
204
208
|
if (info?.kind === "event")
|
|
205
209
|
setInfo({ kind: "event", id: event.id });
|
|
206
210
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// O-047 T-203: a made-up probe journey from 1977 out to 170 AU, built only through the public Scene API (ARCH-01: no real mission, name or data).
|
|
2
2
|
// It leaves Earth's place on 5 September 1977, passes Jupiter on 5 March 1979 and Saturn on 12 November 1980, then flies straight out to 170 AU by 1 January 2026.
|
|
3
|
+
// The giant planets draw their rings by default (catalogue data, O-048 T-205), Europa, Ganymede and Titan draw their orbit lines (T-206) and each pass names its planet as the event's object (T-207).
|
|
3
4
|
// In one scene it proves: moons at historical dates (the data packages are handed to `toDefinition`), Saturn's orbit line, paced playback, provenance that changes along the path,
|
|
4
5
|
// the opening selection and a camera that zooms out to the whole path (I-114). The planets' places come from the planet series, so the series must be loaded before this builds (the site does).
|
|
5
6
|
import { Scene } from "../api/scene.js";
|
|
@@ -22,8 +23,8 @@ const scaled = (a, k) => [a[0] * k, a[1] * k, a[2] * k];
|
|
|
22
23
|
const made = (stretch, accuracy, sourceType) => ({ sourceType, sources: [`Made up for the journey test (${stretch}); not a real spacecraft`], accuracy, notes: "Exists to prove a long recorded path, moons at their dates and paced playback." });
|
|
23
24
|
/** The made-up journey as a Scene. Needs the planet series loaded (it reads Earth, Jupiter and Saturn from the Sun). */
|
|
24
25
|
export function buildSyntheticJourneyScene() {
|
|
25
|
-
const scene = new Scene().addBody(sun).addBody(earth, { enlarge: 60, orbit: true }).addBody(jupiter, { orbit: true }).addBody(io, { orbit: true }).addBody(europa).addBody(ganymede).addBody(callisto)
|
|
26
|
-
.addBody(saturn, { orbit: true }).addBody(mimas).addBody(enceladus).addBody(tethys).addBody(dione).addBody(rhea).addBody(titan).addBody(iapetus).setTime(JOURNEY_LAUNCH_UTC_MS);
|
|
26
|
+
const scene = new Scene().addBody(sun).addBody(earth, { enlarge: 60, orbit: true }).addBody(jupiter, { orbit: true }).addBody(io, { orbit: true }).addBody(europa, { orbit: true }).addBody(ganymede, { orbit: true }).addBody(callisto)
|
|
27
|
+
.addBody(saturn, { orbit: true }).addBody(mimas).addBody(enceladus).addBody(tethys).addBody(dione).addBody(rhea).addBody(titan, { orbit: true }).addBody(iapetus).setTime(JOURNEY_LAUNCH_UTC_MS);
|
|
27
28
|
const place = (id, time) => [...scene.stateOf(id, time).positionKm];
|
|
28
29
|
const pass = (id, time) => { const p = place(id, time); return scaled(p, 1 + PASS_KM / length(p)); };
|
|
29
30
|
const launch = place("earth", JOURNEY_LAUNCH_UTC_MS);
|
|
@@ -56,8 +57,8 @@ export function buildSyntheticJourneyScene() {
|
|
|
56
57
|
anchors: [{ id: "traveller-jupiter", time: JOURNEY_JUPITER_UTC_MS }, { id: "traveller-saturn", time: JOURNEY_SATURN_UTC_MS }],
|
|
57
58
|
});
|
|
58
59
|
scene.addEvents([
|
|
59
|
-
{ id: "traveller-jupiter", label: "Made-up pass of Jupiter", time: JOURNEY_JUPITER_UTC_MS, type: "encounter" },
|
|
60
|
-
{ id: "traveller-saturn", label: "Made-up pass of Saturn", time: JOURNEY_SATURN_UTC_MS, type: "encounter" },
|
|
60
|
+
{ id: "traveller-jupiter", label: "Made-up pass of Jupiter", time: JOURNEY_JUPITER_UTC_MS, type: "encounter", object: "jupiter" },
|
|
61
|
+
{ id: "traveller-saturn", label: "Made-up pass of Saturn", time: JOURNEY_SATURN_UTC_MS, type: "encounter", object: "saturn" },
|
|
61
62
|
], { provenance: { sourceType: "illustrative", sources: ["Made up"], accuracy: "None claimed.", notes: "Not real passes." } });
|
|
62
63
|
scene.setTimeline({
|
|
63
64
|
start: JOURNEY_LAUNCH_UTC_MS,
|