@johnmorrisdotca/wakusei-planets 0.37.2 → 0.39.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 +20 -0
- package/NOTICE.md +14 -3
- package/README.md +6 -4
- package/dist/belts/data.d.ts +2 -0
- package/dist/belts/data.js +12 -0
- package/dist/belts/index.d.ts +270 -0
- package/dist/belts/index.js +308 -0
- package/dist/belts/totals.d.ts +43 -0
- package/dist/belts/totals.js +25 -0
- package/dist/data/orbiters.d.ts +221 -199
- package/dist/data/orbiters.js +288 -200
- package/dist/data-door.d.ts +2 -0
- package/dist/data-door.js +4 -2
- package/dist/door/own.js +4 -2
- package/dist/door/points.d.ts +14 -5
- package/dist/door/points.js +78 -27
- package/dist/earth-places.d.ts +40 -0
- package/dist/earth-places.js +47 -0
- package/dist/embed.d.ts +4 -1
- package/dist/embed.js +21 -10
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/orbiter-facts.d.ts +61 -4
- package/dist/orbiter-facts.js +17 -3
- package/dist/orbiters.d.ts +122 -2
- package/dist/orbiters.js +205 -3
- package/dist/picture-credits.d.ts +78 -0
- package/dist/picture-credits.js +120 -0
- package/dist/place-marks.d.ts +76 -0
- package/dist/place-marks.js +66 -0
- package/dist/places.d.ts +1 -1
- package/dist/places.js +1 -1
- package/dist/scene/earth-places.d.ts +190 -0
- package/dist/scene/earth-places.js +190 -0
- package/dist/scene/painter.d.ts +11 -0
- package/dist/scene/painter.js +30 -2
- package/dist/scene/textures.d.ts +2 -2
- package/dist/space/element.d.ts +74 -3
- package/dist/space/element.js +293 -8
- package/dist/space/ride.d.ts +4 -4
- package/dist/space/ride.js +10 -3
- package/dist/space/scene.d.ts +44 -2
- package/dist/space/scene.js +139 -11
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +15 -2
package/dist/space/scene.d.ts
CHANGED
|
@@ -4,9 +4,10 @@ import { type BodyId, type MoonId } from "../facts.ts";
|
|
|
4
4
|
import type { ThreeParts } from "../scene/body.ts";
|
|
5
5
|
import type { SourceBook } from "../door/book.ts";
|
|
6
6
|
import { type MoonDot } from "./all-moons.ts";
|
|
7
|
+
import { type BeltId } from "../belts/index.ts";
|
|
7
8
|
import { type PaintLabel, type WakuseiPainter } from "../scene/painter.ts";
|
|
8
9
|
import "../bodies/all.ts";
|
|
9
|
-
import type
|
|
10
|
+
import { type Vec3 } from "../vec.ts";
|
|
10
11
|
import { type OrbitArrow } from "./arrows.ts";
|
|
11
12
|
import type { SightInput } from "./sight.ts";
|
|
12
13
|
import { type SpaceFrame, type SpaceVec3 } from "./frame.ts";
|
|
@@ -124,6 +125,10 @@ export interface OrbiterSet {
|
|
|
124
125
|
position(id: string, ms: number): Vec3 | null;
|
|
125
126
|
path(id: string, ms: number, points: number): Vec3[];
|
|
126
127
|
status(id: string, ms: number): "tracked" | "predicted" | "modelled" | "none";
|
|
128
|
+
/** Whether the craft is drawn dim at a moment: a modelled path, or a predicted one that misses Horizons by more than a small share of its body's radius. */
|
|
129
|
+
dim(id: string, ms: number): boolean;
|
|
130
|
+
/** One trip round the body, in days; `null` for a craft with no path. */
|
|
131
|
+
period(id: string): number | null;
|
|
127
132
|
name(id: string): {
|
|
128
133
|
en: string;
|
|
129
134
|
ja: string;
|
|
@@ -199,10 +204,19 @@ export interface SpaceModel {
|
|
|
199
204
|
/** Show the spacecraft in orbit round the Moon and Mars: a dot each on its orbit line, named, once its body is big enough on the screen. Off by default; their paths are loaded when first shown. */
|
|
200
205
|
orbiters: boolean;
|
|
201
206
|
orbiterSet: OrbiterSet | null;
|
|
202
|
-
/** The
|
|
207
|
+
/** The orbiter picked out: its line drawn brighter, and its ground track when `orbiterTrack` is on. */
|
|
208
|
+
orbiterChosen: string | null;
|
|
209
|
+
/** Which orbiters' orbit lines are drawn: every craft's, the chosen one's only, or none. */
|
|
210
|
+
orbiterLines: "all" | "chosen" | "none";
|
|
211
|
+
/** Draw the chosen orbiter's ground track on its body. */
|
|
212
|
+
orbiterTrack: boolean;
|
|
213
|
+
/** The orbiters at the last draw: how many were drawn, each drawn one's status, which were drawn dim, how many orbit lines, and how many points of ground track. */
|
|
203
214
|
orbitersDrawn: {
|
|
204
215
|
count: number;
|
|
205
216
|
status: Record<string, "tracked" | "predicted" | "modelled" | "none">;
|
|
217
|
+
dim: string[];
|
|
218
|
+
lines: number;
|
|
219
|
+
track: number;
|
|
206
220
|
};
|
|
207
221
|
/** Show Starman and the Roadster: a small marked body on its orbit line, named. Off by default; its path is loaded when it is first shown. */
|
|
208
222
|
roadster: boolean;
|
|
@@ -238,8 +252,17 @@ export interface SpaceModel {
|
|
|
238
252
|
/** The data door at the last draw: how many small bodies are in the one instanced draw, and how many tiles or marks each source gave (by id): the credits. */
|
|
239
253
|
door: {
|
|
240
254
|
points: number;
|
|
255
|
+
belts: number;
|
|
256
|
+
draws: number;
|
|
241
257
|
used: Record<string, number>;
|
|
242
258
|
};
|
|
259
|
+
/** The belts drawn (the package's own source of them, `wakusei-belts`): `[]` for none. The default is every belt. */
|
|
260
|
+
belts: readonly BeltId[];
|
|
261
|
+
/** Where the label of the Oort cloud's shell is on the screen at the last draw, in CSS pixels, or null when the shell is not drawn or not in view. */
|
|
262
|
+
oort: {
|
|
263
|
+
x: number;
|
|
264
|
+
y: number;
|
|
265
|
+
} | null;
|
|
243
266
|
/** How many frames the ephemeris has worked out. */
|
|
244
267
|
lookups: number;
|
|
245
268
|
/** Pixels a game-second moves things on the screen (the fastest turning body in sight): the draw rate follows it. */
|
|
@@ -381,6 +404,25 @@ export interface SpaceDeps {
|
|
|
381
404
|
height: number;
|
|
382
405
|
radiusPx: number;
|
|
383
406
|
} | null) => void;
|
|
407
|
+
/** Whether the Earth's surface is wanted at this draw by `onEarth` (left out, it is not): the page has places to lay on it. */
|
|
408
|
+
wantEarth?: () => boolean;
|
|
409
|
+
/** The Earth as this draw left it, wherever the camera looks, for the places laid on it: what `onSurface` gives, and `sun`, the direction of the Sun from the Earth in the scene (null with the light `lit`, when nothing is in the night). Null when the Earth is not drawn, or while the camera rides. */
|
|
410
|
+
onEarth?: (body: {
|
|
411
|
+
id: BodyId;
|
|
412
|
+
centre: Vec3;
|
|
413
|
+
radius: number;
|
|
414
|
+
pole: Vec3;
|
|
415
|
+
meridian: Vec3;
|
|
416
|
+
eye: Vec3;
|
|
417
|
+
project(point: Vec3): {
|
|
418
|
+
x: number;
|
|
419
|
+
y: number;
|
|
420
|
+
} | null;
|
|
421
|
+
width: number;
|
|
422
|
+
height: number;
|
|
423
|
+
radiusPx: number;
|
|
424
|
+
sun: Vec3 | null;
|
|
425
|
+
} | null) => void;
|
|
384
426
|
/** Called at the end of a draw while the camera is moving from one ride to another, so the next frame is asked for (at the page's frame cap). */
|
|
385
427
|
onMoving?: () => void;
|
|
386
428
|
/** The target of the ride could not be placed at this draw. */
|
package/dist/space/scene.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { BODIES, MOONS_OF } from "../facts.js";
|
|
2
2
|
import { createSmallBodyPoints } from "../door/points.js";
|
|
3
3
|
import { createMoonDots } from "./all-moons.js";
|
|
4
|
+
import { BELT_IDS, BELTS, OORT } from "../belts/index.js";
|
|
4
5
|
import { toTerrestrialTime } from "../clock.js";
|
|
5
6
|
import { moonOffset, orientation } from "../scene/orient.js";
|
|
6
7
|
import {} from "../scene/painter.js";
|
|
7
8
|
import "../bodies/all.js";
|
|
9
|
+
import { turn } from "../vec.js";
|
|
8
10
|
import { groundDirection } from "./aim.js";
|
|
9
11
|
import { hostOf } from "./bodies.js";
|
|
10
12
|
import { arrowSites, ARROWS_PER_ORBIT, chevron, MAX_ARROWS_PER_ORBIT, spinArrow } from "./arrows.js";
|
|
@@ -47,6 +49,9 @@ const ORBITER_PX = 2.2;
|
|
|
47
49
|
const ORBITER_HOST_PX = 24;
|
|
48
50
|
/** An orbiter's orbit line is worked out again when the moment has moved this far from the line's epoch (the node and periapsis drift a little a day). */
|
|
49
51
|
const ORBITER_LINE_KEEP_MS = 86_400_000;
|
|
52
|
+
/** The chosen orbiter's ground track: this many points, from one trip before the moment to one trip after, a hair above the body's surface. */
|
|
53
|
+
const TRACK_POINTS = 240;
|
|
54
|
+
const TRACK_LIFT = 1.006;
|
|
50
55
|
/** The Roadster is drawn as a dot this many CSS pixels across its radius: a car is nothing at any scale of the view. */
|
|
51
56
|
const ROADSTER_PX = 3;
|
|
52
57
|
/** The Roadster's orbit line spans this long round the moment shown (about one trip round the Sun), and is worked out again when the moment has moved this far from the line's middle. */
|
|
@@ -89,7 +94,10 @@ export const newSpaceModel = () => ({
|
|
|
89
94
|
arrowCount: ARROWS_PER_ORBIT,
|
|
90
95
|
orbiters: false,
|
|
91
96
|
orbiterSet: null,
|
|
92
|
-
|
|
97
|
+
orbiterChosen: null,
|
|
98
|
+
orbiterLines: "all",
|
|
99
|
+
orbiterTrack: false,
|
|
100
|
+
orbitersDrawn: { count: 0, status: {}, dim: [], lines: 0, track: 0 },
|
|
93
101
|
roadster: false,
|
|
94
102
|
roadsterPath: null,
|
|
95
103
|
roadsterDrawn: { shown: false, position: null, radiusPx: 0 },
|
|
@@ -97,7 +105,9 @@ export const newSpaceModel = () => ({
|
|
|
97
105
|
labelVersion: 0,
|
|
98
106
|
labelsDrawn: { count: 0, focus: null },
|
|
99
107
|
helpDrawn: null,
|
|
100
|
-
door: { points: 0, used: {} },
|
|
108
|
+
door: { points: 0, belts: 0, draws: 0, used: {} },
|
|
109
|
+
belts: BELT_IDS,
|
|
110
|
+
oort: null,
|
|
101
111
|
lookups: 0,
|
|
102
112
|
motion: 0,
|
|
103
113
|
drawnView: null,
|
|
@@ -143,7 +153,7 @@ export function createSpaceItem(model, deps) {
|
|
|
143
153
|
let trackStep = model.stepMs;
|
|
144
154
|
const scene = new three.Scene();
|
|
145
155
|
// the small bodies of the record sources, in one instanced draw (a page's own subset of three needs the two instanced classes for it)
|
|
146
|
-
const points = deps.book !== undefined && typeof three.InstancedBufferGeometry === "function" ? createSmallBodyPoints(three) : undefined;
|
|
156
|
+
const points = deps.book !== undefined && typeof three.InstancedBufferGeometry === "function" ? createSmallBodyPoints(three, { colours: Object.fromEntries(BELT_IDS.map((id) => [id, BELTS[id].colour])) }) : undefined;
|
|
147
157
|
if (points !== undefined)
|
|
148
158
|
scene.add(points.object);
|
|
149
159
|
let pointsVersion = -1;
|
|
@@ -151,6 +161,16 @@ export function createSpaceItem(model, deps) {
|
|
|
151
161
|
const dots = typeof three.Points === "function" ? createMoonDots(three) : undefined;
|
|
152
162
|
if (dots !== undefined)
|
|
153
163
|
scene.add(dots.object);
|
|
164
|
+
let pointsBelts = null;
|
|
165
|
+
// the Oort cloud: three great circles at the shell's inner edge, drawn where the squeezed scale fits it (true to scale it is 2,000 astronomical units out, far past this view's reach)
|
|
166
|
+
const OORT_SEGMENTS = 96;
|
|
167
|
+
const oortPositions = new Float32Array(3 * (OORT_SEGMENTS + 1) * 3);
|
|
168
|
+
const oortGeometry = new three.BufferGeometry();
|
|
169
|
+
oortGeometry.setAttribute("position", new three.BufferAttribute(oortPositions, 3));
|
|
170
|
+
const oortLines = new three.Line(oortGeometry, new three.LineBasicMaterial({ color: 0x8a96c8, transparent: true, opacity: 0.35 }));
|
|
171
|
+
oortLines.frustumCulled = false;
|
|
172
|
+
oortLines.visible = false;
|
|
173
|
+
scene.add(oortLines);
|
|
154
174
|
const camera = new three.PerspectiveCamera(FOV, width / Math.max(1, height), 0.05, 1000);
|
|
155
175
|
const target = new three.Vector3();
|
|
156
176
|
const projected = new three.Vector3();
|
|
@@ -288,6 +308,16 @@ export function createSpaceItem(model, deps) {
|
|
|
288
308
|
orbiterDrawings.set(id, drawing);
|
|
289
309
|
return drawing;
|
|
290
310
|
};
|
|
311
|
+
// the chosen orbiter's ground track: one line, in the body's radii round its centre, kept for the view's life
|
|
312
|
+
const trackPositions = new Float32Array((TRACK_POINTS + 1) * 3);
|
|
313
|
+
const trackGeometry = new three.BufferGeometry();
|
|
314
|
+
trackGeometry.setAttribute("position", new three.BufferAttribute(trackPositions, 3));
|
|
315
|
+
const trackMaterial = new three.LineBasicMaterial({ color: 0xffd27a, transparent: true, opacity: 0.85 });
|
|
316
|
+
const trackLine = new three.Line(trackGeometry, trackMaterial);
|
|
317
|
+
trackLine.visible = false;
|
|
318
|
+
trackLine.frustumCulled = false;
|
|
319
|
+
scene.add(trackLine);
|
|
320
|
+
const trackMade = { id: "", time: Number.NaN };
|
|
291
321
|
const labelFor = (v) => {
|
|
292
322
|
projected.set(v[0], v[1], v[2]).project(camera);
|
|
293
323
|
if (projected.z > 1 || projected.z < -1)
|
|
@@ -653,10 +683,53 @@ export function createSpaceItem(model, deps) {
|
|
|
653
683
|
if (pointsVersion !== deps.book.version) {
|
|
654
684
|
pointsVersion = deps.book.version;
|
|
655
685
|
points.set(deps.book.smallBodies());
|
|
686
|
+
pointsBelts = null;
|
|
687
|
+
}
|
|
688
|
+
// the belts the view shows: a belt left out of `model.belts` is taken out of the draw (the package's own source of them, whose bodies carry a belt; the bodies of a page's own source are always drawn)
|
|
689
|
+
const wanted = model.belts.join(",");
|
|
690
|
+
if (wanted !== pointsBelts) {
|
|
691
|
+
pointsBelts = wanted;
|
|
692
|
+
points.set(deps.book.smallBodies().filter((body) => body.belt === undefined || model.belts.includes(body.belt)));
|
|
656
693
|
}
|
|
657
694
|
const ratio = model.ratio();
|
|
658
695
|
points.update({ jd: toTerrestrialTime(model.time) / 86_400_000 + 2_440_587.5, mode, sun: sunPos, width: size.width * ratio, height: size.height * ratio, ratio });
|
|
659
|
-
|
|
696
|
+
let belts = 0;
|
|
697
|
+
for (const id of BELT_IDS)
|
|
698
|
+
belts += points.countOf(id);
|
|
699
|
+
model.door.points = points.count - belts;
|
|
700
|
+
model.door.belts = belts;
|
|
701
|
+
model.door.draws = points.draws;
|
|
702
|
+
}
|
|
703
|
+
// the Oort cloud's shell, labelled, where the squeezed scale has room for it
|
|
704
|
+
model.oort = null;
|
|
705
|
+
oortLines.visible = mode === "compressed" && model.orbits && model.belts.length > 0;
|
|
706
|
+
if (oortLines.visible) {
|
|
707
|
+
const radius = OORT.innerAu ** 0.45 * 70;
|
|
708
|
+
const circle = (axis) => {
|
|
709
|
+
for (let i = 0; i <= OORT_SEGMENTS; i += 1) {
|
|
710
|
+
const t = (i / OORT_SEGMENTS) * 2 * Math.PI;
|
|
711
|
+
const c = Math.cos(t) * radius;
|
|
712
|
+
const sn = Math.sin(t) * radius;
|
|
713
|
+
const v = axis === 0 ? [c, sn, 0] : axis === 1 ? [0, c, sn] : [c, 0, sn];
|
|
714
|
+
oortPositions.set([sunPos[0] + v[0], sunPos[1] + v[1], sunPos[2] + v[2]], (axis * (OORT_SEGMENTS + 1) + i) * 3);
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
circle(0);
|
|
718
|
+
circle(1);
|
|
719
|
+
circle(2);
|
|
720
|
+
oortGeometry.getAttribute("position").needsUpdate = true;
|
|
721
|
+
// the label sits on the shell where it is nearest the middle of the picture and in front of the camera
|
|
722
|
+
let best = Number.POSITIVE_INFINITY;
|
|
723
|
+
for (let i = 0; i < 3 * (OORT_SEGMENTS + 1); i += 2) {
|
|
724
|
+
projected.set(oortPositions[i * 3], oortPositions[i * 3 + 1], oortPositions[i * 3 + 2]).project(camera);
|
|
725
|
+
if (projected.z > 1 || projected.z < -1 || Math.abs(projected.x) > 0.9 || Math.abs(projected.y) > 0.9)
|
|
726
|
+
continue;
|
|
727
|
+
const off = projected.x * projected.x + projected.y * projected.y;
|
|
728
|
+
if (off < best) {
|
|
729
|
+
best = off;
|
|
730
|
+
model.oort = { x: ((projected.x + 1) / 2) * size.width, y: ((1 - projected.y) / 2) * size.height };
|
|
731
|
+
}
|
|
732
|
+
}
|
|
660
733
|
}
|
|
661
734
|
if (dots !== undefined) {
|
|
662
735
|
const list = model.allMoons?.(model.time) ?? [];
|
|
@@ -670,11 +743,13 @@ export function createSpaceItem(model, deps) {
|
|
|
670
743
|
// Close to a body (its disc is a few dozen pixels across) the other orbit lines are seen edge-on, long straight scratches across it: only the lines of its own system are kept, and of those the part near it fades
|
|
671
744
|
const nearId = (rideFrom ? rideFrom.around : SPACE_BODIES.includes(focus) ? focus : (hostOf(focus) ?? "earth"));
|
|
672
745
|
const closeUp = px[nearId] >= CLOSE_UP_PX;
|
|
746
|
+
// flying through a belt (a point of the ride's own, round the Sun): the planets' orbit lines would be long scratches across the dots, so they are let go
|
|
747
|
+
const flying = rideFrom !== null && rideFrom.around === "sun" && typeof model.ride?.target !== "string";
|
|
673
748
|
const ownLine = (id) => id === nearId || (id === "moon" && (nearId === "earth" || nearId === "moon"));
|
|
674
749
|
const nearRadius = radiusOf(nearId);
|
|
675
750
|
for (const id of ORBIT_BODIES) {
|
|
676
751
|
const o = orbits.get(id);
|
|
677
|
-
const hide = closeUp && !ownLine(id);
|
|
752
|
+
const hide = flying || (closeUp && !ownLine(id));
|
|
678
753
|
o.line.visible = model.orbits && !hide;
|
|
679
754
|
if (!model.orbits)
|
|
680
755
|
continue;
|
|
@@ -749,6 +824,9 @@ export function createSpaceItem(model, deps) {
|
|
|
749
824
|
const orbiterSet = model.orbiters ? model.orbiterSet : null;
|
|
750
825
|
const orbiterPlaces = {};
|
|
751
826
|
const orbiterStatus = {};
|
|
827
|
+
const orbitersDim = [];
|
|
828
|
+
let linesDrawn = 0;
|
|
829
|
+
let trackDrawn = 0;
|
|
752
830
|
if (orbiterSet !== null) {
|
|
753
831
|
for (const id of orbiterSet.ids) {
|
|
754
832
|
const centre = orbiterSet.centre(id);
|
|
@@ -774,7 +852,8 @@ export function createSpaceItem(model, deps) {
|
|
|
774
852
|
drawing.mesh.position.set(place[0], place[1], place[2]);
|
|
775
853
|
drawing.mesh.scale.setScalar(drawn);
|
|
776
854
|
drawing.material.uniforms.uLight.value.set(...toSunOf(centre));
|
|
777
|
-
const dim =
|
|
855
|
+
const dim = orbiterSet.dim(id, model.time);
|
|
856
|
+
const chosen = model.orbiterChosen === id;
|
|
778
857
|
drawing.material.uniforms.uColour.value.set(dim ? 0.55 : 0.75, dim ? 0.6 : 0.9, dim ? 0.65 : 1);
|
|
779
858
|
if (!Number.isFinite(drawing.epoch) || Math.abs(model.time - drawing.epoch) > ORBITER_LINE_KEEP_MS) {
|
|
780
859
|
const points = orbiterSet.path(id, model.time, ORBIT_POINTS);
|
|
@@ -790,10 +869,39 @@ export function createSpaceItem(model, deps) {
|
|
|
790
869
|
// the line is in the body's radii round the origin: placed and scaled with the body
|
|
791
870
|
drawing.line.position.set(pos[centre][0], pos[centre][1], pos[centre][2]);
|
|
792
871
|
drawing.line.scale.setScalar(hostRadius);
|
|
793
|
-
drawing.lineMaterial.opacity = dim ? 0.
|
|
794
|
-
drawing.line.visible = model.
|
|
872
|
+
drawing.lineMaterial.opacity = chosen ? (dim ? 0.5 : 0.85) : dim ? 0.2 : 0.4;
|
|
873
|
+
drawing.line.visible = model.orbiterLines === "all" || (model.orbiterLines === "chosen" && chosen);
|
|
874
|
+
if (drawing.line.visible)
|
|
875
|
+
linesDrawn += 1;
|
|
795
876
|
orbiterPlaces[id] = { at: place, px: dotPx };
|
|
796
877
|
orbiterStatus[id] = status;
|
|
878
|
+
if (dim)
|
|
879
|
+
orbitersDim.push(id);
|
|
880
|
+
// the ground track: where the craft was and will be over the surface, one trip either side, each point turned with the body from its moment to the moment shown
|
|
881
|
+
const period = chosen && model.orbiterTrack ? orbiterSet.period(id) : null;
|
|
882
|
+
if (period !== null) {
|
|
883
|
+
if (trackMade.id !== id || trackMade.time !== model.time) {
|
|
884
|
+
const pole = orientation(centre, model.time).pole;
|
|
885
|
+
const rate = BODIES[centre].prime.rate;
|
|
886
|
+
const span = period * 86_400_000;
|
|
887
|
+
for (let i = 0; i <= TRACK_POINTS; i += 1) {
|
|
888
|
+
const t = model.time - span + (2 * span * i) / TRACK_POINTS;
|
|
889
|
+
const below = orbiterSet.position(id, t);
|
|
890
|
+
const u = below === null ? [0, 0, 0] : turn(unit(eclipticToScene(below)), pole, (rate * (model.time - t)) / 86_400_000);
|
|
891
|
+
trackPositions[i * 3] = u[0] * TRACK_LIFT;
|
|
892
|
+
trackPositions[i * 3 + 1] = u[1] * TRACK_LIFT;
|
|
893
|
+
trackPositions[i * 3 + 2] = u[2] * TRACK_LIFT;
|
|
894
|
+
}
|
|
895
|
+
trackGeometry.getAttribute("position").needsUpdate = true;
|
|
896
|
+
trackMade.id = id;
|
|
897
|
+
trackMade.time = model.time;
|
|
898
|
+
}
|
|
899
|
+
trackLine.position.set(pos[centre][0], pos[centre][1], pos[centre][2]);
|
|
900
|
+
trackLine.scale.setScalar(hostRadius);
|
|
901
|
+
trackMaterial.opacity = dim ? 0.45 : 0.85;
|
|
902
|
+
trackLine.visible = true;
|
|
903
|
+
trackDrawn = TRACK_POINTS + 1;
|
|
904
|
+
}
|
|
797
905
|
}
|
|
798
906
|
}
|
|
799
907
|
else {
|
|
@@ -802,7 +910,9 @@ export function createSpaceItem(model, deps) {
|
|
|
802
910
|
drawing.line.visible = false;
|
|
803
911
|
}
|
|
804
912
|
}
|
|
805
|
-
|
|
913
|
+
if (trackDrawn === 0)
|
|
914
|
+
trackLine.visible = false;
|
|
915
|
+
model.orbitersDrawn = { count: Object.keys(orbiterPlaces).length, status: orbiterStatus, dim: orbitersDim, lines: linesDrawn, track: trackDrawn };
|
|
806
916
|
model.roadsterDrawn = { shown: roadsterAt !== null, position: roadsterAt === null ? null : [roadsterAt[0] + origin[0], roadsterAt[1] + origin[1], roadsterAt[2] + origin[2]], radiusPx: roadsterPx };
|
|
807
917
|
// the arrowheads on the lines: small in screen pixels at the place, pointing the way the body goes (the lines run from the body once round in the order it goes, whichever way the clock runs)
|
|
808
918
|
const e = camera.matrixWorld.elements;
|
|
@@ -844,7 +954,7 @@ export function createSpaceItem(model, deps) {
|
|
|
844
954
|
});
|
|
845
955
|
model.arrows = arrowsNow;
|
|
846
956
|
model.arrowPx = measured;
|
|
847
|
-
arrowLines.visible = model.orbits;
|
|
957
|
+
arrowLines.visible = model.orbits && !flying;
|
|
848
958
|
arrowGeometry.getAttribute("position").needsUpdate = true;
|
|
849
959
|
arrowGeometry.getAttribute("color").needsUpdate = true;
|
|
850
960
|
// help mode: on the body looked at, the line of its axis and a curved arrow round it the way it turns
|
|
@@ -976,9 +1086,10 @@ export function createSpaceItem(model, deps) {
|
|
|
976
1086
|
tally(held.slot.drawing);
|
|
977
1087
|
model.labelsDrawn = { count: labelsDrawn, focus: (slots.get(focus)?.drawing ?? moonSlots.get(focus)?.slot.drawing)?.label ?? null };
|
|
978
1088
|
model.tiles = tiles;
|
|
1089
|
+
// the package's own belts are credited for the bodies of them that are drawn (a belt switched off gives none)
|
|
979
1090
|
if (points !== undefined && deps.book !== undefined && points.count > 0)
|
|
980
1091
|
for (const [id, read] of deps.book.recordReads())
|
|
981
|
-
used[id] = read.records.length;
|
|
1092
|
+
used[id] = id === "wakusei-belts" ? model.door.belts : read.records.length;
|
|
982
1093
|
model.door.used = used;
|
|
983
1094
|
if (deps.onLabels && model.labels) {
|
|
984
1095
|
const places = { ...moonPlaces };
|
|
@@ -1012,6 +1123,19 @@ export function createSpaceItem(model, deps) {
|
|
|
1012
1123
|
places[id].behind = cover;
|
|
1013
1124
|
deps.onLabels(places);
|
|
1014
1125
|
}
|
|
1126
|
+
// after the names: the places on the Earth keep clear of them
|
|
1127
|
+
if (deps.onEarth && (deps.wantEarth?.() ?? false)) {
|
|
1128
|
+
const earth = rideFrom ? undefined : slots.get("earth")?.drawing;
|
|
1129
|
+
if (earth === undefined || !earth.object.visible)
|
|
1130
|
+
deps.onEarth(null);
|
|
1131
|
+
else {
|
|
1132
|
+
const at = earth.object.position;
|
|
1133
|
+
const r = earth.object.scale.x;
|
|
1134
|
+
const d = Math.hypot(at.x - camera.position.x, at.y - camera.position.y, at.z - camera.position.z);
|
|
1135
|
+
const { pole, meridian } = orientation("earth", model.time);
|
|
1136
|
+
deps.onEarth({ id: "earth", centre: [at.x, at.y, at.z], radius: r, pole, meridian, eye: [camera.position.x, camera.position.y, camera.position.z], project: labelFor, width: size.width, height: size.height, radiusPx: d <= r * 1.001 ? 1e5 : ((size.height / 2) * (r / Math.sqrt(d * d - r * r))) / half, sun: model.light === "lit" ? null : toSunOf("earth") });
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1015
1139
|
if (deps.onSight && (deps.wantSight?.() ?? true)) {
|
|
1016
1140
|
// each body in the camera's own axes: in front when it is ahead (negative z), its place from the projection (a pan included), and the way to it on the screen from its x and y, which holds behind the camera too
|
|
1017
1141
|
const sights = {};
|
|
@@ -1043,6 +1167,8 @@ export function createSpaceItem(model, deps) {
|
|
|
1043
1167
|
dispose() {
|
|
1044
1168
|
points?.dispose();
|
|
1045
1169
|
dots?.dispose();
|
|
1170
|
+
oortGeometry.dispose();
|
|
1171
|
+
oortLines.material.dispose();
|
|
1046
1172
|
if (releaseTimer !== undefined)
|
|
1047
1173
|
clearTimeout(releaseTimer);
|
|
1048
1174
|
ended = true;
|
|
@@ -1068,6 +1194,8 @@ export function createSpaceItem(model, deps) {
|
|
|
1068
1194
|
drawing.lineMaterial.dispose();
|
|
1069
1195
|
}
|
|
1070
1196
|
orbiterGeometry.dispose();
|
|
1197
|
+
trackGeometry.dispose();
|
|
1198
|
+
trackMaterial.dispose();
|
|
1071
1199
|
},
|
|
1072
1200
|
};
|
|
1073
1201
|
},
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.39.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.
|
|
1
|
+
export const VERSION = "0.39.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/wakusei-planets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"description": "Wakusei Planets 惑星 — The Sun, planets and moons for the web: each as a clean line drawing, a shaded realistic drawing or a painted surface map, with real sizes, axial tilt and rotation as data, and positions of the moons for any date and time. SVG for the lines, three.js (optional) for the rest.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"planets",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"./dist/lineup/element.js",
|
|
93
93
|
"./dist/space/element.js",
|
|
94
94
|
"./dist/plan/element.js",
|
|
95
|
+
"./dist/earth-places.js",
|
|
95
96
|
"./dist/bodies/*.js",
|
|
96
97
|
"./dist/tables/*.js",
|
|
97
98
|
"./dist/craft/*.js",
|
|
@@ -100,6 +101,7 @@
|
|
|
100
101
|
"./src/lineup/element.ts",
|
|
101
102
|
"./src/space/element.ts",
|
|
102
103
|
"./src/plan/element.ts",
|
|
104
|
+
"./src/earth-places.ts",
|
|
103
105
|
"./src/bodies/*.ts",
|
|
104
106
|
"./src/tables/*.ts",
|
|
105
107
|
"./src/craft/*.ts"
|
|
@@ -168,6 +170,11 @@
|
|
|
168
170
|
"import": "./dist/kids/index.js",
|
|
169
171
|
"default": "./dist/kids/index.js"
|
|
170
172
|
},
|
|
173
|
+
"./belts": {
|
|
174
|
+
"types": "./dist/belts/index.d.ts",
|
|
175
|
+
"import": "./dist/belts/index.js",
|
|
176
|
+
"default": "./dist/belts/index.js"
|
|
177
|
+
},
|
|
171
178
|
"./nearest": {
|
|
172
179
|
"types": "./dist/nearest.d.ts",
|
|
173
180
|
"import": "./dist/nearest.js",
|
|
@@ -524,6 +531,11 @@
|
|
|
524
531
|
"import": "./dist/bodies/earth.js",
|
|
525
532
|
"default": "./dist/bodies/earth.js"
|
|
526
533
|
},
|
|
534
|
+
"./earth-places": {
|
|
535
|
+
"types": "./dist/earth-places.d.ts",
|
|
536
|
+
"import": "./dist/earth-places.js",
|
|
537
|
+
"default": "./dist/earth-places.js"
|
|
538
|
+
},
|
|
527
539
|
"./coordinates": {
|
|
528
540
|
"types": "./dist/coordinates.d.ts",
|
|
529
541
|
"import": "./dist/coordinates.js",
|
|
@@ -567,6 +579,7 @@
|
|
|
567
579
|
"prepublishOnly": "pnpm check",
|
|
568
580
|
"tiles": ".cache/venv/bin/python -I scripts/make-body-tiles.py build",
|
|
569
581
|
"test:tiles": ".cache/venv/bin/python -I scripts/make-body-tiles.py selftest",
|
|
582
|
+
"orbiters:refresh": "python3 -I scripts/make-orbiter-data.py --brief --cache \"$HOME/.cache/wakusei-planets/horizons-orbiters\"",
|
|
570
583
|
"family:readme": "node scripts/family-readme.mjs",
|
|
571
584
|
"readme:images": "node scripts/readme-images.mjs",
|
|
572
585
|
"site": "pnpm build && node scripts/site.ts",
|
|
@@ -589,7 +602,7 @@
|
|
|
589
602
|
"@angular/core": "^22.2.4",
|
|
590
603
|
"@angular/platform-browser": "^22.2.4",
|
|
591
604
|
"@eslint/js": "^9.0.0",
|
|
592
|
-
"@johnmorrisdotca/chikyu-earth": "^0.
|
|
605
|
+
"@johnmorrisdotca/chikyu-earth": "^0.36.0",
|
|
593
606
|
"@playwright/test": "1.64.0",
|
|
594
607
|
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
595
608
|
"@types/node": "^24.0.0",
|