@johnmorrisdotca/wakusei-planets 0.75.1 → 0.76.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 (60) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/NOTICE.md +20 -10
  3. package/README.md +6 -6
  4. package/dist/asteroids.d.ts +13 -13
  5. package/dist/asteroids.js +8 -8
  6. package/dist/bodies/minor.js +23 -2
  7. package/dist/bodies/moons-uranus.js +1 -1
  8. package/dist/data/asteroids.js +0 -3
  9. package/dist/data/minor.js +6 -0
  10. package/dist/data/shapes/arrokoth-craft.d.ts +2 -0
  11. package/dist/data/shapes/arrokoth-craft.js +8 -0
  12. package/dist/data/shapes/bennu-craft.d.ts +2 -0
  13. package/dist/data/shapes/bennu-craft.js +8 -0
  14. package/dist/data/shapes/eros-craft.d.ts +2 -0
  15. package/dist/data/shapes/eros-craft.js +8 -0
  16. package/dist/facts.d.ts +1 -1
  17. package/dist/facts.js +6 -3
  18. package/dist/picture-credits.d.ts +1 -1
  19. package/dist/picture-credits.js +13 -6
  20. package/dist/place-radii.d.ts +1 -13
  21. package/dist/place-radii.js +1 -5
  22. package/dist/places.d.ts +1 -1
  23. package/dist/places.js +1 -1
  24. package/dist/scene/body.js +19 -4
  25. package/dist/scene/craft.d.ts +30 -0
  26. package/dist/scene/craft.js +63 -0
  27. package/dist/scene/look.d.ts +5 -0
  28. package/dist/scene/painter.js +41 -0
  29. package/dist/scene/textures.d.ts +2 -2
  30. package/dist/shape-basis.d.ts +1 -1
  31. package/dist/shape-basis.js +2 -0
  32. package/dist/space/asteroid-ids.d.ts +1 -1
  33. package/dist/space/asteroid-ids.js +2 -2
  34. package/dist/space/bodies.js +1 -1
  35. package/dist/space/element.d.ts +3 -3
  36. package/dist/space/element.js +4 -4
  37. package/dist/space/frame.d.ts +1 -1
  38. package/dist/space/regions.d.ts +1 -1
  39. package/dist/space/scene.d.ts +2 -2
  40. package/dist/space/scene.js +3 -2
  41. package/dist/stops.js +3 -1
  42. package/dist/textures/ariel-512.webp +0 -0
  43. package/dist/textures/arrokoth-craft-512.webp +0 -0
  44. package/dist/textures/bennu-craft-512.webp +0 -0
  45. package/dist/textures/callisto-1024.webp +0 -0
  46. package/dist/textures/callisto-512.webp +0 -0
  47. package/dist/textures/charon-1024.webp +0 -0
  48. package/dist/textures/charon-512.webp +0 -0
  49. package/dist/textures/eros-craft-512.webp +0 -0
  50. package/dist/textures/ganymede-1024.webp +0 -0
  51. package/dist/textures/ganymede-512.webp +0 -0
  52. package/dist/textures/io-1024.webp +0 -0
  53. package/dist/textures/io-512.webp +0 -0
  54. package/dist/textures/pluto-1024.webp +0 -0
  55. package/dist/textures/pluto-512.webp +0 -0
  56. package/dist/textures/triton-1024.webp +0 -0
  57. package/dist/textures/triton-512.webp +0 -0
  58. package/dist/version.d.ts +1 -1
  59. package/dist/version.js +1 -1
  60. package/package.json +1 -1
@@ -3,6 +3,7 @@ import { silhouette } from "../pose.js";
3
3
  import { cross } from "../vec.js";
4
4
  import { BALL_FRAGMENT, bodyFragment, GLOW_FRAGMENT, GLOW_VERTEX, PAINTED_SURFACE, PAINTED_SURFACE_WINDOWED, RING_FRAGMENT_DETAIL, RING_VERTEX, STAR_GLOW_FRAGMENT, VERTEX } from "./glsl.js";
5
5
  import { atmosphereTint, detailOf, lookOf } from "./look.js";
6
+ import { craftGeometry, craftMaterial, craftPicture } from "./craft.js";
6
7
  import { shapeGeometry } from "./shape.js";
7
8
  import { createDetail } from "./detail.js";
8
9
  import { fallbackLook } from "./fallback.js";
