astraeus 0.5.0 → 0.6.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.
Files changed (67) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +3 -3
  3. package/data/moons/jupiter.json +351 -115
  4. package/data/moons/neptune.json +54 -16
  5. package/data/moons/pluto.json +21 -5
  6. package/data/moons/saturn.json +882 -292
  7. package/data/moons/uranus.json +90 -28
  8. package/package.json +1 -1
  9. package/src/api/bodies.d.ts +6 -1
  10. package/src/api/bodies.js +15 -2
  11. package/src/api/data.d.ts +2 -1
  12. package/src/api/data.js +4 -13
  13. package/src/api/index.d.ts +1 -1
  14. package/src/api/index.js +1 -1
  15. package/src/api/index.node.js +1 -1
  16. package/src/api/scene.js +43 -19
  17. package/src/api/story.d.ts +4 -0
  18. package/src/api/story.js +10 -1
  19. package/src/app/AstraeusScene.js +3 -1
  20. package/src/app/LayeredRender.js +1 -0
  21. package/src/app/OrbitSetView.js +5 -0
  22. package/src/app/PathView.d.ts +3 -2
  23. package/src/app/PathView.js +5 -5
  24. package/src/app/SceneLabels.d.ts +8 -0
  25. package/src/app/SceneLabels.js +15 -1
  26. package/src/app/SkyView.js +2 -0
  27. package/src/app/sceneHooks.js +1 -1
  28. package/src/assets/bodies/jupiter.js +2 -0
  29. package/src/assets/bodies/listedMoons.d.ts +4 -0
  30. package/src/assets/bodies/listedMoons.js +7 -0
  31. package/src/assets/bodies/outerPlanetCatalogues.d.ts +1 -5
  32. package/src/assets/bodies/outerPlanetCatalogues.js +2 -6
  33. package/src/assets/bodies/outerPlanetRings.d.ts +5 -0
  34. package/src/assets/bodies/outerPlanetRings.js +6 -0
  35. package/src/assets/bodies/planetSystemMaps.js +6 -3
  36. package/src/assets/catalogue.d.ts +3 -0
  37. package/src/assets/catalogue.js +8 -0
  38. package/src/assets/compositions.js +2 -1
  39. package/src/assets/moonCatalogue.d.ts +3 -1
  40. package/src/assets/moonCatalogue.js +1 -0
  41. package/src/assets/visual.d.ts +1 -1
  42. package/src/core/bodies/io.js +1 -0
  43. package/src/core/bodies/jupiterMoons.d.ts +1 -1
  44. package/src/core/bodies/jupiterMoons.js +5 -4
  45. package/src/core/bodies/listedMoonBodies.d.ts +18 -0
  46. package/src/core/bodies/listedMoonBodies.js +36 -0
  47. package/src/core/bodies/listedMoons.d.ts +18 -0
  48. package/src/core/bodies/listedMoons.js +483 -0
  49. package/src/core/bodies/moon.d.ts +2 -0
  50. package/src/core/bodies/moon.js +4 -0
  51. package/src/core/bodies/moonSystem.d.ts +5 -2
  52. package/src/core/bodies/moonSystem.js +2 -1
  53. package/src/core/bodies/outerPlanetData.d.ts +0 -3
  54. package/src/core/bodies/outerPlanetData.js +1 -7
  55. package/src/core/bodies/outerPlanetRingData.d.ts +3 -0
  56. package/src/core/bodies/outerPlanetRingData.js +10 -0
  57. package/src/core/bodies/planetMoons.js +11 -10
  58. package/src/core/body.d.ts +4 -0
  59. package/src/core/events.d.ts +2 -0
  60. package/src/core/satelliteMeanElements.d.ts +2 -8
  61. package/src/core/satelliteMeanElements.js +2 -15
  62. package/src/core/siderealPeriod.d.ts +27 -0
  63. package/src/core/siderealPeriod.js +18 -0
  64. package/src/shell/AstraeusShell.js +6 -2
  65. package/src/shell/AstraeusShell.node.js +6 -2
  66. package/src/synthetic/syntheticJourneyScene.d.ts +2 -1
  67. package/src/synthetic/syntheticJourneyScene.js +21 -15
