@johnmorrisdotca/wakusei-planets 0.32.0 → 0.33.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 +12 -0
- package/NOTICE.md +11 -1
- package/README.md +6 -5
- package/dist/bodies/all.d.ts +1 -0
- package/dist/bodies/all.js +1 -0
- package/dist/bodies/minor.d.ts +1 -0
- package/dist/bodies/minor.js +16 -0
- package/dist/data/minor.d.ts +3 -0
- package/dist/data/minor.js +7 -0
- package/dist/data/tables.d.ts +4 -2
- package/dist/data/tables.js +1 -1
- package/dist/element.js +11 -2
- package/dist/embed.d.ts +1 -1
- package/dist/embed.js +3 -3
- package/dist/ephemeris.d.ts +7 -7
- package/dist/ephemeris.js +36 -13
- package/dist/facts.d.ts +28 -4
- package/dist/facts.js +24 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/nearest.js +6 -4
- package/dist/scene/textures.d.ts +2 -2
- package/dist/space/arrows.d.ts +29 -3
- package/dist/space/arrows.js +38 -6
- package/dist/space/bodies.d.ts +6 -6
- package/dist/space/bodies.js +6 -6
- package/dist/space/element.d.ts +4 -0
- package/dist/space/element.js +19 -4
- package/dist/space/frame.d.ts +28 -3
- package/dist/space/frame.js +40 -4
- package/dist/space/index.d.ts +2 -2
- package/dist/space/index.js +2 -2
- package/dist/space/scale.d.ts +4 -4
- package/dist/space/scale.js +8 -2
- package/dist/space/scene.d.ts +4 -2
- package/dist/space/scene.js +15 -14
- package/dist/stops.d.ts +1 -1
- package/dist/stops.js +4 -1
- package/dist/tables/all.d.ts +1 -0
- package/dist/tables/all.js +1 -0
- package/dist/tables/lazy.d.ts +5 -0
- package/dist/tables/lazy.js +12 -0
- package/dist/tables/minor.d.ts +1 -0
- package/dist/tables/minor.js +317 -0
- package/dist/textures/vesta-1024.webp +0 -0
- package/dist/textures/vesta-512.webp +0 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +12 -2
package/dist/space/scene.js
CHANGED
|
@@ -6,10 +6,10 @@ import {} from "../scene/painter.js";
|
|
|
6
6
|
import "../bodies/all.js";
|
|
7
7
|
import { groundDirection } from "./aim.js";
|
|
8
8
|
import { hostOf } from "./bodies.js";
|
|
9
|
-
import { arrowSites, ARROWS_PER_ORBIT, chevron, spinArrow } from "./arrows.js";
|
|
9
|
+
import { arrowSites, ARROWS_PER_ORBIT, chevron, MAX_ARROWS_PER_ORBIT, spinArrow } from "./arrows.js";
|
|
10
10
|
import { besideMoon } from "./beside.js";
|
|
11
11
|
import { spinAxis } from "./spin.js";
|
|
12
|
-
import { createTrack, moonOrbit, planetOrbit, SPACE_DWARFS, SPACE_PLANETS } from "./frame.js";
|
|
12
|
+
import { createTrack, moonOrbit, planetOrbit, SPACE_DWARFS, SPACE_MINORS, SPACE_PLANETS } from "./frame.js";
|
|
13
13
|
import { ridePose } from "./ride.js";
|
|
14
14
|
import { moonDistance, orbitLine, placeBodies, placeMoon, radiusIn } from "./scale.js";
|
|
15
15
|
const RAD = Math.PI / 180;
|
|
@@ -17,8 +17,8 @@ const RAD = Math.PI / 180;
|
|
|
17
17
|
export const FIT_DISTANCE = 4.1;
|
|
18
18
|
const FOV = 35;
|
|
19
19
|
const ORBIT_POINTS = 96;
|
|
20
|
-
const ORBIT_BODIES = ["earth", ...SPACE_PLANETS, ...SPACE_DWARFS, "moon"];
|
|
21
|
-
/** A dwarf planet is drawn once it is this many CSS pixels across its radius, or when it is the body looked at: Sedna at true scale is never anything but a speck, and its picture is not made for it. */
|
|
20
|
+
const ORBIT_BODIES = ["earth", ...SPACE_PLANETS, ...SPACE_DWARFS, ...SPACE_MINORS, "moon"];
|
|
21
|
+
/** A dwarf planet or a minor body is drawn once it is this many CSS pixels across its radius, or when it is the body looked at: Sedna at true scale is never anything but a speck, and its picture is not made for it. */
|
|
22
22
|
const DWARF_MIN_PX = 0.4;
|
|
23
23
|
/** A colour as three numbers from 0 to 1, from `#rrggbb`. */
|
|
24
24
|
const rgb = (hex) => [parseInt(hex.slice(1, 3), 16) / 255, parseInt(hex.slice(3, 5), 16) / 255, parseInt(hex.slice(5, 7), 16) / 255];
|
|
@@ -38,7 +38,7 @@ const MOON_MIN_SYSTEM_PX = 30;
|
|
|
38
38
|
/** A moon that has been out of sight this long is let go (its pictures too). */
|
|
39
39
|
const MOON_KEEP_MS = 4000;
|
|
40
40
|
/**
|
|
41
|
-
* The
|
|
41
|
+
* The twenty-four bodies the space view places, names and lets a reader choose: the Earth, the Sun, the Moon, the seven other planets, Pluto, the eight other dwarf planets and the five minor bodies (Vesta, Pallas, Chiron, Pholus and Halley). The moons of the planets and of the dwarf planets are placed round their hosts.
|
|
42
42
|
*
|
|
43
43
|
* @example
|
|
44
44
|
* ```ts no-run
|
|
@@ -47,7 +47,7 @@ const MOON_KEEP_MS = 4000;
|
|
|
47
47
|
* console.log(SPACE_BODIES.join(", "));
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
|
-
export const SPACE_BODIES = ["earth", "sun", "moon", ...SPACE_PLANETS, ...SPACE_DWARFS];
|
|
50
|
+
export const SPACE_BODIES = ["earth", "sun", "moon", ...SPACE_PLANETS, ...SPACE_DWARFS, ...SPACE_MINORS];
|
|
51
51
|
export const newSpaceModel = () => ({
|
|
52
52
|
time: Date.now(),
|
|
53
53
|
mode: "true",
|
|
@@ -67,6 +67,7 @@ export const newSpaceModel = () => ({
|
|
|
67
67
|
arrows: {},
|
|
68
68
|
help: false,
|
|
69
69
|
arrowPx: 0,
|
|
70
|
+
arrowCount: ARROWS_PER_ORBIT,
|
|
70
71
|
helpDrawn: null,
|
|
71
72
|
door: { points: 0, used: {} },
|
|
72
73
|
lookups: 0,
|
|
@@ -171,7 +172,7 @@ export function createSpaceItem(model, deps) {
|
|
|
171
172
|
orbits.set(id, { line, positions, colours, faded: false, samples: [], epoch: Number.NaN });
|
|
172
173
|
}
|
|
173
174
|
// the arrowheads of every orbit line: two strokes each, in the colour of the line, in one object; and the help mode's axis and curved arrow in another (drawn over the body, not hidden by it)
|
|
174
|
-
const ARROW_VERTICES = ORBIT_BODIES.length *
|
|
175
|
+
const ARROW_VERTICES = ORBIT_BODIES.length * MAX_ARROWS_PER_ORBIT * 4;
|
|
175
176
|
const arrowPositions = new Float32Array(ARROW_VERTICES * 3);
|
|
176
177
|
const arrowColours = new Float32Array(ARROW_VERTICES * 3);
|
|
177
178
|
const arrowGeometry = new three.BufferGeometry();
|
|
@@ -182,8 +183,8 @@ export function createSpaceItem(model, deps) {
|
|
|
182
183
|
scene.add(arrowLines);
|
|
183
184
|
ORBIT_BODIES.forEach((id, k) => {
|
|
184
185
|
const c = rgb(id === "earth" ? "#6aa8ff" : id === "moon" ? "#c5cdd9" : BODIES[id].colour);
|
|
185
|
-
for (let v = 0; v <
|
|
186
|
-
arrowColours.set(c, (k *
|
|
186
|
+
for (let v = 0; v < MAX_ARROWS_PER_ORBIT * 4; v += 1)
|
|
187
|
+
arrowColours.set(c, (k * MAX_ARROWS_PER_ORBIT * 4 + v) * 3);
|
|
187
188
|
});
|
|
188
189
|
const HELP_SEGMENTS = 28;
|
|
189
190
|
const HELP_VERTICES = (1 + HELP_SEGMENTS + 2) * 2;
|
|
@@ -254,7 +255,7 @@ export function createSpaceItem(model, deps) {
|
|
|
254
255
|
placed[id] = minus(placed[id], origin);
|
|
255
256
|
return placed;
|
|
256
257
|
};
|
|
257
|
-
const toSunOf = (id) => unit(minus(frame.sun, id === "earth" ? [0, 0, 0] : id === "moon" ? frame.moon : id === "sun" ? [0, 0, 0] : SPACE_DWARFS.includes(id) ? frame.dwarfs[id] : frame.planets[id]));
|
|
258
|
+
const toSunOf = (id) => unit(minus(frame.sun, id === "earth" ? [0, 0, 0] : id === "moon" ? frame.moon : id === "sun" ? [0, 0, 0] : SPACE_DWARFS.includes(id) ? frame.dwarfs[id] : SPACE_MINORS.includes(id) ? frame.minors[id] : frame.planets[id]));
|
|
258
259
|
// riding along: the camera sits at a moving point and looks at the body it goes round (a moon over its planet, a point over any body). The point's place and way of going are in radii of
|
|
259
260
|
// that body, from its centre; the body is drawn at `centre` with the radius `unitWorld`, so the same numbers place the camera in the scene.
|
|
260
261
|
model.rideLost = false;
|
|
@@ -452,8 +453,8 @@ export function createSpaceItem(model, deps) {
|
|
|
452
453
|
let paintedBodies = 0;
|
|
453
454
|
for (const id of SPACE_BODIES) {
|
|
454
455
|
const slot = slotOf(id);
|
|
455
|
-
// a dwarf planet too small to see is not made, and one that was made but has shrunk away is hidden
|
|
456
|
-
const unseen = SPACE_DWARFS.includes(id) && px[id] < DWARF_MIN_PX && focus !== id && model.focus !== id && hostOf(model.focus) !== id;
|
|
456
|
+
// a dwarf planet or minor body too small to see is not made, and one that was made but has shrunk away is hidden
|
|
457
|
+
const unseen = (SPACE_DWARFS.includes(id) || SPACE_MINORS.includes(id)) && px[id] < DWARF_MIN_PX && focus !== id && model.focus !== id && hostOf(model.focus) !== id;
|
|
457
458
|
if (unseen) {
|
|
458
459
|
if (slot.drawing)
|
|
459
460
|
slot.drawing.object.visible = false;
|
|
@@ -550,7 +551,7 @@ export function createSpaceItem(model, deps) {
|
|
|
550
551
|
const line = [];
|
|
551
552
|
for (let i = 0; i <= ORBIT_POINTS; i += 1)
|
|
552
553
|
line.push([o.positions[i * 3], o.positions[i * 3 + 1], o.positions[i * 3 + 2]]);
|
|
553
|
-
const sites = arrowSites(line);
|
|
554
|
+
const sites = arrowSites(line, model.arrowCount);
|
|
554
555
|
arrowsNow[id] = sites;
|
|
555
556
|
sites.forEach((site, j) => {
|
|
556
557
|
// an arrow on the faded part of a line goes with it
|
|
@@ -559,7 +560,7 @@ export function createSpaceItem(model, deps) {
|
|
|
559
560
|
const head = chevron(site.position, site.direction, camRight, camUp, ARROW_PX * pixel(site.position));
|
|
560
561
|
if (!head)
|
|
561
562
|
return;
|
|
562
|
-
const base = (k *
|
|
563
|
+
const base = (k * MAX_ARROWS_PER_ORBIT + j) * 4 * 3;
|
|
563
564
|
arrowPositions.set([...head[0], ...head[1], ...head[0], ...head[2]], base);
|
|
564
565
|
if (measured === 0) {
|
|
565
566
|
const tip = labelFor(head[0]);
|
package/dist/stops.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export interface JourneyStop {
|
|
|
32
32
|
escapeKmS: number | null;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
* Every body, in the same order as `BODY_IDS`: the Sun, the planets, the dwarf planets, then the moons.
|
|
35
|
+
* Every body, in the same order as `BODY_IDS`: the Sun, the planets, the dwarf planets, the minor bodies, then the moons.
|
|
36
36
|
*
|
|
37
37
|
* @example
|
|
38
38
|
* ```ts
|
package/dist/stops.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// (https://nssdc.gsfc.nasa.gov/planetary/factsheet/) for the Sun (132,712 × 10^6), Mercury (0.022032 × 10^6) and Venus (0.32486 × 10^6).
|
|
5
5
|
// Ceres, Eris, Makemake and Haumea: the mass on JPL "Planetary Physical Parameters" (https://ssd.jpl.nasa.gov/planets/phys_par.html)
|
|
6
6
|
// times the CODATA 2018 G that page names. Escape speeds for the Sun and those planets are the speeds those pages print.
|
|
7
|
+
// Vesta (17.2882844) and Pallas (13.63): the GM of JPL's Small-Body Database (https://ssd-api.jpl.nasa.gov/sbdb.api, read 2026-11-10), from Park et al. 2025 and Vernazza et al. 2021.
|
|
7
8
|
// A moon's escape speed is sqrt(2 GM / radius) from this package's radius. Nereid, and the dwarf planets and moons
|
|
8
9
|
// whose pages do not print a mass, are left empty.
|
|
9
10
|
import { heliocentric, meanSunAu, moonVector } from "./ephemeris.js";
|
|
@@ -30,6 +31,8 @@ const GM = {
|
|
|
30
31
|
eris: mass(16_600e18),
|
|
31
32
|
makemake: mass(3_100e18),
|
|
32
33
|
haumea: mass(4_006e18),
|
|
34
|
+
vesta: 17.2882844,
|
|
35
|
+
pallas: 13.63,
|
|
33
36
|
moon: 4_902.8,
|
|
34
37
|
phobos: 0.0007087,
|
|
35
38
|
deimos: 0.0000962,
|
|
@@ -89,7 +92,7 @@ const stopOf = (id) => {
|
|
|
89
92
|
};
|
|
90
93
|
};
|
|
91
94
|
/**
|
|
92
|
-
* Every body, in the same order as `BODY_IDS`: the Sun, the planets, the dwarf planets, then the moons.
|
|
95
|
+
* Every body, in the same order as `BODY_IDS`: the Sun, the planets, the dwarf planets, the minor bodies, then the moons.
|
|
93
96
|
*
|
|
94
97
|
* @example
|
|
95
98
|
* ```ts
|
package/dist/tables/all.d.ts
CHANGED
package/dist/tables/all.js
CHANGED
package/dist/tables/lazy.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
/** Fetch the theory for a planet's moons: resolves true for the one call that fetched it, false when it was already asked for or loaded, there is none for that planet, or it could not be fetched. */
|
|
2
2
|
export declare function loadMoonTheory(planet: string): Promise<boolean>;
|
|
3
|
+
/**
|
|
4
|
+
* Fetch the fitted tables of the minor bodies (Vesta, Pallas, Chiron, Pholus, Halley: about 48 kB gzipped) when a picture of one of them is dated: resolves true for the one call that fetched them, false when they were already asked for
|
|
5
|
+
* or loaded, or could not be fetched. Until they arrive a minor body is placed from its osculating elements.
|
|
6
|
+
*/
|
|
7
|
+
export declare function loadMinorTables(): Promise<boolean>;
|
package/dist/tables/lazy.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Loads a planet's moon theory when a picture asks for its moons, so a page that shows one planet does not carry Jupiter's and Saturn's theories. A bundler with code splitting makes each a chunk of its own.
|
|
2
2
|
import { moonTheoryOf } from "../data/theories.js";
|
|
3
|
+
import { tableOf } from "../data/tables.js";
|
|
3
4
|
const LOADERS = {
|
|
4
5
|
jupiter: { moon: "io", load: () => import("./galilean.js") },
|
|
5
6
|
saturn: { moon: "mimas", load: () => import("./saturn-moons.js") },
|
|
@@ -13,3 +14,14 @@ export function loadMoonTheory(planet) {
|
|
|
13
14
|
asked.add(planet);
|
|
14
15
|
return loader.load().then(() => true, () => false);
|
|
15
16
|
}
|
|
17
|
+
let askedMinor = false;
|
|
18
|
+
/**
|
|
19
|
+
* Fetch the fitted tables of the minor bodies (Vesta, Pallas, Chiron, Pholus, Halley: about 48 kB gzipped) when a picture of one of them is dated: resolves true for the one call that fetched them, false when they were already asked for
|
|
20
|
+
* or loaded, or could not be fetched. Until they arrive a minor body is placed from its osculating elements.
|
|
21
|
+
*/
|
|
22
|
+
export function loadMinorTables() {
|
|
23
|
+
if (askedMinor || tableOf("vesta") !== undefined)
|
|
24
|
+
return Promise.resolve(false);
|
|
25
|
+
askedMinor = true;
|
|
26
|
+
return import("./minor.js").then(() => true, () => false);
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|