@@ -79,13 +80,26 @@ export function createBodyItem(options) {
79
80
  const wantPainted = (options.look === "painted" || look.mapped === true) && look.painted !== undefined;
80
81
  // a moon with a published shape model is the globe moved to its radii (its table is a chunk of its own, waited for here), and then needs no stretching to an ellipsoid
81
82
  const shapeTable = look.shape === undefined ? undefined : await look.shape().catch(() => undefined);
83
+ const craft = look.craft === undefined ? undefined : await look.craft().catch(() => undefined);
82
84
  // a big picture gets a globe of 192 by 96 steps (as the unshaped sphere has), a tile or a card one of 96 by 48: a page can hold a dozen moons, and the arrays of a globe stay in the page.
83
85
  // an estimated rock is coarser: 48 by 24 on a large picture, 24 by 12 on a card, 12 by 6 when it is small, so a page can hold every moon of Jupiter
84
86
  const grid = options.coarse === true
85
87
  ? (Math.min(width, height) >= 280 ? { lon: 48, lat: 24 } : Math.min(width, height) >= 140 ? { lon: 24, lat: 12 } : { lon: 12, lat: 6 })
86
88
  : (Math.min(width, height) >= 300 ? { lon: 192, lat: 96 } : { lon: 96, lat: 48 });
87
- const geometry = shapeTable === undefined ? assets.acquire("wk:sphere", () => new T.SphereGeometry(1, 192, 96), (g) => g.dispose()) : assets.acquire(`wk:shape:${held}:${grid.lon}`, () => shapeGeometry(T, shapeTable, facts.radiusKm, grid), (g) => g.dispose());
88
- const shader = assets.acquire(`wk:body:${held}:r`, () => makeBodyMaterial(T, look, false), (m) => m.dispose());
89
+ const geometry = craft !== undefined
90
+ ? assets.acquire(`wk:craft:${held}`, () => craftGeometry(T, craft), (g) => g.dispose())
91
+ : shapeTable === undefined ? assets.acquire("wk:sphere", () => new T.SphereGeometry(1, 192, 96), (g) => g.dispose()) : assets.acquire(`wk:shape:${held}:${grid.lon}`, () => shapeGeometry(T, shapeTable, facts.radiusKm, grid), (g) => g.dispose());
92
+ const shader = craft !== undefined
93
+ ? assets.acquire(`wk:body:${held}:craft`, () => craftMaterial(T, look.ambient ?? 0.08), (m) => m.dispose())
94
+ : assets.acquire(`wk:body:${held}:r`, () => makeBodyMaterial(T, look, false), (m) => m.dispose());
95
+ if (craft !== undefined) {
96
+ const picture = await loadImage(T, `${options.textureBase()}${craft.map}`).catch(() => undefined);
97
+ if (picture !== undefined) {
98
+ picture.colorSpace = T.NoColorSpace;
99
+ craftPicture(picture);
100
+ shader.uniforms.uMap.value = assets.acquire(`wk:craftmap:${held}`, () => picture, (t) => t.dispose());
101
+ }
102
+ }
89
103
  const paintedMaterial = wantPainted ? assets.acquire(`wk:body:${held}:p`, () => makeBodyMaterial(T, look, true), (m) => m.dispose()) : undefined;
90
104
  const materials = paintedMaterial === undefined ? [shader] : [shader, paintedMaterial];
91
105
  const baseWrap = look.wrap ?? (look.atmosphere === undefined ? 0.04 : 0.3);
@@ -285,10 +299,11 @@ export function createBodyItem(options) {
285
299
  const orient = (state) => {
286
300
  const { pole, meridian } = state.pose;
287
301
  const east = cross(pole, meridian);
288
- const ax = shapeTable === undefined ? facts.axesKm : undefined;
302
+ const measured = shapeTable !== undefined || craft !== undefined;
303
+ const ax = measured ? undefined : facts.axesKm;
289
304
  const mean = facts.radiusKm;
290
305
  const scaleX = ax ? ax[1] / mean : 1;
291
- const scaleY = ax ? ax[2] / mean : shapeTable === undefined ? 1 - facts.flattening : 1;
306
+ const scaleY = ax ? ax[2] / mean : measured ? 1 : 1 - facts.flattening;
292
307
  const scaleZ = ax ? ax[0] / mean : 1;
293
308
  setBasis(mesh, east, pole, meridian, scaleX, scaleY, scaleZ);
294
309
  if (cut !== undefined)
@@ -0,0 +1,30 @@
1
+ import type * as THREE from "three";
2
+ /**
3
+ * A published mesh, packed so the file stays small: positions, normals and texture coordinates as base64 little-endian floats, and the triangle indices as base64 unsigned shorts.
4
+ * Positions are in units of the body's mean radius, in the globe's frame.
5
+ */
6
+ export interface CraftMesh {
7
+ /** The picture's file name, in the texture folder. */
8
+ map: string;
9
+ vertices: number;
10
+ positions: string;
11
+ normals: string;
12
+ uvs: string;
13
+ indices: string;
14
+ }
15
+ /** The mesh's arrays, from the packed text. */
16
+ export declare function craftArrays(mesh: CraftMesh): {
17
+ positions: Float32Array;
18
+ normals: Float32Array;
19
+ uvs: Float32Array;
20
+ indices: Uint16Array;
21
+ };
22
+ /** The globe's geometry replaced by the mesh. */
23
+ export declare function craftGeometry(T: Pick<typeof THREE, "BufferGeometry" | "BufferAttribute">, mesh: CraftMesh): THREE.BufferGeometry;
24
+ /** The model's picture uses its own coordinates, with v upward. A texture loader flips a picture, so this puts it back. */
25
+ export declare function craftPicture(texture: {
26
+ flipY: boolean;
27
+ needsUpdate: boolean;
28
+ }): void;
29
+ /** The picture lit by the same sun direction as every other body. The extra uniforms are the ones the body page and the painter write on every material. */
30
+ export declare function craftMaterial(T: Pick<typeof THREE, "ShaderMaterial" | "Vector3">, ambient: number): THREE.ShaderMaterial;
@@ -0,0 +1,63 @@
1
+ const bytes = (text) => Uint8Array.from(atob(text), (c) => c.charCodeAt(0));
2
+ /** The mesh's arrays, from the packed text. */
3
+ export function craftArrays(mesh) {
4
+ const positions = new Float32Array(bytes(mesh.positions).buffer);
5
+ const normals = new Float32Array(bytes(mesh.normals).buffer);
6
+ const uvs = new Float32Array(bytes(mesh.uvs).buffer);
7
+ const indices = new Uint16Array(bytes(mesh.indices).buffer);
8
+ if (positions.length !== mesh.vertices * 3 || normals.length !== mesh.vertices * 3 || uvs.length !== mesh.vertices * 2)
9
+ throw new RangeError("craft mesh arrays do not match its vertex count");
10
+ return { positions, normals, uvs, indices };
11
+ }
12
+ /** The globe's geometry replaced by the mesh. */
13
+ export function craftGeometry(T, mesh) {
14
+ const { positions, normals, uvs, indices } = craftArrays(mesh);
15
+ const geometry = new T.BufferGeometry();
16
+ geometry.setAttribute("position", new T.BufferAttribute(positions, 3));
17
+ geometry.setAttribute("normal", new T.BufferAttribute(normals, 3));
18
+ geometry.setAttribute("uv", new T.BufferAttribute(uvs, 2));
19
+ geometry.setIndex(new T.BufferAttribute(indices, 1));
20
+ return geometry;
21
+ }
22
+ /** The model's picture uses its own coordinates, with v upward. A texture loader flips a picture, so this puts it back. */
23
+ export function craftPicture(texture) {
24
+ texture.flipY = false;
25
+ texture.needsUpdate = true;
26
+ }
27
+ /** The picture lit by the same sun direction as every other body. The extra uniforms are the ones the body page and the painter write on every material. */
28
+ export function craftMaterial(T, ambient) {
29
+ return new T.ShaderMaterial({
30
+ side: 2,
31
+ vertexShader: /* glsl */ `
32
+ varying vec2 vUv;
33
+ varying vec3 vN;
34
+ void main() {
35
+ vUv = uv;
36
+ vN = normalize(normalMatrix * normal);
37
+ gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.0);
38
+ }`,
39
+ fragmentShader: /* glsl */ `
40
+ precision highp float;
41
+ uniform vec3 uLight;
42
+ uniform float uAmbient;
43
+ uniform sampler2D uMap;
44
+ varying vec2 vUv;
45
+ varying vec3 vN;
46
+ void main() {
47
+ float shade = max(0.0, dot(normalize(vN), normalize(uLight)));
48
+ vec3 colour = texture2D(uMap, vUv).rgb;
49
+ gl_FragColor = vec4(colour * (shade * (1.0 - uAmbient) + uAmbient), 1.0);
50
+ }`,
51
+ uniforms: {
52
+ uMap: { value: null },
53
+ uLight: { value: new T.Vector3(1, 0, 0) },
54
+ uAmbient: { value: ambient },
55
+ uWrap: { value: 0 },
56
+ uRimBase: { value: 0 },
57
+ uScale: { value: 1 },
58
+ uRingN: { value: new T.Vector3(0, 1, 0) },
59
+ uOccN: { value: 0 },
60
+ uOcc: { value: new Float32Array(24) },
61
+ },
62
+ });
63
+ }
@@ -1,4 +1,5 @@
1
1
  import type { BodyId } from "../facts.ts";
2
+ import type { CraftMesh } from "./craft.ts";
2
3
  import type { ShapeTable } from "./shape.ts";
3
4
  export { shapeRadii, type ShapeTable } from "./shape.ts";
4
5
  /**
@@ -106,6 +107,10 @@ export interface BodyLook {
106
107
  * ellipsoid of `axesKm`. Until it arrives the ellipsoid is drawn.
107
108
  */
108
109
  shape?: () => Promise<ShapeTable>;
110
+ /**
111
+ * A body drawn as a published mesh with that mesh's own picture on its faces (a chunk of its own). Not a map wrapped on a globe. Until it arrives, the body's shader is drawn.
112
+ */
113
+ craft?: () => Promise<CraftMesh>;
109
114
  /**
110
115
  * An estimated rock shares one surface shader. These uniforms are that moon's own: a seed so the craters differ, and the dark and light colours of its albedo class.
111
116
  * Only a look whose `surface` reads `uRockSeed`, `uRockDark` and `uRockLight` sets this.
@@ -10,6 +10,7 @@ import { bodyFragment, GLOW_FRAGMENT, GLOW_VERTEX, PAINTED_SURFACE, PAINTED_SURF
10
10
  import { fallbackLook } from "./fallback.js";
11
11
  import { createDetail } from "./detail.js";
12
12
  import { atmosphereTint, detailOf, lookOf } from "./look.js";
13
+ import { craftGeometry, craftMaterial, craftPicture } from "./craft.js";
13
14
  import { shapeGeometry } from "./shape.js";
14
15
  import { seenRegion } from "./tiles.js";
15
16
  import { moonOffset, orientation } from "./orient.js";
@@ -187,6 +188,9 @@ function paint(T, id, context, bases, hold) {
187
188
  let ringOuter = 2;
188
189
  const table = look.emissive === true ? null : ringStrip(facts, 1024);
189
190
  let gone = false;
191
+ // the mesh picture of a body drawn from a mission's model: it is this painting's own, and it is given back with the painting
192
+ let craftMap;
193
+ let craftMat;
190
194
  if (table !== null) {
191
195
  ringInner = table.inner;
192
196
  ringOuter = table.outer;
@@ -404,6 +408,37 @@ function paint(T, id, context, bases, hold) {
404
408
  redraw();
405
409
  }, () => undefined);
406
410
  }
411
+ // a body whose picture is the mesh a mission published: the faces carry that model's own picture, not a map wrapped on a globe
412
+ if (look.craft !== undefined) {
413
+ look.craft().then((table) => {
414
+ if (gone)
415
+ return;
416
+ const shaped = acquire(T, `craft:${id}`, () => craftGeometry(T, table));
417
+ releases.push(shaped.release);
418
+ const material = acquire(T, `craftmat:${id}`, () => craftMaterial(T, look.ambient ?? 0.08));
419
+ releases.push(material.release);
420
+ materials.push(material.value);
421
+ craftMat = material.value;
422
+ mesh.geometry = shaped.value;
423
+ mesh.material = material.value;
424
+ scaleX = 1;
425
+ scaleY = 1;
426
+ scaleZ = 1;
427
+ void trackPicture(loadImage(T, `${bases.near}${table.map}`)).then((picture) => {
428
+ if (gone) {
429
+ picture.dispose();
430
+ return;
431
+ }
432
+ // the painted maps do this too: a colour conversion would leave a second texture the painting does not own
433
+ picture.colorSpace = T.NoColorSpace;
434
+ craftPicture(picture);
435
+ craftMap = picture;
436
+ material.value.uniforms.uMap.value = picture;
437
+ redraw();
438
+ }, () => undefined);
439
+ redraw();
440
+ }, () => undefined);
441
+ }
407
442
  const light = new T.Vector3();
408
443
  const poleVec = new T.Vector3();
409
444
  // the name on the globe: a child of the mesh, so it turns with the body; made when asked, drawn once its font is in
@@ -526,6 +561,12 @@ function paint(T, id, context, bases, hold) {
526
561
  small?.dispose();
527
562
  sharp?.dispose();
528
563
  ringTexture?.dispose();
564
+ const mat = craftMat;
565
+ const map = craftMap;
566
+ if (mat !== undefined && mat.uniforms.uMap !== undefined && mat.uniforms.uMap.value === map)
567
+ mat.uniforms.uMap.value = null;
568
+ map?.dispose();
569
+ craftMap = undefined;
529
570
  for (const d of disposables)
530
571
  d.dispose();
531
572
  for (const r of releases)
@@ -11,7 +11,7 @@ import { type BodyMapSource } from "../door/map.ts";
11
11
  * console.log(TEXTURE_BASE);
12
12
  * ```
13
13
  */
14
- export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.75.1/dist/textures/";
14
+ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.76.0/dist/textures/";
15
15
  /**
16
16
  * Where the sharpest surface pictures are: the files of this exact version in the repository, on jsDelivr's GitHub address. The npm package holds only the two smaller widths, so a page that
17
17
  * never zooms in never fetches them. Set `texture-far-base` on an element to serve them yourself.
@@ -23,7 +23,7 @@ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdot
23
23
  * console.log(TEXTURE_FAR_BASE);
24
24
  * ```
25
25
  */
26
- export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.75.1/textures/";
26
+ export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.76.0/textures/";
27
27
  /**
28
28
  * Where the finer map tiles are by default: the demo site's `tiles/` folder (GitHub Pages sends `access-control-allow-origin: *`). The tiles are made by `scripts/make-body-tiles.py` and are in no package and no repository:
29
29
  * a page that serves its own gives the folder in the `tiles` attribute, and `tiles="off"` turns them off. A page that sets `texture-base` (it serves its own pictures) has none unless it says where they are.
@@ -10,7 +10,7 @@ import type { BodyId } from "./facts.ts";
10
10
  * console.log(basis);
11
11
  * ```
12
12
  */
13
- export type ShapeBasis = "shape-and-map" | "shape";
13
+ export type ShapeBasis = "shape-and-map" | "shape" | "craft";
14
14
  /**
15
15
  * How the picture of a body rests on measurement, or `undefined` for a body drawn from its facts alone (a sphere or an ellipsoid).
16
16
  *
@@ -1,12 +1,14 @@
1
1
  const NOTE = {
2
2
  shape: { en: "shape measured; colour from its measured brightness", ja: "形は測定したもの。色は測定した明るさから" },
3
3
  "shape-and-map": { en: "shape and surface measured by spacecraft", ja: "形も表面も探査機が測定したもの" },
4
+ craft: { en: "shape measured by spacecraft; colour from its photograph, not a map", ja: "形は探査機が測定したもの。色は写真からで、地面の地図ではない" },
4
5
  };
5
6
  // The moons drawn with a measured shape (their looks carry `shape`), and whether a mission map is drawn on them too. test/shape.test.ts holds this table to the looks.
6
7
  const BASIS = {
7
8
  phobos: "shape-and-map", deimos: "shape-and-map", phoebe: "shape-and-map",
8
9
  nix: "shape", hydra: "shape", proteus: "shape", larissa: "shape", amalthea: "shape", thebe: "shape", hyperion: "shape", janus: "shape", epimetheus: "shape", prometheus: "shape", pandora: "shape",
9
10
  atlas: "shape", pan: "shape", daphnis: "shape", helene: "shape", telesto: "shape", calypso: "shape",
11
+ bennu: "craft", eros: "craft", arrokoth: "craft",
10
12
  };
11
13
  /**
12
14
  * How the picture of a body rests on measurement, or `undefined` for a body drawn from its facts alone (a sphere or an ellipsoid).
@@ -1,4 +1,4 @@
1
- /** The ids of the 104 bodies of `/asteroids`, in table order. */
1
+ /** The ids of the 101 bodies of `/asteroids`, in table order. Eros, Bennu and Arrokoth are bodies of the package, so they are not in this list. */
2
2
  export declare const ASTEROID_IDS: readonly string[];
3
3
  /** The prefix of an asteroid's key in the view: two asteroids (`europa`, `dione`) have the id of a moon of the package, so the view keeps its own names for them apart by it. A page never sees it: events, `sight()` and `riding` say the plain id. */
4
4
  export declare const ASTEROID_PREFIX = "asteroid:";
@@ -1,10 +1,10 @@
1
1
  // The ids of the asteroids of /asteroids, in table order: what the space view needs to tell an asteroid from a body (and to say so when the option `asteroids` is off) without loading the table, which is a chunk of its own
2
2
  // that the view reaches only when the option is turned on. A test holds this list to the table. And how the view keys the asteroids among its own names (labels, places, the sight): two of them, `europa` and `dione`, have the id of a moon.
3
- /** The ids of the 104 bodies of `/asteroids`, in table order. */
3
+ /** The ids of the 101 bodies of `/asteroids`, in table order. Eros, Bennu and Arrokoth are bodies of the package, so they are not in this list. */
4
4
  export const ASTEROID_IDS = [
5
5
  "hygiea", "interamnia", "europa", "davida", "euphrosyne", "patientia", "sylvia", "juno", "cybele", "thisbe", "eunomia", "psyche", "bamberga", "doris", "ursula",
6
6
  "camilla", "hermione", "lomia", "dione", "daphne", "aurora", "egeria", "eugenia", "fortuna", "iris", "chicago", "themis", "gaspra", "ida", "mathilde", "lutetia",
7
- "steins", "annefrank", "braille", "dinkinesh", "donaldjohanson", "masursky", "apl", "eros", "itokawa", "ryugu", "bennu", "toutatis", "didymos", "arrokoth",
7
+ "steins", "annefrank", "braille", "dinkinesh", "donaldjohanson", "masursky", "apl", "itokawa", "ryugu", "toutatis", "didymos",
8
8
  "apophis", "torifune", "1998-ky26", "2024-yr4", "phaethon", "icarus", "geographos", "toro", "cruithne", "kamooalewa", "1950-da", "florence", "ganymed", "apollo",
9
9
  "aten", "amor", "atira", "hermes", "wilson-harrington", "duende", "nereus", "golevka", "adonis", "eurybates", "polymele", "leucus", "orus", "patroclus", "hektor",
10
10
  "achilles", "agamemnon", "nestor", "priamus", "diomedes", "odysseus", "ajax", "menelaus", "aneas", "anchises", "chariklo", "nessus", "asbolus", "hylonome",
@@ -1,7 +1,7 @@
1
1
  // Which bodies the space view can put at the middle of its view, and in what order a reader hops from one to the next. Pure: names in, names out.
2
2
  import { BODIES, MOONS_OF } from "../facts.js";
3
3
  /** Planets, dwarf planets and minor bodies, ordered by the size of their orbits (the semi-major axis), each followed by its moons nearest first. */
4
- const SUN_ORDER = ["mercury", "venus", "earth", "mars", "vesta", "ceres", "pallas", "jupiter", "saturn", "chiron", "halley", "uranus", "pholus", "neptune", "pluto", "orcus", "haumea", "quaoar", "makemake", "gonggong", "eris", "sedna"];
4
+ const SUN_ORDER = ["mercury", "venus", "earth", "bennu", "eros", "mars", "vesta", "ceres", "pallas", "jupiter", "saturn", "chiron", "halley", "uranus", "pholus", "neptune", "pluto", "orcus", "haumea", "quaoar", "arrokoth", "makemake", "gonggong", "eris", "sedna"];
5
5
  /**
6
6
  * Every body the package knows, in the order a hopper goes: the Sun, then each planet, dwarf planet and minor body from the Sun outwards, each followed by its moons nearest first (Mercury, Venus, the Earth and the
7
7
  * Moon, Mars, Phobos and Deimos, Vesta, Ceres, Pallas, Jupiter and its four large moons, and on to Sedna).
@@ -96,7 +96,7 @@ export interface BodyHover extends BodyInfo {
96
96
  * ```
97
97
  */
98
98
  export interface BodySight extends Sight {
99
- /** A body's id, a craft's own id (`voyager1`, `roadster`) when `kind` is `spacecraft`, or an orbiter's id (`mro`, the one `orbiter` takes) when `kind` is `orbiter`, or an asteroid's id from `/asteroids` (`eros`, with the option `asteroids` on) when `kind` is `small-body`. */
99
+ /** A body's id, a craft's own id (`voyager1`, `roadster`) when `kind` is `spacecraft`, or an orbiter's id (`mro`, the one `orbiter` takes) when `kind` is `orbiter`, or an asteroid's id from `/asteroids` (`itokawa`, with the option `asteroids` on) when `kind` is `small-body`. */
100
100
  id: string;
101
101
  kind: SpaceKind | "spacecraft" | "orbiter" | "small-body";
102
102
  host?: BodyId;
@@ -635,7 +635,7 @@ export declare class WakuseiSpace extends HTMLElement {
635
635
  * tells the page where it went and where the next and previous hops lead. A name in any case, in English or Japanese, works.
636
636
  *
637
637
  *
638
- * With the option `asteroids` on it takes an asteroid's id from `/asteroids` too (`"eros"`; `"asteroid:europa"` and `"asteroid:dione"` are the forms that mean the asteroid, for `europa` and `dione` are moons first): the view
638
+ * With the option `asteroids` on it takes an asteroid's id from `/asteroids` too (`"itokawa"`; `"asteroid:europa"` and `"asteroid:dione"` are the forms that mean the asteroid, for `europa` and `dione` are moons first): the view
639
639
  * is set to the true scale (the squeezed scale cannot place a camera among the bodies, and going back to it ends the move), and the camera goes to a distance of a few times the asteroid's size (at least 200 km) looking at it
640
640
  * and keeps it there as the clock runs: `riding` says which asteroid (`riding.target.id`), `wakusei-ride` is sent as for any ride and `wakusei-hop` is not (an asteroid is no stop of the hopper), and a `goTo` of a body or `ride(null)` ends it.
641
641
  * Asked before the records are in, the move is made when they are, unless another move is asked for first.
@@ -651,7 +651,7 @@ export declare class WakuseiSpace extends HTMLElement {
651
651
  *
652
652
  * const space = document.querySelector<WakuseiSpace>("wakusei-space")!;
653
653
  * space.asteroids = true;
654
- * space.goTo("eros");
654
+ * space.goTo("itokawa");
655
655
  * console.log(space.riding?.target);
656
656
  * ```
657
657
  */
@@ -1182,7 +1182,7 @@ export class WakuseiSpace extends HTMLElement {
1182
1182
  return id !== undefined && this.#model.asteroids && this.#model.asteroidSet !== null && this.#model.asteroidSet.ids.includes(id);
1183
1183
  }
1184
1184
  /**
1185
- * The asteroid a `goTo` or `ride` names, as its plain id, or `undefined` where the name is none and the call goes on as it did: `eros`, or `asteroid:eros` (the form that always means the asteroid; `europa` and `dione`
1185
+ * The asteroid a `goTo` or `ride` names, as its plain id, or `undefined` where the name is none and the call goes on as it did: `itokawa`, or `asteroid:itokawa` (the form that always means the asteroid; `europa` and `dione`
1186
1186
  * are moons first). Throws a `RangeError` when it is one and the option `asteroids` is off, and, with the option on, for a name that is neither a body of the view nor an asteroid.
1187
1187
  */
1188
1188
  #asteroidNamed(target, call) {
@@ -1193,7 +1193,7 @@ export class WakuseiSpace extends HTMLElement {
1193
1193
  return undefined;
1194
1194
  if (!ASTEROID_IDS.includes(id)) {
1195
1195
  if (prefixed || this.#model.asteroids)
1196
- throw new RangeError(`${call}(${JSON.stringify(target)}): not a body of the view and not an asteroid of /asteroids (an asteroid's id is one of asteroidList(), such as "eros")`);
1196
+ throw new RangeError(`${call}(${JSON.stringify(target)}): not a body of the view and not an asteroid of /asteroids (an asteroid's id is one of asteroidList(), such as "itokawa")`);
1197
1197
  return undefined;
1198
1198
  }
1199
1199
  if (!this.#model.asteroids)
@@ -1762,7 +1762,7 @@ export class WakuseiSpace extends HTMLElement {
1762
1762
  * tells the page where it went and where the next and previous hops lead. A name in any case, in English or Japanese, works.
1763
1763
  *
1764
1764
  *
1765
- * With the option `asteroids` on it takes an asteroid's id from `/asteroids` too (`"eros"`; `"asteroid:europa"` and `"asteroid:dione"` are the forms that mean the asteroid, for `europa` and `dione` are moons first): the view
1765
+ * With the option `asteroids` on it takes an asteroid's id from `/asteroids` too (`"itokawa"`; `"asteroid:europa"` and `"asteroid:dione"` are the forms that mean the asteroid, for `europa` and `dione` are moons first): the view
1766
1766
  * is set to the true scale (the squeezed scale cannot place a camera among the bodies, and going back to it ends the move), and the camera goes to a distance of a few times the asteroid's size (at least 200 km) looking at it
1767
1767
  * and keeps it there as the clock runs: `riding` says which asteroid (`riding.target.id`), `wakusei-ride` is sent as for any ride and `wakusei-hop` is not (an asteroid is no stop of the hopper), and a `goTo` of a body or `ride(null)` ends it.
1768
1768
  * Asked before the records are in, the move is made when they are, unless another move is asked for first.
@@ -1778,7 +1778,7 @@ export class WakuseiSpace extends HTMLElement {
1778
1778
  *
1779
1779
  * const space = document.querySelector<WakuseiSpace>("wakusei-space")!;
1780
1780
  * space.asteroids = true;
1781
- * space.goTo("eros");
1781
+ * space.goTo("itokawa");
1782
1782
  * console.log(space.riding?.target);
1783
1783
  * ```
1784
1784
  */
@@ -78,7 +78,7 @@ export type SpaceDwarf = DwarfId;
78
78
  * console.log(SPACE_MINORS.join(", "));
79
79
  * ```
80
80
  */
81
- export declare const SPACE_MINORS: readonly ["vesta", "pallas", "chiron", "pholus", "halley"];
81
+ export declare const SPACE_MINORS: readonly ["bennu", "eros", "vesta", "pallas", "chiron", "pholus", "halley", "arrokoth"];
82
82
  /**
83
83
  * One of the minor bodies in `SPACE_MINORS`.
84
84
  *
@@ -47,7 +47,7 @@ export declare const SUN_REGIONS: readonly [{
47
47
  readonly en: "Whole solar system";
48
48
  readonly ja: "太陽系全体";
49
49
  };
50
- readonly bodies: readonly ["earth", "mercury", "venus", "mars", "jupiter", "saturn", "uranus", "neptune", "pluto", "ceres", "orcus", "haumea", "quaoar", "makemake", "gonggong", "eris", "sedna", "vesta", "pallas", "chiron", "pholus", "halley"];
50
+ readonly bodies: readonly ["earth", "mercury", "venus", "mars", "jupiter", "saturn", "uranus", "neptune", "pluto", "ceres", "orcus", "haumea", "quaoar", "makemake", "gonggong", "eris", "sedna", "bennu", "eros", "vesta", "pallas", "chiron", "pholus", "halley", "arrokoth"];
51
51
  }];
52
52
  /**
53
53
  * The `id` of one of the stages in `SUN_REGIONS`.
@@ -28,7 +28,7 @@ export declare const FIT_DISTANCE = 4.1;
28
28
  /** How much of the picture's shorter side a body's disc is framed across at zoom 1, in the body's radii: 1, and more for a ringed body. */
29
29
  export declare const framedOf: (id: string) => number;
30
30
  /**
31
- * 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.
31
+ * The twenty-seven 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 eight minor bodies (Bennu, Eros, Vesta, Pallas, Chiron, Pholus, Halley and Arrokoth). The moons of the planets and of the dwarf planets are placed round their hosts.
32
32
  *
33
33
  * @example
34
34
  * ```ts no-run
@@ -37,7 +37,7 @@ export declare const framedOf: (id: string) => number;
37
37
  * console.log(SPACE_BODIES.join(", "));
38
38
  * ```
39
39
  */
40
- export declare const SPACE_BODIES: readonly ["earth", "sun", "moon", "mercury", "venus", "mars", "jupiter", "saturn", "uranus", "neptune", "pluto", "ceres", "orcus", "haumea", "quaoar", "makemake", "gonggong", "eris", "sedna", "vesta", "pallas", "chiron", "pholus", "halley"];
40
+ export declare const SPACE_BODIES: readonly ["earth", "sun", "moon", "mercury", "venus", "mars", "jupiter", "saturn", "uranus", "neptune", "pluto", "ceres", "orcus", "haumea", "quaoar", "makemake", "gonggong", "eris", "sedna", "bennu", "eros", "vesta", "pallas", "chiron", "pholus", "halley", "arrokoth"];
41
41
  /**
42
42
  * One of the bodies in `SPACE_BODIES`, by the package's usual lower-case name.
43
43
  *
@@ -77,7 +77,7 @@ const ROADSTER_PX = 3;
77
77
  const ROADSTER_ORBIT_MS = 560 * 86_400_000;
78
78
  const ROADSTER_ORBIT_KEEP_MS = 30 * 86_400_000;
79
79
  /**
80
- * 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.
80
+ * The twenty-seven 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 eight minor bodies (Bennu, Eros, Vesta, Pallas, Chiron, Pholus, Halley and Arrokoth). The moons of the planets and of the dwarf planets are placed round their hosts.
81
81
  *
82
82
  * @example
83
83
  * ```ts no-run
@@ -721,7 +721,8 @@ export function createSpaceItem(model, deps) {
721
721
  camera.position.set(target.x + aim[0] * distance, target.y + aim[1] * distance, target.z + aim[2] * distance);
722
722
  camera.up.set(upNow[0], upNow[1], upNow[2]);
723
723
  camera.lookAt(target);
724
- camera.near = Math.max(0.0005, distance * 0.02 - focusRadius * 0.5, focusRadius * 0.01);
724
+ // the floor is a tenth of the distance when the camera is nearer than 0.005 (about 32 km): Bennu's middle is 1 km from the eye, inside the old floor of 0.0005, and a point nearer than the near plane is not drawn or placed
725
+ camera.near = Math.max(Math.min(0.0005, distance * 0.1), distance * 0.02 - focusRadius * 0.5, focusRadius * 0.01);
725
726
  camera.far = Math.max(2000, distance * 4 + (mode === "true" ? 40 * 23_481 : 400));
726
727
  }
727
728
  // a move to a new target: the camera travels from where the last draw left it to the view just set up, along the path `travelPose` gives (the body left kept in the picture through the
package/dist/stops.js CHANGED
@@ -4,7 +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
+ // Bennu (4.8904e-9), Eros (4.463e-4), Vesta (17.2882844) and Pallas (13.63): the GM of JPL's Small-Body Database (https://ssd-api.jpl.nasa.gov/sbdb.api; Bennu and Eros read 2026-11-23, the others 2026-11-10), from Chesley et al. 2020, Yeomans et al. 2000, Park et al. 2025 and Vernazza et al. 2021.
8
8
  // A moon's escape speed is sqrt(2 GM / radius) from this package's radius. Nereid, and the dwarf planets and moons
9
9
  // whose pages do not print a mass, are left empty.
10
10
  import { heliocentric, meanSunAu, moonVector } from "./ephemeris.js";
@@ -31,6 +31,8 @@ const GM = {
31
31
  eris: mass(16_600e18),
32
32
  makemake: mass(3_100e18),
33
33
  haumea: mass(4_006e18),
34
+ bennu: 4.8904e-9,
35
+ eros: 4.463e-4,
34
36
  vesta: 17.2882844,
35
37
  pallas: 13.63,
36
38
  moon: 4_902.8,
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.75.1";
1
+ export declare const VERSION = "0.76.0";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // The published package version. Snippets and texture addresses name it. test/version.test.ts keeps it equal to package.json.
2
- export const VERSION = "0.75.1";
2
+ export const VERSION = "0.76.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/wakusei-planets",
3
- "version": "0.75.1",
3
+ "version": "0.76.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",