astraeus 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/README.md +92 -11
- package/data/ephemerides/planets/planets.json +1 -1
- package/package.json +1 -1
- package/src/api/AstraeusScene.d.ts +9 -1
- package/src/api/AstraeusScene.js +26 -4
- package/src/api/AstraeusScene.node.js +26 -4
- package/src/api/activity.d.ts +1 -1
- package/src/api/activity.js +1 -1
- package/src/api/bodies.d.ts +2 -0
- package/src/api/bodies.js +2 -0
- package/src/api/data.js +11 -1
- package/src/api/errors.d.ts +1 -1
- package/src/api/index.d.ts +3 -2
- package/src/api/index.js +1 -1
- package/src/api/index.node.js +1 -1
- package/src/api/mount.d.ts +16 -0
- package/src/api/mount.js +13 -1
- package/src/api/mount.node.js +13 -1
- package/src/api/pathProvenance.d.ts +10 -0
- package/src/api/pathProvenance.js +34 -0
- package/src/api/scene.d.ts +26 -5
- package/src/api/scene.js +197 -44
- package/src/api/story.d.ts +41 -1
- package/src/api/story.js +63 -1
- package/src/api/sunOrbit.d.ts +3 -3
- package/src/api/sunOrbit.js +92 -24
- package/src/api/viewerLink.d.ts +40 -0
- package/src/api/viewerLink.js +86 -0
- package/src/app/App.d.ts +4 -1
- package/src/app/App.js +42 -6
- package/src/app/App.node.js +42 -6
- package/src/app/AstraeusScene.d.ts +7 -0
- package/src/app/BodySetView.js +3 -2
- package/src/app/KeplerPoints.d.ts +1 -1
- package/src/app/KeplerPoints.js +3 -2
- package/src/app/PointsView.js +3 -2
- package/src/app/SceneLabels.d.ts +2 -0
- package/src/app/SceneLabels.js +5 -1
- package/src/app/TrackedBodyView.d.ts +9 -3
- package/src/app/TrackedBodyView.js +54 -14
- package/src/app/bodyDraw.js +3 -2
- package/src/app/dotMaterial.d.ts +11 -0
- package/src/app/dotMaterial.js +38 -0
- package/src/app/experienceDefinition.d.ts +12 -0
- package/src/app/mission.d.ts +3 -1
- package/src/app/mission.js +1 -1
- package/src/app/openClock.d.ts +1 -1
- package/src/app/openClock.js +3 -0
- package/src/app/pathRules.d.ts +7 -3
- package/src/app/pathRules.js +9 -5
- package/src/app/sceneContentsHooks.js +2 -1
- package/src/app/sceneDebug.d.ts +4 -2
- package/src/app/sceneFrame.d.ts +2 -2
- package/src/app/sceneFrame.js +7 -2
- package/src/app/sceneFraming.d.ts +1 -1
- package/src/app/sceneFraming.js +9 -3
- package/src/app/viewerPort.d.ts +33 -0
- package/src/app/viewerPort.js +1 -0
- package/src/core/bodies/io.js +1 -1
- package/src/core/bodies/jupiterMoons.d.ts +1 -1
- package/src/core/bodies/jupiterMoons.js +6 -6
- package/src/core/bodies/moonSystem.d.ts +15 -1
- package/src/core/bodies/moonSystem.js +58 -7
- package/src/core/bodies/outerPlanets.js +1 -1
- package/src/core/bodies/planetMoons.js +10 -10
- package/src/core/chebyshevEphemeris.d.ts +7 -1
- package/src/core/chebyshevEphemeris.js +24 -7
- package/src/core/clock.d.ts +8 -0
- package/src/core/clock.js +14 -0
- package/src/core/pacing.d.ts +24 -0
- package/src/core/pacing.js +35 -0
- package/src/core/planetModels.d.ts +4 -1
- package/src/core/planetModels.js +6 -1
- package/src/core/planetSeries.d.ts +3 -0
- package/src/core/planetSeries.js +8 -1
- package/src/core/scalePolicy.d.ts +2 -0
- package/src/core/scalePolicy.js +2 -0
- package/src/core/timeWindow.d.ts +2 -0
- package/src/core/timeWindow.js +4 -3
- package/src/shell/AstraeusShell.d.ts +6 -2
- package/src/shell/AstraeusShell.js +3 -3
- package/src/shell/AstraeusShell.node.js +3 -3
- package/src/shell/TimelineBar.d.ts +4 -2
- package/src/shell/TimelineBar.js +15 -6
- package/src/shell/TimelineBar.node.js +15 -6
- package/src/shell/experience.d.ts +3 -1
- package/src/shell/infoModel.js +5 -4
- package/src/shell/timelineModel.d.ts +2 -3
- package/src/shell/timelineModel.js +3 -11
- package/src/synthetic/syntheticJourneyScene.d.ts +9 -0
- package/src/synthetic/syntheticJourneyScene.js +75 -0
- package/src/synthetic/syntheticProbeDefinition.d.ts +5 -0
- package/src/synthetic/syntheticProbeDefinition.js +38 -0
package/src/app/SceneLabels.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ interface Rect {
|
|
|
8
8
|
readonly right: number;
|
|
9
9
|
readonly bottom: number;
|
|
10
10
|
}
|
|
11
|
+
/** Added to the selected object's label priority; larger than any labelPriority, so it is never the label hidden by an overlap. */
|
|
12
|
+
export declare const SELECTED_PRIORITY = 1000;
|
|
11
13
|
/** App adapter that places configured labels; the label presentation itself stays generic. */
|
|
12
14
|
export declare class SceneLabelLayer {
|
|
13
15
|
#private;
|
package/src/app/SceneLabels.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Vector3 } from "three";
|
|
2
2
|
import { createLabelElement } from "../shell/Label.js";
|
|
3
3
|
import { projectToScreen } from "./AnchorLabels.js";
|
|
4
|
+
/** Added to the selected object's label priority; larger than any labelPriority, so it is never the label hidden by an overlap. */
|
|
5
|
+
export const SELECTED_PRIORITY = 1_000;
|
|
4
6
|
/** App adapter that places configured labels; the label presentation itself stays generic. */
|
|
5
7
|
export class SceneLabelLayer {
|
|
6
8
|
#root = document.createElement("div");
|
|
@@ -12,6 +14,7 @@ export class SceneLabelLayer {
|
|
|
12
14
|
this.#entries = objects.map((object) => {
|
|
13
15
|
const element = createLabelElement(object.label, object.color, "scene-object-label");
|
|
14
16
|
element.dataset.labelId = object.id;
|
|
17
|
+
element.hidden = true; // not shown until the first layout places it (I-108: unplaced labels all showed for a moment, so a reader could see a label the settled layout then hides)
|
|
15
18
|
this.#root.appendChild(element);
|
|
16
19
|
return { object, element };
|
|
17
20
|
});
|
|
@@ -46,7 +49,8 @@ export class SceneLabelLayer {
|
|
|
46
49
|
entry.element.hidden = true;
|
|
47
50
|
return [];
|
|
48
51
|
}
|
|
49
|
-
|
|
52
|
+
// The selected (and so followed) object's label wins every collision: the bonus outranks any labelPriority (I-108).
|
|
53
|
+
const selectedPriority = entry.object.id === selectedObjectId ? SELECTED_PRIORITY : 0;
|
|
50
54
|
return [{ ...entry, screen, priority: (entry.object.labelPriority ?? 0) + selectedPriority }];
|
|
51
55
|
}).sort((a, b) => b.priority - a.priority || a.object.id.localeCompare(b.object.id));
|
|
52
56
|
const occupied = [];
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { DataTexture, Group,
|
|
1
|
+
import { DataTexture, Group, Vector3, type Camera } from "three";
|
|
2
2
|
import type { ScalePolicy } from "../core/scalePolicy.js";
|
|
3
3
|
import type { FloatingOrigin } from "./floatingOrigin.js";
|
|
4
|
+
import type { PathScreenReadout } from "./PathView.js";
|
|
4
5
|
import { type TrackedBody } from "./mission.js";
|
|
5
|
-
import type { PathRule } from "./experienceDefinition.js";
|
|
6
6
|
import { type RenderVector } from "./renderCoordinates.js";
|
|
7
|
+
import type { PathRule } from "./experienceDefinition.js";
|
|
7
8
|
import { type ScenePlacement } from "./sceneLayout.js";
|
|
8
9
|
/** Drawn after Earth and Moon so overlays are never swallowed by a body in a compressed scale. */
|
|
9
10
|
export declare const TRACK_LAYER = 3;
|
|
@@ -22,7 +23,7 @@ export declare function releaseAnchorSprite(): void;
|
|
|
22
23
|
export declare class TrackedBodyView {
|
|
23
24
|
#private;
|
|
24
25
|
readonly body: TrackedBody;
|
|
25
|
-
/**
|
|
26
|
+
/** Every tracked body's path is one rule, a relative trail (`pathRules.ts`); the body it is drawn against is the path's own `lineFixedTo`, default the scene centre. */
|
|
26
27
|
static readonly pathRule: PathRule;
|
|
27
28
|
readonly group: Group<import("three").Object3DEventMap>;
|
|
28
29
|
/** Anchor labels in anchor order, or null when the body has none. */
|
|
@@ -31,6 +32,11 @@ export declare class TrackedBodyView {
|
|
|
31
32
|
/** Scaled absolute target for the camera; holds the nearest bound outside the trajectory. */
|
|
32
33
|
absolute(timeUtcMs: number, policy: ScalePolicy, placement: ScenePlacement): RenderVector;
|
|
33
34
|
update(timeUtcMs: number, policy: ScalePolicy, origin: FloatingOrigin, camera: Camera, placement: ScenePlacement): void;
|
|
35
|
+
/**
|
|
36
|
+
* Diagnostic for the browser checks (`data-paths`, O-046 T-193): whether the path is drawn, the vertices of its two lines (travelled and future) in front of the camera and inside the view, and the box they cover
|
|
37
|
+
* as shares of the view. Both lines together are the whole path, so a line fixed to the Sun reads the same at any time. The line box repeats the vertex box.
|
|
38
|
+
*/
|
|
39
|
+
screenReadout(camera: Camera): PathScreenReadout;
|
|
34
40
|
/** Local (floating-origin) render position of anchor `index` as last drawn. */
|
|
35
41
|
anchorLocalPosition(index: number, out: Vector3): Vector3;
|
|
36
42
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { BufferAttribute, BufferGeometry, DataTexture, Group, Line, LineBasicMaterial, Mesh, MeshBasicMaterial, Points,
|
|
1
|
+
import { BufferAttribute, BufferGeometry, DataTexture, Group, Line, LineBasicMaterial, Mesh, MeshBasicMaterial, Points, RGBAFormat, SphereGeometry, Vector3, } from "three";
|
|
2
|
+
import { dotMaterial } from "./dotMaterial.js";
|
|
2
3
|
import { anchorLabelsOf, markerRadiusUnits, sampleTrackedPositions, stateClampedToBounds, stateIfInBounds, travelledCount } from "./mission.js";
|
|
3
|
-
import { mapPathKm, relativeTrailKm } from "./pathRules.js";
|
|
4
|
+
import { mapPathKm, relativeTrailKm, shiftedBy } from "./pathRules.js";
|
|
4
5
|
import { eqjToRenderVector } from "./renderCoordinates.js";
|
|
5
|
-
import { trackedAbsolute } from "./sceneLayout.js";
|
|
6
|
+
import { sceneOffsetKm, trackedAbsolute } from "./sceneLayout.js";
|
|
6
7
|
/** Drawn after Earth and Moon so overlays are never swallowed by a body in a compressed scale. */
|
|
7
8
|
export const TRACK_LAYER = 3;
|
|
8
9
|
function lineWithCapacity(count, color, opacity) {
|
|
@@ -54,7 +55,7 @@ export function releaseAnchorSprite() {
|
|
|
54
55
|
*/
|
|
55
56
|
export class TrackedBodyView {
|
|
56
57
|
body;
|
|
57
|
-
/**
|
|
58
|
+
/** Every tracked body's path is one rule, a relative trail (`pathRules.ts`); the body it is drawn against is the path's own `lineFixedTo`, default the scene centre. */
|
|
58
59
|
static pathRule = Object.freeze({ kind: "trail", frame: "relative" });
|
|
59
60
|
group = new Group();
|
|
60
61
|
#marker;
|
|
@@ -64,6 +65,7 @@ export class TrackedBodyView {
|
|
|
64
65
|
#samples;
|
|
65
66
|
#anchorKm;
|
|
66
67
|
#mappedFor = "";
|
|
68
|
+
#mappedAt = 0;
|
|
67
69
|
#placedFor = null;
|
|
68
70
|
#mappedPath = new Float64Array(0);
|
|
69
71
|
#mappedAnchors = new Float64Array(0);
|
|
@@ -82,7 +84,7 @@ export class TrackedBodyView {
|
|
|
82
84
|
this.#marker.layers.set(TRACK_LAYER);
|
|
83
85
|
const anchorGeometry = new BufferGeometry();
|
|
84
86
|
anchorGeometry.setAttribute("position", new BufferAttribute(new Float32Array(this.#anchorKm.length), 3));
|
|
85
|
-
this.#anchors = new Points(anchorGeometry,
|
|
87
|
+
this.#anchors = new Points(anchorGeometry, dotMaterial({
|
|
86
88
|
color: "#f0e6da",
|
|
87
89
|
map: anchorSpriteTexture(),
|
|
88
90
|
size: 9,
|
|
@@ -103,7 +105,7 @@ export class TrackedBodyView {
|
|
|
103
105
|
return trackedAbsolute(stateClampedToBounds(this.body, timeUtcMs), policy, placement);
|
|
104
106
|
}
|
|
105
107
|
update(timeUtcMs, policy, origin, camera, placement) {
|
|
106
|
-
this.#remap(policy, placement);
|
|
108
|
+
this.#remap(policy, placement, timeUtcMs);
|
|
107
109
|
// Mapped positions are not consistent with body radii in ReadableScale, so only TrueScale occludes.
|
|
108
110
|
const occlude = policy.id === "true-scale";
|
|
109
111
|
for (const material of this.#materials)
|
|
@@ -123,22 +125,31 @@ export class TrackedBodyView {
|
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
127
|
/**
|
|
126
|
-
* A relative trail: each sample is the body's position from the scene centre at that sample's own time
|
|
127
|
-
* scene
|
|
128
|
+
* A relative trail (`pathRules.ts`): each sample is the body's position from `lineFixedTo` (default the scene centre) at that sample's own time.
|
|
129
|
+
* A line fixed to a body other than the scene centre is carried to where that body is from the centre at the display time, so it
|
|
130
|
+
* is remapped as the clock moves; a line against the scene centre depends on the centre and scale alone.
|
|
128
131
|
*/
|
|
129
|
-
#remap(policy, placement) {
|
|
132
|
+
#remap(policy, placement, timeUtcMs) {
|
|
130
133
|
const placed = placement.center;
|
|
131
|
-
|
|
134
|
+
const moves = this.#against(placement) !== placed;
|
|
135
|
+
if (this.#mappedFor === policy.id && this.#placedFor === placed && (!moves || this.#mappedAt === timeUtcMs))
|
|
132
136
|
return;
|
|
133
|
-
this.#mappedPath = mapPathKm(this.#relative(this.#samples, placement), policy);
|
|
134
|
-
this.#mappedAnchors = mapPathKm(this.#relative({ timesUtcMs: this.body.anchorTimesUtcMs, positionsKm: this.#anchorKm }, placement), policy);
|
|
137
|
+
this.#mappedPath = mapPathKm(this.#relative(this.#samples, placement, timeUtcMs), policy);
|
|
138
|
+
this.#mappedAnchors = mapPathKm(this.#relative({ timesUtcMs: this.body.anchorTimesUtcMs, positionsKm: this.#anchorKm }, placement, timeUtcMs), policy);
|
|
135
139
|
this.#mappedFor = policy.id;
|
|
136
140
|
this.#placedFor = placed;
|
|
141
|
+
this.#mappedAt = timeUtcMs;
|
|
137
142
|
}
|
|
138
|
-
#
|
|
143
|
+
#against(placement) {
|
|
144
|
+
return this.body.lineFixedTo ?? placement.center;
|
|
145
|
+
}
|
|
146
|
+
#relative(samples, placement, timeUtcMs) {
|
|
139
147
|
if (samples.timesUtcMs.length === 0)
|
|
140
148
|
return samples.positionsKm;
|
|
141
|
-
|
|
149
|
+
const against = this.#against(placement);
|
|
150
|
+
const drawn = relativeTrailKm(samples, this.body.trajectory.stateAt(samples.timesUtcMs[0]).center, placement, against);
|
|
151
|
+
const carry = sceneOffsetKm(placement, against, timeUtcMs);
|
|
152
|
+
return carry === null ? drawn : shiftedBy(drawn, carry);
|
|
142
153
|
}
|
|
143
154
|
/** Writes [leading?] samples [from, to) [trailing?] into the line and sets how much of it is drawn. */
|
|
144
155
|
#fillPath(line, from, to, leading, trailing, origin) {
|
|
@@ -159,6 +170,35 @@ export class TrackedBodyView {
|
|
|
159
170
|
positions.needsUpdate = true;
|
|
160
171
|
line.geometry.setDrawRange(0, written >= 2 ? written : 0);
|
|
161
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Diagnostic for the browser checks (`data-paths`, O-046 T-193): whether the path is drawn, the vertices of its two lines (travelled and future) in front of the camera and inside the view, and the box they cover
|
|
175
|
+
* as shares of the view. Both lines together are the whole path, so a line fixed to the Sun reads the same at any time. The line box repeats the vertex box.
|
|
176
|
+
*/
|
|
177
|
+
screenReadout(camera) {
|
|
178
|
+
camera.updateMatrixWorld();
|
|
179
|
+
const point = new Vector3();
|
|
180
|
+
let [vertices, inView, minX, maxX, minY, maxY] = [0, 0, 1, 0, 1, 0];
|
|
181
|
+
for (const line of [this.#travelled, this.#future]) {
|
|
182
|
+
const positions = line.geometry.getAttribute("position");
|
|
183
|
+
const drawn = line.geometry.drawRange.count;
|
|
184
|
+
vertices += drawn;
|
|
185
|
+
for (let i = 0; i < drawn; i += 1) {
|
|
186
|
+
point.fromBufferAttribute(positions, i).applyMatrix4(camera.matrixWorldInverse);
|
|
187
|
+
if (point.z >= 0)
|
|
188
|
+
continue;
|
|
189
|
+
point.applyMatrix4(camera.projectionMatrix);
|
|
190
|
+
if (Math.abs(point.x) > 1 || Math.abs(point.y) > 1)
|
|
191
|
+
continue;
|
|
192
|
+
const [x, y] = [(point.x + 1) / 2, (1 - point.y) / 2];
|
|
193
|
+
inView += 1;
|
|
194
|
+
minX = Math.min(minX, x);
|
|
195
|
+
maxX = Math.max(maxX, x);
|
|
196
|
+
minY = Math.min(minY, y);
|
|
197
|
+
maxY = Math.max(maxY, y);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return { id: this.body.id, visible: this.group.visible && vertices > 0, vertices, inView, minX, maxX, minY, maxY, lineMinX: minX, lineMaxX: maxX, lineMinY: minY, lineMaxY: maxY, axisDeg: 0, aspect: camera.aspect ?? 1, look: null };
|
|
201
|
+
}
|
|
162
202
|
/** Local (floating-origin) render position of anchor `index` as last drawn. */
|
|
163
203
|
anchorLocalPosition(index, out) {
|
|
164
204
|
return out.fromBufferAttribute(this.#anchors.geometry.getAttribute("position"), index);
|
package/src/app/bodyDraw.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AdditiveBlending, BufferAttribute, BufferGeometry, CanvasTexture, Group, Points,
|
|
1
|
+
import { AdditiveBlending, BufferAttribute, BufferGeometry, CanvasTexture, Group, Points, Sprite, SpriteMaterial } from "three";
|
|
2
|
+
import { dotMaterial } from "./dotMaterial.js";
|
|
2
3
|
import { textureUrlFor } from "../assets/licence.js";
|
|
3
4
|
/**
|
|
4
5
|
* A body with both an equatorial and a polar radius is a spheroid whose two radii are mapped independently, so
|
|
@@ -49,7 +50,7 @@ export function createMarker(asset, layer, override, fallbackPx) {
|
|
|
49
50
|
const position = new BufferAttribute(new Float32Array(3), 3);
|
|
50
51
|
const geometry = new BufferGeometry();
|
|
51
52
|
geometry.setAttribute("position", position);
|
|
52
|
-
const points = new Points(geometry,
|
|
53
|
+
const points = new Points(geometry, dotMaterial({ color, size: sizePx, sizeAttenuation: false, depthTest: false }));
|
|
53
54
|
points.frustumCulled = false;
|
|
54
55
|
points.layers.set(layer);
|
|
55
56
|
const group = new Group();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PointsMaterial, type PointsMaterialParameters } from "three";
|
|
2
|
+
/** Frees the shared dot picture (an unmounted scene's renderer must not stay reachable through it); the next dot makes a new one. */
|
|
3
|
+
export declare function releaseDotTexture(): void;
|
|
4
|
+
/**
|
|
5
|
+
* The one way the engine makes a far-away dot (body marker, group dot, anchor): a round `PointsMaterial`.
|
|
6
|
+
* A map plus `alphaTest` rather than a fragment discard, because the group materials already patch the
|
|
7
|
+
* vertex shader through `onBeforeCompile` and the stock fragment chunks handle the map, opacity and
|
|
8
|
+
* vertex colours unchanged; the cutoff keeps the edge crisp at 2-4 px. Callers pass the same size and
|
|
9
|
+
* colour as before; only the shape differs. A caller's own `map` (the anchor ring) replaces the disc.
|
|
10
|
+
*/
|
|
11
|
+
export declare function dotMaterial(parameters: PointsMaterialParameters): PointsMaterial;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { DataTexture, PointsMaterial, RGBAFormat } from "three";
|
|
2
|
+
const DOT_TEXTURE_PX = 32;
|
|
3
|
+
let dotTexture = null;
|
|
4
|
+
/**
|
|
5
|
+
* A white disc with a one-pixel soft edge, built from pixels (no DOM needed). An untextured WebGL point
|
|
6
|
+
* is a square; sampled through `gl_PointCoord` this makes it a circle.
|
|
7
|
+
*/
|
|
8
|
+
function roundDotTexture() {
|
|
9
|
+
if (dotTexture !== null)
|
|
10
|
+
return dotTexture;
|
|
11
|
+
const size = DOT_TEXTURE_PX;
|
|
12
|
+
const pixels = new Uint8Array(size * size * 4);
|
|
13
|
+
for (let y = 0; y < size; y += 1) {
|
|
14
|
+
for (let x = 0; x < size; x += 1) {
|
|
15
|
+
const r = Math.hypot(x + 0.5 - size / 2, y + 0.5 - size / 2);
|
|
16
|
+
const alpha = Math.min(1, Math.max(0, size / 2 - r));
|
|
17
|
+
pixels.set([255, 255, 255, Math.round(alpha * 255)], (y * size + x) * 4);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
dotTexture = new DataTexture(pixels, size, size, RGBAFormat);
|
|
21
|
+
dotTexture.needsUpdate = true;
|
|
22
|
+
return dotTexture;
|
|
23
|
+
}
|
|
24
|
+
/** Frees the shared dot picture (an unmounted scene's renderer must not stay reachable through it); the next dot makes a new one. */
|
|
25
|
+
export function releaseDotTexture() {
|
|
26
|
+
dotTexture?.dispose();
|
|
27
|
+
dotTexture = null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The one way the engine makes a far-away dot (body marker, group dot, anchor): a round `PointsMaterial`.
|
|
31
|
+
* A map plus `alphaTest` rather than a fragment discard, because the group materials already patch the
|
|
32
|
+
* vertex shader through `onBeforeCompile` and the stock fragment chunks handle the map, opacity and
|
|
33
|
+
* vertex colours unchanged; the cutoff keeps the edge crisp at 2-4 px. Callers pass the same size and
|
|
34
|
+
* colour as before; only the shape differs. A caller's own `map` (the anchor ring) replaces the disc.
|
|
35
|
+
*/
|
|
36
|
+
export function dotMaterial(parameters) {
|
|
37
|
+
return new PointsMaterial({ map: roundDotTexture(), alphaTest: 0.4, ...parameters });
|
|
38
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { SimulationClock } from "../core/clock.js";
|
|
3
|
+
import type { Pacing } from "../core/pacing.js";
|
|
3
4
|
import type { StateResolver } from "../core/stateResolver.js";
|
|
4
5
|
import type { PointGroup } from "../core/pointGroup.js";
|
|
5
6
|
import type { TimeBounds, Trajectory } from "../core/trajectory.js";
|
|
@@ -137,6 +138,15 @@ export interface CameraReach {
|
|
|
137
138
|
readonly fitOrbit?: {
|
|
138
139
|
readonly farthestKm: () => number;
|
|
139
140
|
};
|
|
141
|
+
/**
|
|
142
|
+
* The distance, in km, that the default zoom-out must cover for what no body's orbit speaks for (a path reaching past the planets, I-114): twice the path's farthest distance from the scene centre. When neither `maxFocusDistance` nor `fitOrbit` is declared the viewer
|
|
143
|
+
* widens the default zoom-out and the far plane so this distance fits the canvas whole; it never narrows the default (`minFocusDistance` below is the result, set live).
|
|
144
|
+
*/
|
|
145
|
+
readonly cover?: {
|
|
146
|
+
readonly farthestKm: () => number;
|
|
147
|
+
};
|
|
148
|
+
/** Set live from `cover` (never declared): the zoom-out the default must at least reach, in scaled units. */
|
|
149
|
+
readonly minFocusDistance?: number;
|
|
140
150
|
}
|
|
141
151
|
/** The scene's far plane when an experience declares none. */
|
|
142
152
|
export declare const DEFAULT_CAMERA_FAR = 5000;
|
|
@@ -153,6 +163,8 @@ export interface ExperienceDefinition {
|
|
|
153
163
|
readonly rate: number; /** False leaves the clock paused at `startUtcMs` when the scene opens (default true: it plays). */
|
|
154
164
|
readonly playing?: boolean;
|
|
155
165
|
};
|
|
166
|
+
/** Playback that slows for encounters and speeds up for cruise (see `pacedRate`). Absent: the clock runs at the rate it opens with or the visitor picks. */
|
|
167
|
+
readonly pacing?: Pacing;
|
|
156
168
|
/** Layers the scene mounts, e.g. the tracked-body list. */
|
|
157
169
|
readonly sceneLayers: readonly SceneLayerId[];
|
|
158
170
|
/** The catalogued bodies the scene draws, one view each. Absent: none, as in the bodiless fixture. */
|
package/src/app/mission.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export interface TrackedBody {
|
|
|
20
20
|
readonly anchorLabels?: readonly string[];
|
|
21
21
|
/** Published position discrepancy per reconstruction segment, in time order. */
|
|
22
22
|
readonly positionDiscrepancies?: readonly PositionDiscrepancy[];
|
|
23
|
+
/** The body the line is drawn against, at each sample's own time; absent: the scene centre. */
|
|
24
|
+
readonly lineFixedTo?: string;
|
|
23
25
|
/** The trajectory's own Provenance, passed through unchanged. */
|
|
24
26
|
readonly provenance?: Provenance;
|
|
25
27
|
}
|
|
@@ -63,7 +65,7 @@ export declare const MARKER_MIN_RADIUS_UNITS = 0.0001;
|
|
|
63
65
|
export declare function markerRadiusUnits(cameraDistanceUnits: number): number;
|
|
64
66
|
export declare function jumpToEvent(clock: SimulationClock, events: readonly TimelineEvent[], id: string): number;
|
|
65
67
|
export type { PlaybackSpeed as Speed } from "../shell/timelineModel.js";
|
|
66
|
-
export { formatRate,
|
|
68
|
+
export { formatRate, speedsOf } from "../shell/timelineModel.js";
|
|
67
69
|
export interface TrackedReadout {
|
|
68
70
|
readonly id: string;
|
|
69
71
|
readonly label: string;
|
package/src/app/mission.js
CHANGED
|
@@ -58,7 +58,7 @@ export function jumpToEvent(clock, events, id) {
|
|
|
58
58
|
clock.seek(event.timeUtcMs);
|
|
59
59
|
return event.timeUtcMs;
|
|
60
60
|
}
|
|
61
|
-
export { formatRate,
|
|
61
|
+
export { formatRate, speedsOf } from "../shell/timelineModel.js";
|
|
62
62
|
/** Current-position rows for the bodies whose trajectories cover `timeUtcMs`; the rest are omitted. */
|
|
63
63
|
export function trackedReadouts(bodies, timeUtcMs) {
|
|
64
64
|
const rows = [];
|
package/src/app/openClock.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ import type { ExperienceDefinition } from "./experienceDefinition.js";
|
|
|
4
4
|
* The clock a mounted experience opens with: at its start moment and rate (or at the moment a copied link carried), playing unless the definition says
|
|
5
5
|
* `clock.playing: false`, which leaves it frozen there.
|
|
6
6
|
*/
|
|
7
|
-
export declare function openClock(definition: Pick<ExperienceDefinition, "clock">, linkedTimeUtcMs?: number): SimulationClock;
|
|
7
|
+
export declare function openClock(definition: Pick<ExperienceDefinition, "clock" | "pacing">, linkedTimeUtcMs?: number): SimulationClock;
|
package/src/app/openClock.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SimulationClock } from "../core/clock.js";
|
|
2
|
+
import { pacedRate } from "../core/pacing.js";
|
|
2
3
|
/**
|
|
3
4
|
* The clock a mounted experience opens with: at its start moment and rate (or at the moment a copied link carried), playing unless the definition says
|
|
4
5
|
* `clock.playing: false`, which leaves it frozen there.
|
|
@@ -8,6 +9,8 @@ export function openClock(definition, linkedTimeUtcMs) {
|
|
|
8
9
|
clock.setRate(definition.clock.rate);
|
|
9
10
|
if (linkedTimeUtcMs !== undefined)
|
|
10
11
|
clock.seek(linkedTimeUtcMs);
|
|
12
|
+
if (definition.pacing !== undefined)
|
|
13
|
+
clock.setRate(pacedRate(definition.pacing, clock.now()));
|
|
11
14
|
if (definition.clock.playing !== false)
|
|
12
15
|
clock.play();
|
|
13
16
|
return clock;
|
package/src/app/pathRules.d.ts
CHANGED
|
@@ -13,13 +13,17 @@ export declare function mapPathKm(positionsKm: Float64Array, policy: ScalePolicy
|
|
|
13
13
|
* offsets, so a source need not be catalogued: it only has to say which catalogued body it is measured from.
|
|
14
14
|
*
|
|
15
15
|
* - orbit: every sample about its centre, the whole line carried to the centre's place from the scene centre at the clock time.
|
|
16
|
-
* - relative trail: each sample from the scene centre at that sample's own time
|
|
16
|
+
* - relative trail: each sample from `against` (default the scene centre) at that sample's own time; against another body it is then carried to the scene centre at the display time.
|
|
17
17
|
* - inertial trail: each sample in the common root frame at its own time, then from the scene centre at the display time.
|
|
18
18
|
*/
|
|
19
19
|
/** Orbit: the samples (about `center`) plus the one vector from the scene centre to `center` at the clock time. Returns the input when that vector is zero. */
|
|
20
20
|
export declare function orbitKm(samplesKm: Float64Array, center: CenterId, placement: ScenePlacement, clockUtcMs: number): Float64Array;
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Relative trail: sample i plus the offset from `native` to `against` at time i, so the line is drawn against `against` (default the scene
|
|
23
|
+
* centre: what an observer riding the centre saw). Returns the input when `native` is `against`. Fixing the line to another body leaves it
|
|
24
|
+
* about that body; `sceneOffsetKm(placement, against, displayUtcMs)` then carries it to the scene centre at the display time.
|
|
25
|
+
*/
|
|
26
|
+
export declare function relativeTrailKm(samples: PathSamples, native: CenterId, placement: ScenePlacement, against?: CenterId): Float64Array;
|
|
23
27
|
/** Inertial trail, first half: each sample in the root frame at its own time. Does not depend on the scene centre or the clock, so it is computed once. */
|
|
24
28
|
export declare function rootFrameKm(samples: PathSamples, native: CenterId, placement: ScenePlacement): Float64Array;
|
|
25
29
|
/** Inertial trail, second half: root-frame samples as seen from the scene centre at the display time. */
|
package/src/app/pathRules.js
CHANGED
|
@@ -12,7 +12,7 @@ export function mapPathKm(positionsKm, policy) {
|
|
|
12
12
|
* offsets, so a source need not be catalogued: it only has to say which catalogued body it is measured from.
|
|
13
13
|
*
|
|
14
14
|
* - orbit: every sample about its centre, the whole line carried to the centre's place from the scene centre at the clock time.
|
|
15
|
-
* - relative trail: each sample from the scene centre at that sample's own time
|
|
15
|
+
* - relative trail: each sample from `against` (default the scene centre) at that sample's own time; against another body it is then carried to the scene centre at the display time.
|
|
16
16
|
* - inertial trail: each sample in the common root frame at its own time, then from the scene centre at the display time.
|
|
17
17
|
*/
|
|
18
18
|
/** Orbit: the samples (about `center`) plus the one vector from the scene centre to `center` at the clock time. Returns the input when that vector is zero. */
|
|
@@ -20,13 +20,17 @@ export function orbitKm(samplesKm, center, placement, clockUtcMs) {
|
|
|
20
20
|
const offset = sceneOffsetKm(placement, center, clockUtcMs);
|
|
21
21
|
return offset === null ? samplesKm : shiftedBy(samplesKm, offset);
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Relative trail: sample i plus the offset from `native` to `against` at time i, so the line is drawn against `against` (default the scene
|
|
25
|
+
* centre: what an observer riding the centre saw). Returns the input when `native` is `against`. Fixing the line to another body leaves it
|
|
26
|
+
* about that body; `sceneOffsetKm(placement, against, displayUtcMs)` then carries it to the scene centre at the display time.
|
|
27
|
+
*/
|
|
28
|
+
export function relativeTrailKm(samples, native, placement, against = placement.center) {
|
|
29
|
+
if (samples.timesUtcMs.length === 0 || native === against)
|
|
26
30
|
return samples.positionsKm;
|
|
27
31
|
const out = Float64Array.from(samples.positionsKm);
|
|
28
32
|
samples.timesUtcMs.forEach((time, index) => {
|
|
29
|
-
const offset = placement.resolver.offsetKm(native,
|
|
33
|
+
const offset = placement.resolver.offsetKm(native, against, time);
|
|
30
34
|
for (let k = 0; k < 3; k += 1)
|
|
31
35
|
out[index * 3 + k] += offset[k];
|
|
32
36
|
});
|
|
@@ -15,6 +15,7 @@ import { readoutPairOf } from "./sceneLayout.js";
|
|
|
15
15
|
import { SceneLabelLayer } from "./SceneLabels.js";
|
|
16
16
|
import { attachScenePointer } from "./scenePointer.js";
|
|
17
17
|
import { StoryMarkerLayer } from "./StoryMarkers.js";
|
|
18
|
+
import { releaseDotTexture } from "./dotMaterial.js";
|
|
18
19
|
import { releaseAnchorSprite } from "./TrackedBodyView.js";
|
|
19
20
|
/** The catalogued body a focus or label id names: the Sun's shell item stands for the Sun body. */
|
|
20
21
|
export function bodyIdOf(runtime, catalogue, id) {
|
|
@@ -99,7 +100,7 @@ export function useSceneFrame(rootRef, inputs) {
|
|
|
99
100
|
* the pictures are disposed, which every renderer that drew them hears and forgets.
|
|
100
101
|
*/
|
|
101
102
|
export function useReleaseSharedTextures() {
|
|
102
|
-
useEffect(() => () => { releaseGlowTexture(); releaseAnchorSprite(); }, []);
|
|
103
|
+
useEffect(() => () => { releaseGlowTexture(); releaseAnchorSprite(); releaseDotTexture(); }, []);
|
|
103
104
|
}
|
|
104
105
|
/**
|
|
105
106
|
* Wakes the draw rule for changes the scene cannot see in its own numbers: every load that starts, progresses, ends or fails (textures, the sky
|
package/src/app/sceneDebug.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { SimulationClock } from "../core/clock.js";
|
|
|
3
3
|
import type { ScalePolicy } from "../core/scalePolicy.js";
|
|
4
4
|
import type { StateResolver } from "../core/stateResolver.js";
|
|
5
5
|
import type { Camera } from "three";
|
|
6
|
-
import type {
|
|
6
|
+
import type { PathScreenReadout } from "./PathView.js";
|
|
7
7
|
import type { BodyScreenReadout } from "./sceneBodies.js";
|
|
8
8
|
import { type DebugReadout } from "./debugReadout.js";
|
|
9
9
|
import type { FloatingOrigin } from "./floatingOrigin.js";
|
|
@@ -23,7 +23,9 @@ export declare function publishSceneData(canvas: HTMLElement, state: {
|
|
|
23
23
|
* What the browser scripts read back about every drawn path line (`data-paths`, JSON): per path its id, whether it is drawn, its vertex count, how many
|
|
24
24
|
* vertices are in view and the share of the view they span (with the box's edges, the major axis angle on screen and the view's aspect), and for an orbit its look in force. This is the line itself, so a check that a path is drawn never depends on its label.
|
|
25
25
|
*/
|
|
26
|
-
export declare function publishPathData(canvas: HTMLElement, views: readonly
|
|
26
|
+
export declare function publishPathData(canvas: HTMLElement, views: readonly {
|
|
27
|
+
screenReadout(camera: Camera): PathScreenReadout;
|
|
28
|
+
}[], camera: Camera): void;
|
|
27
29
|
/**
|
|
28
30
|
* What the browser scripts read back about every point group (`data-points`, JSON): per group its id, whether it is drawn, its member count, how many members
|
|
29
31
|
* are in view (an even sample scaled up) and the share of the view they span. This is the dots themselves, so a check that a stream is drawn never depends on pixels.
|
package/src/app/sceneFrame.d.ts
CHANGED
|
@@ -128,8 +128,8 @@ export interface CameraStep {
|
|
|
128
128
|
export declare function viewUpOf(ctx: Pick<FrameContext, "runtime" | "controls">): RenderVector;
|
|
129
129
|
/** A frame is drawn only once every body's group and orientation node is mounted. */
|
|
130
130
|
export declare function bodiesMounted(runtime: SceneRuntime, refs: BodyRefs): boolean;
|
|
131
|
-
/** Stage 0: the time of this frame; looping playback wraps inside its window first. */
|
|
132
|
-
export declare function frameTime(runtime: SceneRuntime, controls: Pick<SceneControls, "loop">): number;
|
|
131
|
+
/** Stage 0: the time of this frame; looping playback wraps inside its window first, and other playback stops on the window's edge (a scene with a timeline bar). */
|
|
132
|
+
export declare function frameTime(runtime: SceneRuntime, controls: Pick<SceneControls, "loop" | "paceAuto">): number;
|
|
133
133
|
/** Stage 1: brings every view to the time of the frame. Returns the live body-set look. */
|
|
134
134
|
export declare function syncViews(ctx: FrameContext, t: number): BodySetLook;
|
|
135
135
|
/** Stage 2: places the composition about the scene centre and keeps the camera's framing when the scale policy changed. */
|
package/src/app/sceneFrame.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { bootShowing, hideBootLoader } from "../shell/bootLoader.js";
|
|
2
2
|
import { drawnRadii } from "./bodyDraw.js";
|
|
3
3
|
import { DEFAULT_BODY_SET_LOOK, familyColorOf } from "./bodySet.js";
|
|
4
|
+
import { applyPacing } from "../core/pacing.js";
|
|
4
5
|
import { poseCamera, resolveCamera } from "./CameraController.js";
|
|
5
6
|
import { DEFAULT_CAMERA_FAR } from "./experienceDefinition.js";
|
|
6
7
|
import { DEFAULT_FEATURE_MIN_BODY_PX } from "./FeatureMarkers.js";
|
|
@@ -33,10 +34,14 @@ export function viewUpOf(ctx) {
|
|
|
33
34
|
export function bodiesMounted(runtime, refs) {
|
|
34
35
|
return runtime.bodies.every((id) => refs.groups.has(id) && refs.orients.has(id));
|
|
35
36
|
}
|
|
36
|
-
/** Stage 0: the time of this frame; looping playback wraps inside its window first. */
|
|
37
|
+
/** Stage 0: the time of this frame; looping playback wraps inside its window first, and other playback stops on the window's edge (a scene with a timeline bar). */
|
|
37
38
|
export function frameTime(runtime, controls) {
|
|
38
39
|
if (controls.loop === true && runtime.loopWindow !== undefined)
|
|
39
40
|
runtime.clock.wrapWithin(runtime.loopWindow);
|
|
41
|
+
else if (runtime.stopAtWindow === true && runtime.loopWindow !== undefined)
|
|
42
|
+
runtime.clock.stopWithin(runtime.loopWindow);
|
|
43
|
+
if (controls.paceAuto === true && runtime.pacing !== undefined)
|
|
44
|
+
applyPacing(runtime.clock, runtime.pacing);
|
|
40
45
|
return runtime.clock.now();
|
|
41
46
|
}
|
|
42
47
|
/** Stage 1: brings every view to the time of the frame. Returns the live body-set look. */
|
|
@@ -147,7 +152,7 @@ export function placeViews(ctx, t, placed, setLook) {
|
|
|
147
152
|
for (const layer of ctx.layers.bodySetLabels.current)
|
|
148
153
|
layer.update(setLook, hoverGain);
|
|
149
154
|
publishBodySets(canvas, views.bodySetViews, views.orbitSetViews, setLook, camera, size.width, size.height);
|
|
150
|
-
publishPathData(canvas, [...views.sunCentredViews, ...views.compositionPaths], camera);
|
|
155
|
+
publishPathData(canvas, [...views.sunCentredViews, ...views.compositionPaths, ...views.trackedViews], camera);
|
|
151
156
|
publishPointsData(canvas, views.groupViews, camera, views.bodySetViews);
|
|
152
157
|
return hoverGain;
|
|
153
158
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type BodyCatalogue } from "../assets/catalogue.js";
|
|
2
2
|
import type { BodyId } from "../core/body.js";
|
|
3
3
|
import type { ScalePolicy } from "../core/scalePolicy.js";
|
|
4
|
-
import type
|
|
4
|
+
import { type CameraReach } from "./experienceDefinition.js";
|
|
5
5
|
/** A tracked body is a point: the camera may come very close and is framed in Earth radii. */
|
|
6
6
|
export declare const TRACKED_MIN_DISTANCE = 0.002;
|
|
7
7
|
export declare const TRACKED_DEFAULT_DISTANCE = 0.3;
|
package/src/app/sceneFraming.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Scene framing: default distances and fit rules for tracked bodies, groups and bare scenes.
|
|
2
2
|
import { catalogue } from "../assets/catalogue.js";
|
|
3
|
+
import { DEFAULT_CAMERA_FAR } from "./experienceDefinition.js";
|
|
3
4
|
/** A tracked body is a point: the camera may come very close and is framed in Earth radii. */
|
|
4
5
|
export const TRACKED_MIN_DISTANCE = 0.002;
|
|
5
6
|
export const TRACKED_DEFAULT_DISTANCE = 0.3;
|
|
@@ -52,14 +53,19 @@ export function fitReach(farthestUnits, aspect, fovDeg = CAMERA_FOV_DEG) {
|
|
|
52
53
|
}
|
|
53
54
|
/** The declared reach as the viewer applies it now: a fitting reach becomes a farthest zoom-out and far plane for the canvas shape `aspect` (width over height); any other is returned as is. */
|
|
54
55
|
export function liveReach(declared, policy, aspect) {
|
|
55
|
-
if (declared.fitOrbit === undefined)
|
|
56
|
-
|
|
56
|
+
if (declared.fitOrbit === undefined) {
|
|
57
|
+
if (declared.cover === undefined || declared.maxFocusDistance !== undefined)
|
|
58
|
+
return declared;
|
|
59
|
+
// I-114: a path past the planets widens the default zoom-out and far plane so it fits whole; the default is never narrowed.
|
|
60
|
+
const minFocusDistance = fitReach(scaleLength(policy, declared.cover.farthestKm()), aspect > 0 ? aspect : 1);
|
|
61
|
+
return { ...declared, minFocusDistance, far: Math.max(declared.far ?? DEFAULT_CAMERA_FAR, minFocusDistance * FAR_PER_REACH) };
|
|
62
|
+
}
|
|
57
63
|
const maxFocusDistance = fitReach(scaleLength(policy, declared.fitOrbit.farthestKm()), aspect > 0 ? aspect : 1);
|
|
58
64
|
return { maxFocusDistance, far: maxFocusDistance * FAR_PER_REACH };
|
|
59
65
|
}
|
|
60
66
|
/** Zoom limits per focus kind; a declared reach replaces only the farthest distance. */
|
|
61
67
|
export function focusLimits(focus, frame, policy, declared) {
|
|
62
|
-
const max = declared.maxFocusDistance ?? Math.max(30, frame.span * 3.5);
|
|
68
|
+
const max = declared.maxFocusDistance ?? Math.max(30, frame.span * 3.5, declared.minFocusDistance ?? 0);
|
|
63
69
|
const member = frame.memberRadius?.(focus) ?? null;
|
|
64
70
|
if (member !== null)
|
|
65
71
|
return { min: Math.max(MEMBER_MIN_DISTANCE, member * BODY_MIN_FACTOR), max };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { TimeBounds } from "../core/trajectory.js";
|
|
2
|
+
/** The one clock's reading as a host sees it. */
|
|
3
|
+
export interface ViewerState {
|
|
4
|
+
readonly timeUtcMs: number;
|
|
5
|
+
/** Simulated seconds per real second. */
|
|
6
|
+
readonly rate: number;
|
|
7
|
+
readonly playing: boolean;
|
|
8
|
+
/** Only in a scene with pacing: true while pacing sets the rate, false once a visitor or the host has picked a speed. */
|
|
9
|
+
readonly auto?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Who moved the clock: the clock running (`playback`), a person at the controls (`visitor`) or the host page (`host`). */
|
|
12
|
+
export type ViewerChangeCause = "playback" | "visitor" | "host";
|
|
13
|
+
/** What a mounted viewer lets the host do to its one clock. Seeking and rate changes go through the viewer's own handlers, so there is no second clock. */
|
|
14
|
+
export interface ViewerControl {
|
|
15
|
+
readonly window: TimeBounds;
|
|
16
|
+
/** The speeds the timeline offers. */
|
|
17
|
+
readonly rates: readonly number[];
|
|
18
|
+
read(): ViewerState;
|
|
19
|
+
seek(timeUtcMs: number): void;
|
|
20
|
+
/** True: the scene has pacing, so `"auto"` is a valid choice. */
|
|
21
|
+
readonly paced: boolean;
|
|
22
|
+
/** A number is a chosen speed; `"auto"` gives the rate back to the scene's pacing. */
|
|
23
|
+
setRate(rate: number | "auto"): void;
|
|
24
|
+
}
|
|
25
|
+
/** The viewer's side of the host link; the public API supplies the implementation (`ViewerLink`). */
|
|
26
|
+
export interface ViewerPort {
|
|
27
|
+
/** The viewer hands over its clock controls when it opens. */
|
|
28
|
+
attach(control: ViewerControl): void;
|
|
29
|
+
/** The viewer is going away: the controls are no longer valid. */
|
|
30
|
+
detach(): void;
|
|
31
|
+
/** The viewer reports the clock's current reading; the link tells the host only when it differs from the last one. */
|
|
32
|
+
publish(state: ViewerState, cause: ViewerChangeCause): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/src/core/bodies/io.js
CHANGED
|
@@ -111,7 +111,7 @@ export const IO = Object.freeze({
|
|
|
111
111
|
accuracy: "Mean radius 1821.49 km and GM 5959.9155 km^3/s^2 as printed in the Horizons header; Io is drawn as a sphere.",
|
|
112
112
|
notes: "Gravitational parameter in km^3/s^2.",
|
|
113
113
|
}),
|
|
114
|
-
position: fittedMoonPosition("Io", 0.
|
|
114
|
+
position: fittedMoonPosition("Io", 0.1924, JUPITER_MOON_FIT_SPAN),
|
|
115
115
|
validUtc: JUPITER_MOON_FIT_SPAN,
|
|
116
116
|
orientationLimitations: Object.freeze([IO_TIDAL_LOCK_LIMITATION]),
|
|
117
117
|
}),
|
|
@@ -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) => 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,12 +1,12 @@
|
|
|
1
1
|
import { iauElementsFromRecord } from "../iauRotation.js";
|
|
2
2
|
import { JUPITER } from "./jupiter.js";
|
|
3
|
-
import { chunksNeeded, createMoonSystem,
|
|
3
|
+
import { chunksNeeded, createMoonSystem, HISTORICAL_MOON_FIT_SPAN, moonFitSource } from "./moonSystem.js";
|
|
4
4
|
import callistoOrbit from "../../../data/orbits/callisto.json" with { type: "json" };
|
|
5
5
|
import europaOrbit from "../../../data/orbits/europa.json" with { type: "json" };
|
|
6
6
|
import ganymedeOrbit from "../../../data/orbits/ganymede.json" with { type: "json" };
|
|
7
7
|
import ioOrbit from "../../../data/orbits/io.json" with { type: "json" };
|
|
8
8
|
/** The span the committed fits cover (T-096: 2010-01-01 to 2030-01-01 TDB, chunked per calendar year). */
|
|
9
|
-
export const JUPITER_MOON_FIT_SPAN =
|
|
9
|
+
export const JUPITER_MOON_FIT_SPAN = HISTORICAL_MOON_FIT_SPAN;
|
|
10
10
|
export const JUPITER_MOON_FIT_SOURCE = moonFitSource("Jupiter");
|
|
11
11
|
export const JUPITER_MOON_SYSTEM = createMoonSystem({
|
|
12
12
|
centre: "jupiter",
|
|
@@ -27,10 +27,10 @@ export const FITTED_MOON_TIDAL_LOCK = JUPITER_MOON_SYSTEM.tidalLockNote;
|
|
|
27
27
|
export const fittedMoonPosition = JUPITER_MOON_SYSTEM.position;
|
|
28
28
|
/** The Galilean moons turn synchronously: their prime meridians are the IAU records saved with their orbits (`data/orbits/`), the one source. */
|
|
29
29
|
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 });
|
|
31
|
-
export const EUROPA = jupiterMoon("europa", "Europa", 1560.8, 3202.7121, 0.
|
|
32
|
-
export const GANYMEDE = jupiterMoon("ganymede", "Ganymede", 2631.2, 9887.8328, 0.
|
|
33
|
-
export const CALLISTO = jupiterMoon("callisto", "Callisto", 2410.3, 7179.2834, 0.
|
|
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");
|
|
34
34
|
/** Io's binding is in `io.ts` with its definition; the three below are the same pattern. */
|
|
35
35
|
export const IO_FITTED_BINDING = JUPITER_MOON_SYSTEM.binding("io", IO_ROTATION);
|
|
36
36
|
export const MAPPED_MOON_BINDINGS = Object.freeze([
|