package/src/api/scene.js CHANGED
@@ -7,15 +7,15 @@ import { createOrbTwoBodyAdapter } from "../core/twoBodyAdapter.js";
7
7
  import { createStateResolver } from "../core/stateResolver.js";
8
8
  import { createOrbAstronomyAdapter } from "../core/astronomyAdapter.js";
9
9
  import { isPlanetId, loadPlanetSeries, planetSeriesLoaded, planetSeriesSpan } from "../core/planetSeries.js";
10
- import { catalogue as builtInCatalogue, extendCatalogue, rootBodyId } from "../assets/catalogue.js";
10
+ import { catalogue as builtInCatalogue, extendCatalogue, extendCatalogueWithMoons, rootBodyId } from "../assets/catalogue.js";
11
11
  import { buildElementsBody, ElementsBodyError, parseElementsBodyRecord } from "../core/elementsBody.js";
12
- import { createComposition, SIDEREAL_MONTH_MS } from "../assets/compositions.js";
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";
17
16
  import { createReadoutMetrics } from "../app/trackedMetrics.js";
18
17
  import { circlesTheSun, farthestSunDistanceKm, sunOrbitIdOf, sunOrbitLayer } from "./sunOrbit.js";
18
+ import { listedMoonBodyOf } from "../core/bodies/listedMoonBodies.js";
19
19
  import { FALLBACK_SCENE_CENTRE, readyMade } from "./bodies.js";
20
20
  import { installData } from "./data.js";
21
21
  import { planActivity, rateMetricOf } from "./activity.js";
@@ -24,13 +24,20 @@ import { SceneError } from "./errors.js";
24
24
  import { toUtcMs } from "./time.js";
25
25
  import { switchesOf } from "./switches.js";
26
26
  import { TimeScaleOutOfRangeError } from "../core/timeScale.js";
27
- import { eventProvenanceOf, eventsOf, pacingFor, panelsOf, timelineOf } from "./story.js";
27
+ import { checkEventObjects, eventProvenanceOf, eventsOf, pacingFor, panelsOf, timelineOf } from "./story.js";
28
28
  export { toUtcMs } from "./time.js";
29
- /** The orbits the engine can draw: the span one lap covers (the parent the line is measured from is the body's catalogue parent). */
30
- const ORBITS = {
31
- moon: { path: { spanMs: SIDEREAL_MONTH_MS } },
32
- io: { path: { spanMs: IO_PERIOD_DAYS * 86_400_000, look: { endFadeOn: false } } },
33
- };
29
+ /**
30
+ * 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
31
+ * 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).
32
+ */
33
+ function moonOrbitPath(catalogue, id) {
34
+ if (!catalogue.has(id))
35
+ return undefined;
36
+ const { orbitPeriodDays, orbitLineFades, parentId } = catalogue.get(id).definition;
37
+ if (orbitPeriodDays === undefined || parentId === undefined)
38
+ return undefined;
39
+ return { spanMs: orbitPeriodDays * 86_400_000, ...(orbitLineFades === true ? {} : { look: { endFadeOn: false } }) };
40
+ }
34
41
  const DEFAULT_COLOR = "#ffd27a";
35
42
  const DAY_MS = 86_400_000;
36
43
  const PROVIDER_PATH_SAMPLES = 128;
@@ -150,9 +157,25 @@ export class Scene {
150
157
  /** Adds a catalogued body: a ready-made one (`earth`, `moon`, ...) or its id. The first body added is the scene's centre. `{ orbit: true }` also draws its orbit line. */
151
158
  addBody(body, options = {}) {
152
159
  const id = typeof body === "string" ? body : body.id;
153
- this.#register("addBody", id, typeof body === "string" ? readyMade(id) ?? { id, label: this.#catalogue.has(id) ? this.#catalogue.get(id).definition.label : id } : body, options);
160
+ const before = this.#catalogue;
161
+ this.#addListedMoon(id);
162
+ try {
163
+ this.#register("addBody", id, typeof body === "string" ? readyMade(id) ?? { id, label: this.#catalogue.has(id) ? this.#catalogue.get(id).definition.label : id } : body, options);
164
+ }
165
+ catch (error) {
166
+ this.#catalogue = before;
167
+ throw error;
168
+ }
154
169
  return this;
155
170
  }
171
+ /** A moon in the listed-moon table that the built-in catalogue does not define by hand is defined now, by the one rule, and joins this scene's catalogue only (an unused moon costs nothing). */
172
+ #addListedMoon(id) {
173
+ if (this.#catalogue.has(id))
174
+ return;
175
+ const moon = listedMoonBodyOf(id);
176
+ if (moon !== undefined && this.#catalogue.has(moon.definition.parentId))
177
+ this.#catalogue = extendCatalogueWithMoons(this.#catalogue, [moon]);
178
+ }
156
179
  /**
157
180
  * Adds your own body that circles the Sun, from its published orbit elements and where they came from: a record with the id, label, elements at an epoch, the source
158
181
  * (name, URL, solution, access date), a stated accuracy and optionally a radius and marker. Drawn as a marker on unperturbed two-body motion about the Sun; the provenance
@@ -179,10 +202,10 @@ export class Scene {
179
202
  return this;
180
203
  }
181
204
  #register(call, id, ref, options) {
182
- if (options.orbit === true && ORBITS[id] === undefined && !(circlesTheSun(this.#catalogue, id)))
183
- throw new SceneError("no-orbit", `${call}("${id}", { orbit: true }): the engine draws the orbit line of ${Object.keys(ORBITS).join(" and ")} 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)`);
205
+ if (options.orbit === true && moonOrbitPath(this.#catalogue, id) === undefined && !(circlesTheSun(this.#catalogue, id)))
206
+ 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
207
  if (!this.#catalogue.has(id))
185
- throw new SceneError("unknown-body", `${call}("${id}"): not a catalogued body (known: ${this.#catalogue.ids().join(", ")})`);
208
+ throw new SceneError("unknown-body", `${call}("${id}"): not a catalogued body (known: ${builtInCatalogue.ids().join(", ")}; any moon in the moon lists is added by its id, and \`listedMoons(planet)\` names them with the data package each needs)`);
186
209
  if (this.#taken(id))
187
210
  throw new SceneError("duplicate-id", `${call}("${id}"): already in the scene`);
188
211
  checkBodyLook(id, options);
@@ -485,12 +508,12 @@ export class Scene {
485
508
  }
486
509
  /** The engine's own orbit loops (the Moon's and Io's) the scene asked for. */
487
510
  #moonPaths() {
488
- return [...this.#orbits].filter((id) => ORBITS[id] !== undefined).map((id) => {
489
- const orbit = ORBITS[id];
511
+ return [...this.#orbits].filter((id) => moonOrbitPath(this.#catalogue, id) !== undefined).map((id) => {
512
+ const orbit = moonOrbitPath(this.#catalogue, id);
490
513
  const parent = this.#catalogue.get(id).definition.parentId;
491
514
  if (parent === undefined || !this.#bodies.has(parent))
492
515
  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.path };
516
+ return { body: id, ...orbit };
494
517
  });
495
518
  }
496
519
  /** Whether the scene is centred on the Sun. */
@@ -518,7 +541,7 @@ export class Scene {
518
541
  }
519
542
  /** The bodies that asked for a Sun-orbit line, checked: the Sun must be in the scene and the line's id free. */
520
543
  #sunOrbitIds(ids) {
521
- return [...this.#orbits].filter((id) => ORBITS[id] === undefined).map((id) => {
544
+ return [...this.#orbits].filter((id) => moonOrbitPath(this.#catalogue, id) === undefined).map((id) => {
522
545
  if (!ids.includes(rootBodyId(this.#catalogue)))
523
546
  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
547
  if (this.#taken(sunOrbitIdOf(id)))
@@ -610,6 +633,7 @@ export class Scene {
610
633
  const layers = this.#deferredRead(ids, window, fault, [], () => [...this.#groupLayers(ids, window, startUtcMs, (plan) => !late(plan))]);
611
634
  const labelled = [...this.#bodies.values(), ...tracked, ...[...this.#groups.values()]].map(({ id, label }) => ({ id, label }));
612
635
  const catalogue = this.#catalogue;
636
+ checkEventObjects(this.#events, new Set(labelled.map(({ id }) => id)));
613
637
  const definition = {
614
638
  experience: {
615
639
  objects: [
@@ -630,7 +654,7 @@ export class Scene {
630
654
  ...pacingEntry(timeline, this.#events),
631
655
  ...groupLayersEntry(layers, this.#groups.size > 0, sunOrbitIds.length > 0),
632
656
  ...(sunOrbitIds.length === 0 ? {} : { paths: sunPaths }),
633
- ...(this.#own.size === 0 ? {} : { catalogue: this.#catalogue }),
657
+ ...(this.#catalogue === builtInCatalogue ? {} : { catalogue: this.#catalogue }),
634
658
  ...visualOverridesEntry(this.#shape),
635
659
  composition: createComposition(this.#catalogue, { id: "scene", bodies: ids, defaultCenter: ids[0], ...(paths.length === 0 ? {} : { paths }) }),
636
660
  scaleChoices: scaleChoicesOf(this.#scale, this.#scaleOnly, this.#enlargedInSun(sunCentred)),
@@ -655,7 +679,7 @@ export class Scene {
655
679
  sunPaths.push(...this.#planetRead(ids, window, () => sunOrbitIds.map((id) => this.#sunPath(id, startUtcMs))));
656
680
  if (fit !== undefined)
657
681
  this.#planetRead(ids, window, () => fit.settle());
658
- await installData(data, ids, window);
682
+ await installData(data, ids, window, catalogue);
659
683
  },
660
684
  };
661
685
  return definition;
@@ -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
- return { id: input.id, label: input.label, timeUtcMs, ...(input.type === undefined ? {} : { type: input.type }) };
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
  }
@@ -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 }, gl: { antialias: 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 })] }));
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;
@@ -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
  }
@@ -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
  }`;
@@ -2,6 +2,7 @@ import { Group, type Camera } from "three";
2
2
  import type { CenterId } from "../core/body.js";
3
3
  import type { ScalePolicy } from "../core/scalePolicy.js";
4
4
  import type { StateResolver } from "../core/stateResolver.js";
5
+ import { type BodyCatalogue } from "../assets/catalogue.js";
5
6
  import { type OrbitLook } from "../assets/orbitLook.js";
6
7
  import type { CompositionPath } from "../assets/compositions.js";
7
8
  import { type PathLayer } from "./experienceDefinition.js";
@@ -130,6 +131,6 @@ export declare const COMPOSITION_PATH_STYLE: PathStyle;
130
131
  * A composition's declared path as an orbit layer: the body's positions about its parent from the resolver, over a window about the
131
132
  * clock, carried with the parent.
132
133
  */
133
- export declare function compositionPathLayer(path: CompositionPath, resolver: StateResolver): PathLayer;
134
+ export declare function compositionPathLayer(path: CompositionPath, resolver: StateResolver, bodies?: BodyCatalogue): PathLayer;
134
135
  /** A composition path drawn with its orbit look (the path's own settings over the defaults), on the scene's own layer. */
135
- export declare function compositionPathView(path: CompositionPath, resolver: StateResolver): PathView;
136
+ export declare function compositionPathView(path: CompositionPath, resolver: StateResolver, bodies?: BodyCatalogue): PathView;
@@ -1,6 +1,6 @@
1
1
  import { BufferAttribute, BufferGeometry, DoubleSide, Group, Line, LineBasicMaterial, Mesh, MeshBasicMaterial, Vector3 } from "three";
2
2
  import { eccentricPathTimesUtcMs, pathTimesUtcMs, samplePositionsKm, windowTimesUtcMs } from "../core/sunCentredSources.js";
3
- import { catalogue } from "../assets/catalogue.js";
3
+ import { catalogue as builtInCatalogue } from "../assets/catalogue.js";
4
4
  import { ORBIT_LOOK_LIMITS, resolveOrbitLook } from "../assets/orbitLook.js";
5
5
  import { DEFAULT_ECCENTRIC_SAMPLE_COUNT, DEFAULT_PATH_SAMPLE_COUNT, DEFAULT_WINDOW_SAMPLE_COUNT, isRollingSpan, validatePathSpec, } from "./experienceDefinition.js";
6
6
  import { arcSegmentAlpha, inertialTrailKm, mapPathKm, ringAlpha, windowEdgeAlpha, orbitKm, pathNeedsRefresh, relativeTrailKm, rootFrameKm, DEFAULT_PATH_REFRESH } from "./pathRules.js";
@@ -552,8 +552,8 @@ export const COMPOSITION_PATH_STYLE = Object.freeze({ opacity: 0.45, depthTest:
552
552
  * A composition's declared path as an orbit layer: the body's positions about its parent from the resolver, over a window about the
553
553
  * clock, carried with the parent.
554
554
  */
555
- export function compositionPathLayer(path, resolver) {
556
- const parent = catalogue.get(path.body).definition.parentId;
555
+ export function compositionPathLayer(path, resolver, bodies = builtInCatalogue) {
556
+ const parent = bodies.get(path.body).definition.parentId;
557
557
  if (parent === undefined)
558
558
  throw new RangeError(`path body "${path.body}" has no parent to orbit`);
559
559
  const source = { body: path.body, stateAt: (timeUtcMs, center = parent) => resolver.stateOf(path.body, timeUtcMs, center) };
@@ -569,6 +569,6 @@ export function compositionPathLayer(path, resolver) {
569
569
  };
570
570
  }
571
571
  /** A composition path drawn with its orbit look (the path's own settings over the defaults), on the scene's own layer. */
572
- export function compositionPathView(path, resolver) {
573
- return new PathView(compositionPathLayer(path, resolver), { ...COMPOSITION_PATH_STYLE, orbitLook: resolveOrbitLook(path.look, `path for "${path.body}"`) });
572
+ export function compositionPathView(path, resolver, bodies = builtInCatalogue) {
573
+ return new PathView(compositionPathLayer(path, resolver, bodies), { ...COMPOSITION_PATH_STYLE, orbitLook: resolveOrbitLook(path.look, `path for "${path.body}"`) });
574
574
  }
@@ -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;
@@ -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, 6))) {
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
  }
@@ -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() {
@@ -56,7 +56,7 @@ export function useSceneViews(runtime, gl) {
56
56
  const trackedViews = useMemo(() => runtime.trackedBodies.map((body) => new TrackedBodyView(body)), [runtime.trackedBodies]);
57
57
  const groupViews = useMemo(() => runtime.groups.map((layer) => new PointsView(layer)), [runtime.groups]);
58
58
  const sunCentredViews = useMemo(() => createPathViews(runtime.paths ?? []), [runtime.paths]);
59
- const compositionPaths = useMemo(() => (runtime.composition?.paths ?? []).map((path) => compositionPathView(path, runtime.resolver)), [runtime.composition, runtime.resolver]);
59
+ const compositionPaths = useMemo(() => (runtime.composition?.paths ?? []).map((path) => compositionPathView(path, runtime.resolver, runtime.catalogue)), [runtime.composition, runtime.resolver, runtime.catalogue]);
60
60
  const skyView = useMemo(() => (runtime.sky?.visible ? new SkyView({ starBrightness: runtime.sky.starBrightness, milkyWayBrightness: runtime.sky.milkyWayBrightness, pixelRatio: gl.getPixelRatio(), maxAnisotropy: gl.capabilities.getMaxAnisotropy(), milkyWay: runtime.sky.milkyWay, picture: null }) : null), [runtime.sky, gl]);
61
61
  const bodySetViews = useMemo(() => (runtime.bodySets ?? []).map((layer) => new BodySetView(layer)), [runtime.bodySets]);
62
62
  const orbitSetViews = useMemo(() => (runtime.bodySets ?? []).map((layer) => new OrbitSetView(layer)), [runtime.bodySets]);
@@ -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 });
@@ -0,0 +1,4 @@
1
+ import type { ListedMoonBody } from "../../core/bodies/listedMoonBodies.js";
2
+ import type { VisualEntry } from "../catalogue.js";
3
+ /** A listed moon's look (O-049 T-211): a grey sphere, or its picture when the picture pack holds one under the moon's id (read when asked for, so a pack registered later still shows). */
4
+ export declare const listedMoonEntry: ({ definition }: ListedMoonBody) => VisualEntry;
@@ -0,0 +1,7 @@
1
+ import { withPicture } from "../pictures.js";
2
+ const LIGHT = Object.freeze({ ambient: 0.08, directional: 1.4 });
3
+ /** A listed moon's look (O-049 T-211): a grey sphere, or its picture when the picture pack holds one under the moon's id (read when asked for, so a pack registered later still shows). */
4
+ export const listedMoonEntry = ({ definition }) => ({
5
+ body: definition.id,
6
+ visual: withPicture(definition.id, { kind: "sphere", material: Object.freeze({ color: "#a8a8a8", roughness: 0.95, metalness: 0 }), light: LIGHT }),
7
+ });
@@ -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
- /** Ring bands from the NASA NSSDC ring fact sheets with the donor's looks (data/rings/<planet>.json, T-118). Pluto has none. */
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, NEPTUNE_RING_FILE, PLUTO_MOON_CATALOGUE_FILE, SATURN_MOON_CATALOGUE_FILE, SATURN_RING_FILE, URANUS_MOON_CATALOGUE_FILE, URANUS_RING_FILE } from "../../core/bodies/outerPlanetData.js";
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
- /** Ring bands from the NASA NSSDC ring fact sheets with the donor's looks (data/rings/<planet>.json, T-118). Pluto has none. */
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,4 +1,5 @@
1
1
  import type { BodyId, CelestialBodyDefinition, StateSourceBinding } from "../core/body.js";
2
+ import type { ListedMoonBody } from "../core/bodies/listedMoonBodies.js";
2
3
  import { type ElementsBodyRecord } from "../core/elementsBody.js";
3
4
  import type { BodyVisual } from "./visual.js";
4
5
  /** Definition, optional state source, and appearance of one body, joined by id. */
@@ -31,6 +32,8 @@ export declare function createCatalogue(definitions: readonly CelestialBodyDefin
31
32
  * already holds, like any other duplicate.
32
33
  */
33
34
  export declare function extendCatalogue(base: BodyCatalogue, records: readonly ElementsBodyRecord[]): BodyCatalogue;
35
+ /** A catalogue that holds everything `base` holds plus the listed moons given (each added to a scene on request; `base` is not changed). */
36
+ export declare function extendCatalogueWithMoons(base: BodyCatalogue, moons: readonly ListedMoonBody[]): BodyCatalogue;
34
37
  /** The id of the catalogue's one root body (the one with no parent), the origin every chain ends at. */
35
38
  export declare function rootBodyId(source?: BodyCatalogue): BodyId;
36
39
  /** Explicit, import-built, no discovery. */
@@ -2,6 +2,7 @@ import { BUILT_IN_BINDINGS, BUILT_IN_BODIES } from "../core/bodies/index.js";
2
2
  import { buildElementsBody } from "../core/elementsBody.js";
3
3
  import { EARTH_ENTRY } from "./bodies/earth.js";
4
4
  import { GALILEAN_ENTRIES } from "./bodies/galileanMoons.js";
5
+ import { listedMoonEntry } from "./bodies/listedMoons.js";
5
6
  import { IO_ENTRY } from "./bodies/io.js";
6
7
  import { JUPITER_ENTRY } from "./bodies/jupiter.js";
7
8
  import { MARS_ENTRY } from "./bodies/mars.js";
@@ -95,6 +96,13 @@ export function extendCatalogue(base, records) {
95
96
  }
96
97
  return createCatalogue([...base.definitions(), ...built.map(({ body }) => body.definition)], [...base.sources(), ...built.map(({ body }) => body.binding)], visuals);
97
98
  }
99
+ /** A catalogue that holds everything `base` holds plus the listed moons given (each added to a scene on request; `base` is not changed). */
100
+ export function extendCatalogueWithMoons(base, moons) {
101
+ if (moons.length === 0)
102
+ return base;
103
+ const visuals = [...base.ids().map((id) => ({ body: id, visual: base.get(id).visual })), ...moons.map(listedMoonEntry)];
104
+ return createCatalogue([...base.definitions(), ...moons.map(({ definition }) => definition)], [...base.sources(), ...moons.map(({ binding }) => binding)], visuals);
105
+ }
98
106
  /** The id of the catalogue's one root body (the one with no parent), the origin every chain ends at. */
99
107
  export function rootBodyId(source = catalogue) {
100
108
  const root = source.definitions().find((definition) => definition.parentId === undefined);
@@ -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 = 27.321661 * 86_400_000;
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);
@@ -20,7 +20,9 @@ export interface MoonRecord {
20
20
  /** False for a provisional designation such as "S/2003 J 19" that has no name yet. */
21
21
  readonly named: boolean;
22
22
  readonly discoveryYear?: number;
23
- /** Ids into the catalogue's `sources`: the list, the family, the size and the discovery. */
23
+ /** Sidereal orbit period in days (JPL SSD mean elements); absent when no period is published for the moon. */
24
+ readonly orbitPeriodDays?: number;
25
+ /** Ids into the catalogue's `sources`: the list, the family, the size and the discovery (the period source is in the list but not in the info-panel provenance until a panel shows the period). */
24
26
  readonly sourceIds: readonly string[];
25
27
  }
26
28
  export interface MoonSource {
@@ -43,6 +43,7 @@ export function parseMoonCatalogue(raw) {
43
43
  return Object.freeze({
44
44
  named: moon.named !== false,
45
45
  ...(typeof moon.discoveryYear === "number" ? { discoveryYear: moon.discoveryYear } : {}),
46
+ ...(typeof moon.orbitPeriodDays === "number" && moon.orbitPeriodDays > 0 ? { orbitPeriodDays: moon.orbitPeriodDays } : {}),
46
47
  sourceIds: Object.freeze(sourceIds),
47
48
  id: text(moon.id, `${where}.id`),
48
49
  name: text(moon.name, `${where}.name`),
@@ -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; an experience opts in through its visual overrides. */
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?: {
@@ -103,6 +103,7 @@ export const IO = Object.freeze({
103
103
  radiusKm: 1821.49,
104
104
  gmKm3S2: 5959.9155,
105
105
  parentId: "jupiter",
106
+ orbitPeriodDays: IO_PERIOD_DAYS,
106
107
  orientation: "tidal-lock",
107
108
  accuracy: Object.freeze({
108
109
  dimensions: createProvenance({
@@ -20,7 +20,7 @@ export declare const loadJupiterMoons: (load: MoonSystemLoad) => Promise<import(
20
20
  export declare const osculatingPeriodMs: (ephemeris: import("../chebyshevEphemeris.js").ChebyshevEphemeris, body: BodyId, timeUtcMs: number) => number;
21
21
  export declare const FITTED_MOON_TIDAL_LOCK: string;
22
22
  /** What every mapped Jupiter moon's record says about its position, with its own worst figure from T-096. */
23
- export declare const fittedMoonPosition: (label: string, worstM: number, span?: TimeBounds) => ReturnType<typeof import("../provenance.js").createProvenance>;
23
+ export declare const fittedMoonPosition: (label: string, worstM?: number, span?: TimeBounds) => ReturnType<typeof import("../provenance.js").createProvenance>;
24
24
  /** The Galilean moons turn synchronously: their prime meridians are the IAU records saved with their orbits (`data/orbits/`), the one source. */
25
25
  export declare const IO_ROTATION: import("../iauRotation.js").IauRotationElements;
26
26
  export declare const EUROPA: import("../body.js").CelestialBodyDefinition;
@@ -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([