@johnmorrisdotca/wakusei-planets 0.74.0 → 0.74.2

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 CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.74.2] - 2026-11-21
6
+
7
+ - **`<wakusei-surface>` `position` follows the view through a glide** (MODULES-1487). While driving or watching the landing `position.up` already followed the view; during the move from the watched descent to the standing view, the rover or the other camera (the `glide`), `position` still gave the standing place at 1.7 m. It now gives the eyes on the way: east, north and the height over the ground under them, ending at the standing place and 1.7 m. Standing, driving and watching are unchanged.
8
+ - **Ceres's size and pole are credited to the papers, not to a Wikipedia article** (MODULES-1484). `NOTICE.md` named Ermakov et al. 2017 "as listed in Wikipedia's Ceres article"; it now names the paper itself (authors, year, journal, DOI) for the 966.2 x 962.0 x 891.8 km size and JPL SBDB's value from Park et al. 2016 for the pole. No number changed.
9
+
10
+ ## [0.74.1] - 2026-11-20
11
+
12
+ - **Saturn's ring picture lets the strip's program go.** The painted ring kept the strip's graphics program, and the vertex array that went with it, after the picture arrived. The space view's long run still held them on every other walk (148 objects against a start of 146) until the body was made again.
13
+ - **The standing page lands at every site and drives that site's rover** (MODULES-1482). A row of the seven sites chooses where Land goes. Drive uses NASA's Perseverance at Jezero, NASA's Curiosity at Gale and a lunar rover model based on the Deutsches Museum replica at Apollo 15, 16 and 17. Chang'e 3 and Chang'e 4 drive this package's shapes: NASA's catalogue has no Yutu or Yutu-2 model, and the page says so. Watching the descent stays on Apollo 17. The six newer sites still stand on a flat stand-in. The page's name is Standing on the surface. A driven model's shadow follows the points of its meshes. On the far side the Earth is below the horizon, and it is not drawn. The ground line says the ground is a flat stand-in until height data is added, and that nothing on it is measured. On a phone that line sits under the picture in the felt's own ink, and the site label sits above the row.
14
+ - **The moons of Jupiter, as circles** (MODULES-1731). `chart.html` draws every moon the catalogue gives Jupiter. A larger circle is a larger moon and a higher circle is farther from Jupiter. The circles are drawn larger than true so a small moon can be seen. Colour is the family. A size worked out from the brightness is marked with a star. Each outer group has its own rows, farthest at the top, the gap between the inner moons and those rows is shortened, and neither that spacing nor Jupiter is to scale. Labels stay at least 11 pixels on a phone. The link sits with the other moon pages on the home page, not in the header. English and Japanese.
15
+
5
16
  ## [0.74.0] - 2026-11-20
6
17
 
7
18
  - **Every moon, by group** (MODULES-1723). `groups.html` puts a giant planet on top and every moon of the catalogue below it, in the families `moonFamilies` already uses, numbered in that order. A moon the package draws in full keeps that picture. The rest are the estimated rocks, pulled back so a turned rock stays inside its tile, named with the star those rocks already carry (`Himalia*`), and the page shows that star's one legend line. Jupiter's globe is clipped to a circle. English and Japanese.
package/NOTICE.md CHANGED
@@ -28,7 +28,7 @@ No picture is used by the line and shaded looks: they are drawn from numbers.
28
28
  Ceres, Orcus, Haumea, Quaoar, Makemake, Gonggong, Eris and Sedna (Pluto is with the planets) and the moons Vanth, Hiʻiaka, Namaka and Dysnomia. Values read on 2026-11-03.
29
29
 
30
30
  - **Where they are**: JPL Horizons (https://ssd.jpl.nasa.gov/api/horizons.api), fitted as Chebyshev tables from the solar system's barycentre (`scripts/make-dwarf-data.py`, `src/data/dwarfs.ts`), with the Sun's swing about the barycentre worked out from the planets' masses (IAU 2012 and JPL DE440 mass ratios): Ceres 1900 to 2100, the others 1800 to 2200, each within 0.2 arc-seconds of Horizons. Outside those years, NASA/JPL Small-Body Database osculating elements at JD 2461200.5 (https://ssd.jpl.nasa.gov/api/sbdb.api), run as a plain ellipse (`src/data/dwarf.ts`): good for a few years either side of June 2026.
31
- - **Sizes and spin**: Ceres (966.2 x 962.0 x 891.8 km) and its pole: Ermakov et al. 2017 (as listed in Wikipedia's Ceres article); its rotation: JPL SBDB (9.074170 h). Haumea: Ortiz et al. 2017, Nature 550:219 (semi-axes 1161 x 852 x 513 km), rotation 3.915341 h from Santos-Sanz et al. 2017, A&A 604:A95, pole from Kondratyev & Kornoukhov 2018, MNRAS 478:3159 (RA 282.6, Dec -13.0). Eris: radius 1163 km, Sicardy et al. 2011; it keeps one face to Dysnomia, so its rotation is Dysnomia's orbital period, Szakats et al. 2023, A&A 669:L3. Makemake: radius 715 km, Brown 2013; rotation 22.8266 h, Hromakina et al. 2019. Gonggong: radius 615 km and rotation 22.4 h, Kiss et al. 2019, Icarus. Quaoar: 1241.4 x 1093.0 x 1023.0 km and 17.6788 h, Margoti et al. 2026 and Pereira et al. 2023. Sedna: radius 453 km (Lellouch et al. 2013, TNOs are Cool IX, which allows far more) and 10.273 h, Gaudi et al. 2005. Orcus: radius 455 km, Brown & Butler 2018, rotation 13.188 h (JPL SBDB; 7 to 21 h in the literature). Wikipedia's articles on each body were the finding aid; the papers are the sources.
31
+ - **Sizes and spin**: Ceres (966.2 x 962.0 x 891.8 km, twice the semi-axes 483.1 x 481.0 x 445.9 km of the ellipsoid fitted to the Dawn shape model): A. I. Ermakov, R. R. Fu, J. C. Castillo-Rogez, C. A. Raymond, R. S. Park, F. Preusker, C. T. Russell, D. E. Smith and M. T. Zuber (2017), "Constraints on Ceres' internal structure and evolution from its shape and gravity measured by the Dawn spacecraft", Journal of Geophysical Research: Planets 122(11):2267-2293, doi:10.1002/2017JE005302; its pole (RA 291.42744, Dec 66.76033) is within 0.01 degree of JPL SBDB's 291.421 and 66.758 from R. S. Park et al. (2016), Nature 537:515-517, doi:10.1038/nature18955; its rotation: JPL SBDB (9.074170 h). Haumea: Ortiz et al. 2017, Nature 550:219 (semi-axes 1161 x 852 x 513 km), rotation 3.915341 h from Santos-Sanz et al. 2017, A&A 604:A95, pole from Kondratyev & Kornoukhov 2018, MNRAS 478:3159 (RA 282.6, Dec -13.0). Eris: radius 1163 km, Sicardy et al. 2011; it keeps one face to Dysnomia, so its rotation is Dysnomia's orbital period, Szakats et al. 2023, A&A 669:L3. Makemake: radius 715 km, Brown 2013; rotation 22.8266 h, Hromakina et al. 2019. Gonggong: radius 615 km and rotation 22.4 h, Kiss et al. 2019, Icarus. Quaoar: 1241.4 x 1093.0 x 1023.0 km and 17.6788 h, Margoti et al. 2026 and Pereira et al. 2023. Sedna: radius 453 km (Lellouch et al. 2013, TNOs are Cool IX, which allows far more) and 10.273 h, Gaudi et al. 2005. Orcus: radius 455 km, Brown & Butler 2018, rotation 13.188 h (JPL SBDB; 7 to 21 h in the literature). Wikipedia's articles on each body were the finding aid; the papers are the sources.
32
32
  - **Moons' orbits**: Dysnomia, Holler et al. 2021, Icarus 355:114130, Table 2 (arXiv 2009.13733). Hiʻiaka and Namaka, Ragozzine & Brown 2009, AJ 137:4766, Table 2 (osculating elements of 2008; the two moons pull on each other, so the position years later is rough). Vanth, Brown et al. 2010, AJ 139:2700, Table 2, solution 1 of two mirror solutions. Radii: Dysnomia 308 km (Brown & Butler 2023), Vanth 221 km (Sickafoose et al. 2018, occultation), Hiʻiaka and Namaka from the Haumea article's listed diameters (370 and 150 km). Weywot, Xiangliu and Makemake's moon S/2015 (136472) 1 are left out: no orbit with a published phase.
33
33
  - **Estimated, not measured** (the pictures say so only here): these bodies' poles are not measured, so each is drawn with its spin axis along its orbit's pole (Quaoar, Makemake, Gonggong, Sedna), along Dysnomia's orbit pole (Eris) or along the far end of Vanth's orbit pole, so that it spins forwards (Orcus). Hiʻiaka's and Namaka's spin is unknown and they are drawn still. Dysnomia and Vanth are assumed to keep one face to their planet. Every drawn feature on the line look of a dwarf planet except Ceres's Occator crater and Haumea's long axis is a generic crater, and so is each shaded (realistic) look: only the colour (from the published colour indices and albedos) and the sizes are from numbers. Ceres, Haumea and Dysnomia's shapes are from the sources above. Only Ceres has a painted look.
34
34
 
package/README.md CHANGED
@@ -19,7 +19,7 @@ Wakusei Planets runs in the browser of a phone, a tablet or a computer: nothing
19
19
 
20
20
  <p align="center"><img alt="The demo on a desk: Saturn in the painted look, turning in the big view, with the page's links to the portrait builder, the colouring sheets, the space view, the star page and the size line-up above it, and the choice of body and its moons below" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/main/docs/images/home-desk.webp" width="620"> <img alt="The same page on a phone: the same links in rows, and Saturn in the painted look below them" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/main/docs/images/home-phone.webp" width="200"></p>
21
21
 
22
- <p align="center"><img alt="Every body at one scale, the Earth among them: each small body has a magnified picture joined by a line, and the Sun shows only its edge" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.74.0/docs/images/lineup-desk.png" width="640"></p>
22
+ <p align="center"><img alt="Every body at one scale, the Earth among them: each small body has a magnified picture joined by a line, and the Sun shows only its edge" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.74.2/docs/images/lineup-desk.png" width="640"></p>
23
23
 
24
24
  ## Who it is for
25
25
 
@@ -423,7 +423,7 @@ The tiles of every body share one 48 MB budget, six loads at a time for a source
423
423
 
424
424
  ## The portrait builder
425
425
 
426
- <p align="center"><img alt="The Sun and the planets in an arc, painted, with their names, in the portrait builder" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.74.0/docs/images/portrait-family.png" width="640"></p>
426
+ <p align="center"><img alt="The Sun and the planets in an arc, painted, with their names, in the portrait builder" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.74.2/docs/images/portrait-family.png" width="640"></p>
427
427
 
428
428
  [The portrait builder](https://johnmorrisdotca.github.io/wakusei-planets/portrait.html) puts any bodies in one picture: drag them, size them, turn them, order them front to back, arrange them in a row, an arc, a grid or at true orbit distance (true or readable sizes, a planet's moons round it in orbit order), light them from one direction, and take the code, a PNG or an SVG. The scene is kept in the address, and every body is drawn in one WebGL scene, so the page holds one WebGL context. [The portrait builder](docs/guides/portrait-builder.md) is its guide.
429
429
 
@@ -580,7 +580,7 @@ BODIES.pluto.kind; // "dwarf-planet"
580
580
 
581
581
  If this package helps a paper, a talk or a class, please cite it as software. GitHub's "Cite this repository" button reads [CITATION.cff](CITATION.cff) and gives BibTeX and APA; in plain text:
582
582
 
583
- > Morris, J. (2026). *Wakusei Planets* (version 0.74.0) [Computer software]. https://github.com/johnmorrisdotca/wakusei-planets
583
+ > Morris, J. (2026). *Wakusei Planets* (version 0.74.2) [Computer software]. https://github.com/johnmorrisdotca/wakusei-planets
584
584
 
585
585
  Cite the version you used (`npm ls @johnmorrisdotca/wakusei-planets`), and cite the sources of the numbers you use as well: [NOTICE.md](NOTICE.md) names each one, with the paper or the page it was read from (the IAU working group's report for sizes and poles, VSOP87B, ELP2000-82B, L1.2 and TASS1.7 for positions, and NASA's JPL Horizons for the fits and the spacecraft).
586
586
 
@@ -0,0 +1,46 @@
1
+ export declare const CHART_W = 1000;
2
+ export declare const CHART_H = 1300;
3
+ export interface ChartDot {
4
+ id: string;
5
+ label: string;
6
+ ja: string | null;
7
+ family: {
8
+ en: string;
9
+ ja: string;
10
+ };
11
+ color: string;
12
+ year: number | null;
13
+ estimated: boolean;
14
+ diameterKm: number;
15
+ distanceKm: number | null;
16
+ x: number;
17
+ y: number;
18
+ r: number;
19
+ }
20
+ export interface ChartLegend {
21
+ id: string;
22
+ names: {
23
+ en: string;
24
+ ja: string;
25
+ };
26
+ color: string;
27
+ count: number;
28
+ }
29
+ export interface JupiterChart {
30
+ width: number;
31
+ height: number;
32
+ read: string;
33
+ count: number;
34
+ planet: {
35
+ en: string;
36
+ ja: string;
37
+ x: number;
38
+ y: number;
39
+ r: number;
40
+ color: string;
41
+ };
42
+ legend: ChartLegend[];
43
+ dots: ChartDot[];
44
+ }
45
+ /** Every moon of Jupiter in the catalogue, packed into one picture. A circle's area follows the moon's diameter. Each outer group has its own rows, farthest at the top, and the empty gap between the inner moons and those rows is shortened. */
46
+ export declare function jupiterMoonChart(): JupiterChart;
@@ -0,0 +1,120 @@
1
+ // Jupiter's moons as a chart: one circle each, larger for a larger moon, higher for a moon farther out, coloured by family. No DOM.
2
+ import { BODIES } from "./facts.js";
3
+ import { catalogueMoonsOf, moonFamilies, moonOrbitColor, MOON_CATALOGUE_FETCHED } from "./moon-catalogue.js";
4
+ export const CHART_W = 1000;
5
+ export const CHART_H = 1300;
6
+ const PLANET = { x: 500, y: 1220, r: 34 };
7
+ const INNER_KM = 3_000_000;
8
+ /** Rows that stay inside the width. A row is one distance band, so a group is not piled onto the next. */
9
+ function rowsOf(items) {
10
+ const rows = [];
11
+ let row = [];
12
+ let width = 0;
13
+ for (const item of items) {
14
+ const need = item.r * 2 + 8;
15
+ if (row.length > 0 && width + need > CHART_W - 24) {
16
+ rows.push(row);
17
+ row = [];
18
+ width = 0;
19
+ }
20
+ row.push(item);
21
+ width += need;
22
+ }
23
+ if (row.length > 0)
24
+ rows.push(row);
25
+ return rows;
26
+ }
27
+ function layRow(items, y) {
28
+ const gap = 8;
29
+ const width = items.reduce((sum, item) => sum + item.r * 2 + gap, -gap);
30
+ let x = (CHART_W - width) / 2;
31
+ return items.map((item) => {
32
+ x += item.r;
33
+ const dot = dotOf(item.moon, item.family, item.diameter, item.distance, Math.round(x * 10) / 10, Math.round(y * 10) / 10, item.r);
34
+ x += item.r + gap;
35
+ return dot;
36
+ });
37
+ }
38
+ /** Every moon of Jupiter in the catalogue, packed into one picture. A circle's area follows the moon's diameter. Each outer group has its own rows, farthest at the top, and the empty gap between the inner moons and those rows is shortened. */
39
+ export function jupiterMoonChart() {
40
+ const moons = catalogueMoonsOf("jupiter");
41
+ const families = moonFamilies("jupiter");
42
+ const familyOf = new Map();
43
+ for (const family of families)
44
+ for (const moon of family.moons)
45
+ familyOf.set(moon.id, { id: family.id, ...family.names });
46
+ const maxD = Math.max(...moons.map((moon) => (moon.radiusKm ?? 0.5) * 2));
47
+ const pending = moons.map((moon) => {
48
+ const known = familyOf.get(moon.id);
49
+ const diameter = (moon.radiusKm ?? 0.5) * 2;
50
+ return {
51
+ moon,
52
+ family: { en: known?.en ?? "", ja: known?.ja ?? "" },
53
+ familyId: known?.id ?? "",
54
+ diameter,
55
+ distance: moon.orbit?.a ?? null,
56
+ r: Math.round((11 + 23 * Math.sqrt(diameter / maxD)) * 10) / 10,
57
+ };
58
+ });
59
+ const byDistance = (a, b) => (a.distance ?? Infinity) - (b.distance ?? Infinity);
60
+ const inner = pending.filter((item) => (item.distance ?? Infinity) < INNER_KM).sort(byDistance);
61
+ const outer = pending.filter((item) => (item.distance ?? Infinity) >= INNER_KM);
62
+ const groups = new Map();
63
+ for (const item of outer) {
64
+ const list = groups.get(item.familyId) ?? [];
65
+ list.push(item);
66
+ groups.set(item.familyId, list);
67
+ }
68
+ const outerGroups = [...groups.values()].map((items) => items.sort(byDistance)).sort((a, b) => {
69
+ const mid = (items) => items.reduce((sum, item) => sum + (item.distance ?? 0), 0) / items.length;
70
+ return mid(b) - mid(a);
71
+ });
72
+ const small = inner.filter((item) => item.r < 14);
73
+ const big = inner.filter((item) => item.r >= 14);
74
+ let y = PLANET.y - PLANET.r - 36;
75
+ const dots = [];
76
+ if (small.length > 0) {
77
+ y -= Math.max(...small.map((item) => item.r));
78
+ dots.push(...layRow(small, y));
79
+ y -= Math.max(...small.map((item) => item.r)) + 28;
80
+ }
81
+ for (const item of big) {
82
+ y -= item.r;
83
+ dots.push(...layRow([item], y));
84
+ y -= item.r + 64;
85
+ }
86
+ const outerBottom = y - 70;
87
+ const outerRows = outerGroups.flatMap((items) => rowsOf(items));
88
+ const span = Math.max(outerBottom - 56, outerRows.length * 36);
89
+ const step = span / Math.max(outerRows.length, 1);
90
+ outerRows.forEach((row, index) => {
91
+ const band = 48 + index * step;
92
+ const lift = Math.max(...row.map((item) => item.r));
93
+ dots.push(...layRow(row, Math.round((band + lift) * 10) / 10));
94
+ });
95
+ return {
96
+ width: CHART_W,
97
+ height: CHART_H,
98
+ read: MOON_CATALOGUE_FETCHED,
99
+ count: dots.length,
100
+ planet: { en: BODIES.jupiter.name.en, ja: BODIES.jupiter.name.ja, ...PLANET, color: BODIES.jupiter.colour },
101
+ legend: families.filter((family) => family.count > 0).map((family) => ({ id: family.id, names: family.names, color: family.color, count: family.count })),
102
+ dots,
103
+ };
104
+ }
105
+ function dotOf(moon, family, diameterKm, distanceKm, x, y, r) {
106
+ return {
107
+ id: moon.id,
108
+ label: moon.label,
109
+ ja: moon.ja,
110
+ family,
111
+ color: moonOrbitColor(moon, "group"),
112
+ year: moon.discovery.year,
113
+ estimated: moon.radiusFrom === "derived",
114
+ diameterKm,
115
+ distanceKm,
116
+ x,
117
+ y,
118
+ r,
119
+ };
120
+ }
@@ -228,13 +228,33 @@ function paint(T, id, context, bases, hold) {
228
228
  ringTexture = t;
229
229
  ringInner = photo.from / facts.radiusKm;
230
230
  ringOuter = photo.to / facts.radiusKm;
231
- ringMesh.geometry.dispose();
231
+ const stripGeometry = ringMesh.geometry;
232
+ const stripAt = disposables.indexOf(stripGeometry);
233
+ if (stripAt >= 0)
234
+ disposables.splice(stripAt, 1);
235
+ stripGeometry.dispose();
232
236
  ringMesh.geometry = new T.RingGeometry(ringInner, ringOuter, 256, 1);
233
237
  disposables.push(ringMesh.geometry);
234
- ringMaterial.premultipliedAlpha = false;
235
- ringMaterial.needsUpdate = true;
236
- ringMaterial.uniforms.uRingTex.value = t;
237
- ringMaterial.uniforms.uRingR.value.set(ringInner, ringOuter);
238
+ // the picture is not premultiplied and the strip was. three.js keeps every program a material has compiled, so changing the flag would leave the strip's program and its vertex array on the card: the strip's material is let go and a new one is made
239
+ const stripMaterial = ringMaterial;
240
+ stripMaterial.uniforms.uRingTex.value = t;
241
+ stripMaterial.uniforms.uRingR.value.set(ringInner, ringOuter);
242
+ const photoMaterial = new T.ShaderMaterial({
243
+ vertexShader: RING_VERTEX_WORLD,
244
+ fragmentShader: RING_FRAGMENT_WORLD,
245
+ side: T.DoubleSide,
246
+ transparent: true,
247
+ premultipliedAlpha: false,
248
+ depthWrite: false,
249
+ uniforms: stripMaterial.uniforms,
250
+ });
251
+ ringMesh.material = photoMaterial;
252
+ const materialAt = disposables.indexOf(stripMaterial);
253
+ if (materialAt >= 0)
254
+ disposables.splice(materialAt, 1);
255
+ stripMaterial.dispose();
256
+ disposables.push(photoMaterial);
257
+ ringMaterial = photoMaterial;
238
258
  for (const m of materials) {
239
259
  m.uniforms.uRingTex.value = t;
240
260
  m.uniforms.uRingR.value.set(ringInner, ringOuter);
@@ -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.74.0/dist/textures/";
14
+ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.74.2/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.74.0/textures/";
26
+ export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.74.2/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.
@@ -52,7 +52,7 @@ export declare class WakuseiSurface extends HTMLElement {
52
52
  /** The eyes' look now. Setting it turns the view (azimuth and pitch in degrees, `fov` the view's height in degrees); it is drawn at once. */
53
53
  get look(): Look;
54
54
  set look(value: Look);
55
- /** Where the eyes are: metres east and north of the site, and metres over the ground under them. Standing, that is a person's height; while the rover is driven or the landing watched, it is the height of the view being drawn (the seat, the chase camera). */
55
+ /** Where the eyes are: metres east and north of the site, and metres over the ground under them. Standing, that is a person's height; while the rover is driven or the landing watched, it is the height of the view being drawn (the seat, the chase camera); in a glide from one view to another, the eyes on the way. */
56
56
  get position(): {
57
57
  east: number;
58
58
  north: number;
@@ -21,6 +21,7 @@ const TEMPLATE = `<style>
21
21
  :host([data-dragging]) { cursor: grabbing; }
22
22
  #stage { position: absolute; inset: 0; }
23
23
  #note { position: absolute; left: 8px; right: 8px; bottom: 6px; margin: 0; font: 400 11px/1.35 system-ui, sans-serif; color: #c8ccd4; text-shadow: 0 1px 2px #000; pointer-events: none; }
24
+ @media (max-width: 520px) { :host([line-below]) #note { display: none; } }
24
25
  #status { position: absolute; inset: 0; display: grid; place-items: center; font: 500 13px system-ui, sans-serif; color: #c8ccd4; pointer-events: none; }
25
26
  #status[hidden] { display: none; }
26
27
  #labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
@@ -164,11 +165,12 @@ export class WakuseiSurface extends HTMLElement {
164
165
  this.#look = clampLook(value);
165
166
  this.#changed();
166
167
  }
167
- /** Where the eyes are: metres east and north of the site, and metres over the ground under them. Standing, that is a person's height; while the rover is driven or the landing watched, it is the height of the view being drawn (the seat, the chase camera). */
168
+ /** Where the eyes are: metres east and north of the site, and metres over the ground under them. Standing, that is a person's height; while the rover is driven or the landing watched, it is the height of the view being drawn (the seat, the chase camera); in a glide from one view to another, the eyes on the way. */
168
169
  get position() {
169
- if (this.#terrain === undefined || (this.#vehicle === undefined && this.#landing === undefined))
170
+ if (this.#terrain === undefined)
170
171
  return { ...this.#at, up: EYE_HEIGHT };
171
- return { ...this.#at, up: this.#eyeUp() - this.#groundAt(this.#at.east, this.#at.north) };
172
+ const pose = this.#pose();
173
+ return { east: pose.east, north: pose.north, up: pose.up - this.#groundAt(pose.east, pose.north) };
172
174
  }
173
175
  /** The sky now: the Sun and the Earth in it. */
174
176
  get sky() {
@@ -469,7 +471,7 @@ export class WakuseiSurface extends HTMLElement {
469
471
  if (m === undefined)
470
472
  return "";
471
473
  if (this.#site()?.ground === "flat")
472
- return this.#lang() === "ja" ? "地面: 高さのデータが追加されるまでの平らな代用です。ここには、実測した起伏も作った起伏もありません。太陽、空、重力は、この場所と時刻の実際のとおりです。" : "Ground: flat stand-in until a DTM is added. There is no relief here, measured or made. The Sun, sky and gravity are the real ones for this place and time.";
474
+ return this.#lang() === "ja" ? "ここの地面は、高さのデータが追加されるまでの平らな代用です。実測した起伏はありません。" : "The ground here is a flat stand-in until height data is added. Nothing on it is measured.";
473
475
  const made = this.#noDetail() ? "" : this.#lang() === "ja" ? "5 m より細かい地形(小さなクレーター、砂塵、岩)は計算で作ったもので、実測ではありません。" : "Detail finer than the 5 m grid (small craters, dust, rocks) is made, not measured.";
474
476
  const things = this.#objects.length === 0 ? "" : this.#lang() === "ja" ? " 地面の物は、公表された座標の位置にこのパッケージが置いたもので、形は簡単な絵です。" : " The things on the ground are placed by this package at published positions, as plain drawings.";
475
477
  const credit = joinCredits(m.credit, m.picture?.credit);
@@ -490,6 +492,15 @@ export class WakuseiSurface extends HTMLElement {
490
492
  return this.#landingEyeUp;
491
493
  return this.#groundAt(this.#at.east, this.#at.north) + EYE_HEIGHT;
492
494
  }
495
+ /** The camera now: where the view puts it, or on the way to there from where the watched descent had it. */
496
+ #pose() {
497
+ const pose = { east: this.#at.east, north: this.#at.north, up: this.#eyeUp(), look: this.#look };
498
+ const glide = this.#glide;
499
+ if (glide === undefined)
500
+ return pose;
501
+ const k = (performance.now() - glide.at) / glide.ms;
502
+ return k >= 1 ? pose : blendPose(glide.from, pose, easeInOut(k), (east, north) => this.#groundAt(east, north));
503
+ }
493
504
  /** Ask for a draw. A change of the view (`moving`, the default) is drawn at the quality of motion and followed, a moment after the last, by one at the quality of rest. */
494
505
  #changed(moving = true) {
495
506
  if (!this.#view?.live)
@@ -544,14 +555,9 @@ export class WakuseiSurface extends HTMLElement {
544
555
  if (this.#drawScale < 1)
545
556
  this.#scaled += 1;
546
557
  // the camera: where the view puts it, or on the way to there from where the watched descent had it (a move, not a cut)
547
- let pose = { east: this.#at.east, north: this.#at.north, up: this.#eyeUp(), look: this.#look };
548
- if (this.#glide !== undefined) {
549
- const k = (performance.now() - this.#glide.at) / this.#glide.ms;
550
- if (k >= 1)
551
- this.#glide = undefined;
552
- else
553
- pose = blendPose(this.#glide.from, pose, easeInOut(k), (east, north) => this.#groundAt(east, north));
554
- }
558
+ const pose = this.#pose();
559
+ if (this.#glide !== undefined && performance.now() - this.#glide.at >= this.#glide.ms)
560
+ this.#glide = undefined;
555
561
  this.#lastPose = { pose, fromWatch: this.#landing !== undefined || this.#glide !== undefined };
556
562
  scene.apply({ eye: { east: pose.east, north: pose.north, up: pose.up }, look: pose.look, sky: this.#sky, shadows: this.getAttribute("shadows") !== "off", detail: !this.#noDetail(), exposure: num(this.getAttribute("exposure"), this.#site()?.body === "mars" ? 1.5 : 1.6), quality: this.#quality(), scale: this.#drawScale, objects: this.#objects.length > 0, ...(this.#vehicle === undefined ? {} : { vehicle: this.#vehicle, ...(this.#model === undefined ? {} : { model: this.#model }), trail: this.#trail, dust: this.#dust.position }), ...(this.#landing === undefined ? {} : { lander: this.#landerState(), dust: this.#dust.position }), measure: measure || this.getAttribute("measure") !== null });
557
563
  this.#view.invalidate();
@@ -39,7 +39,7 @@ export function flatManifest(site) {
39
39
  picture: null,
40
40
  horizon: null,
41
41
  credit: "no height model for this site yet",
42
- accuracy: "ground: flat stand-in until a DTM is added; there is no relief here, measured or made",
42
+ accuracy: "ground: flat stand-in until height data is added; nothing on it is measured",
43
43
  };
44
44
  }
45
45
  /**
@@ -1,4 +1,5 @@
1
1
  import { type DriveState } from "./drive.ts";
2
+ import type { V3 } from "./shapes.ts";
2
3
  import { type Rig } from "./rig.ts";
3
4
  /**
4
5
  * A rover model that has been loaded: its rig for the drive step and the calls the scene makes. Made by `loadVehicleModel`.
@@ -19,6 +20,8 @@ export interface VehicleModel {
19
20
  readonly nodes: readonly string[];
20
21
  /** The model's height over the ground, metres. */
21
22
  readonly height: number;
23
+ /** Triangles of each mesh, in the drive frame at rest. Each casts on its own, so the shadow follows the rover. */
24
+ readonly shadowClouds: readonly (readonly V3[])[];
22
25
  /** Put the model where the drive state is, with the wheels rolled and steered, lit from `sun` (a direction in the scene's frame, east, up, minus north) at `strength` (0 to 1). */
23
26
  place(state: DriveState, sun: readonly [number, number, number], strength: number): void;
24
27
  /** Draw it with the page's renderer over what is drawn, with the ground's view-projection matrix. */
@@ -78,10 +78,12 @@ function makeModel(T, root) {
78
78
  let renders = 0;
79
79
  const [ax, ay] = [new T.Vector3(1, 0, 0), new T.Vector3(0, 1, 0)];
80
80
  const turn = new T.Quaternion();
81
+ const shadowClouds = shadowCloudsOf(T, root);
81
82
  return {
82
83
  rig,
83
84
  nodes: names,
84
85
  height: size.y,
86
+ shadowClouds,
85
87
  angles,
86
88
  get renders() {
87
89
  return renders;
@@ -131,6 +133,52 @@ function makeModel(T, root) {
131
133
  },
132
134
  };
133
135
  }
136
+ /**
137
+ * Triangles of each mesh, strided so a dense file stays a few hundred. One hull of a whole mesh is the body's box, which is the slab. A triangle casts on its own.
138
+ */
139
+ function shadowCloudsOf(T, root) {
140
+ root.updateMatrixWorld(true);
141
+ const v = new T.Vector3();
142
+ const clouds = [];
143
+ const cap = 500;
144
+ root.traverse((node) => {
145
+ const mesh = node;
146
+ if (mesh.isMesh !== true)
147
+ return;
148
+ const geom = mesh.geometry;
149
+ const attr = geom?.getAttribute?.("position");
150
+ if (attr === undefined || attr.count < 3)
151
+ return;
152
+ const index = geom.getIndex?.() ?? null;
153
+ const triCount = index === null ? Math.floor(attr.count / 3) : Math.floor(index.count / 3);
154
+ if (triCount < 1)
155
+ return;
156
+ const step = Math.max(1, Math.ceil(triCount / cap));
157
+ const at = (i) => {
158
+ v.fromBufferAttribute(attr, i).applyMatrix4(mesh.matrixWorld);
159
+ return fromModelFrame([v.x, v.y, v.z]);
160
+ };
161
+ for (let t = 0; t < triCount; t += step) {
162
+ const base = t * 3;
163
+ const pa = at(index === null ? base : index.getX(base));
164
+ const pb = at(index === null ? base + 1 : index.getX(base + 1));
165
+ const pc = at(index === null ? base + 2 : index.getX(base + 2));
166
+ const abx = pb[0] - pa[0];
167
+ const aby = pb[1] - pa[1];
168
+ const abz = pb[2] - pa[2];
169
+ const acx = pc[0] - pa[0];
170
+ const acy = pc[1] - pa[1];
171
+ const acz = pc[2] - pa[2];
172
+ const cx = aby * acz - abz * acy;
173
+ const cy = abz * acx - abx * acz;
174
+ const cz = abx * acy - aby * acx;
175
+ if (cx * cx + cy * cy + cz * cz < 1e-6)
176
+ continue;
177
+ clouds.push([pa, pb, pc]);
178
+ }
179
+ });
180
+ return clouds;
181
+ }
134
182
  function disposeAll(root) {
135
183
  root.traverse((node) => {
136
184
  const mesh = node;
@@ -1,5 +1,5 @@
1
1
  import { type DriveState } from "./drive.ts";
2
- import { type Part, type V3 } from "./shapes.ts";
2
+ import type { Part, V3 } from "./shapes.ts";
3
3
  /**
4
4
  * The nodes a rover model may name: `wheel-fl`, `wheel-fr`, `wheel-ml`, `wheel-mr`, `wheel-rl` and `wheel-rr` roll about X (their origin is the wheel's centre), `steer-fl`, `steer-fr`, `steer-rl` and `steer-rr`
5
5
  * turn about Y (a pivot holding the wheel and its leg), and the eye is `eye`, or `seat-commander` (the left seat) when the model has no `eye`. The model's metres have +Y up and its front on +Z.
@@ -107,19 +107,18 @@ export declare function modelPose(state: Pick<DriveState, "spin" | "steer">): {
107
107
  */
108
108
  export declare const fromModelFrame: (p: readonly [number, number, number]) => V3;
109
109
  /**
110
- * The shadow of a model: one box the size of its body, placed as the drive state puts the vehicle (a shadow is the hull of a part's corners, so a box is its footprint).
110
+ * The shadow of a model: the points of its meshes, placed as the drive state puts the vehicle. One cloud is one mesh, in the drive frame at rest (x right, y up, z forward). `partShadows` takes the hull of each cloud, so the shadow follows the rover.
111
111
  *
112
112
  * @param state - The vehicle.
113
- * @param rig - The model's rig.
114
- * @param height - The model's height over the ground, metres.
115
- * @returns One part, to hand to `partShadows`.
113
+ * @param clouds - The meshes' points, as `VehicleModel.shadowClouds` keeps them.
114
+ * @returns One part a mesh, to hand to `partShadows`.
116
115
  *
117
116
  * @example
118
117
  * ```ts
119
- * import { modelShadowParts, partShadows, startDrive, ROVER } from "@johnmorrisdotca/wakusei-planets/surface";
118
+ * import { modelShadowParts, partShadows, startDrive } from "@johnmorrisdotca/wakusei-planets/surface";
120
119
  *
121
- * const parts = modelShadowParts(startDrive(0, 0, 0, 0), ROVER, 1.5);
120
+ * const parts = modelShadowParts(startDrive(0, 0, 0, 0), [[[-0.4, 0.5, 0.8], [0.4, 0.5, 0.8], [0, 1.2, 0]]]);
122
121
  * console.log(partShadows(parts, 0, 90, 20).length / 9, "triangles of shadow");
123
122
  * ```
124
123
  */
125
- export declare function modelShadowParts(state: Pick<DriveState, "east" | "north" | "heading" | "pitch" | "roll" | "y">, rig: Rig, height: number): Part[];
124
+ export declare function modelShadowParts(state: Pick<DriveState, "east" | "north" | "heading" | "pitch" | "roll" | "y">, clouds: readonly (readonly V3[])[]): Part[];
@@ -1,7 +1,6 @@
1
1
  // A rover model's rig, without a DOM and without three.js: the names of the nodes a model (a GLB) must give, the measures a drive step needs read from where those nodes are, and the angles the wheels and
2
2
  // steering pivots are turned to for a drive state. The loader (`model.ts`) finds the nodes; this decides what the numbers mean, so it is tested in node.
3
3
  import { ROVER, toWorld } from "./drive.js";
4
- import { box } from "./shapes.js";
5
4
  /**
6
5
  * The nodes a rover model may name: `wheel-fl`, `wheel-fr`, `wheel-ml`, `wheel-mr`, `wheel-rl` and `wheel-rr` roll about X (their origin is the wheel's centre), `steer-fl`, `steer-fr`, `steer-rl` and `steer-rr`
7
6
  * turn about Y (a pivot holding the wheel and its leg), and the eye is `eye`, or `seat-commander` (the left seat) when the model has no `eye`. The model's metres have +Y up and its front on +Z.
@@ -81,27 +80,31 @@ export function modelPose(state) {
81
80
  */
82
81
  export const fromModelFrame = (p) => [-p[0], p[1], p[2]];
83
82
  /**
84
- * The shadow of a model: one box the size of its body, placed as the drive state puts the vehicle (a shadow is the hull of a part's corners, so a box is its footprint).
83
+ * The shadow of a model: the points of its meshes, placed as the drive state puts the vehicle. One cloud is one mesh, in the drive frame at rest (x right, y up, z forward). `partShadows` takes the hull of each cloud, so the shadow follows the rover.
85
84
  *
86
85
  * @param state - The vehicle.
87
- * @param rig - The model's rig.
88
- * @param height - The model's height over the ground, metres.
89
- * @returns One part, to hand to `partShadows`.
86
+ * @param clouds - The meshes' points, as `VehicleModel.shadowClouds` keeps them.
87
+ * @returns One part a mesh, to hand to `partShadows`.
90
88
  *
91
89
  * @example
92
90
  * ```ts
93
- * import { modelShadowParts, partShadows, startDrive, ROVER } from "@johnmorrisdotca/wakusei-planets/surface";
91
+ * import { modelShadowParts, partShadows, startDrive } from "@johnmorrisdotca/wakusei-planets/surface";
94
92
  *
95
- * const parts = modelShadowParts(startDrive(0, 0, 0, 0), ROVER, 1.5);
93
+ * const parts = modelShadowParts(startDrive(0, 0, 0, 0), [[[-0.4, 0.5, 0.8], [0.4, 0.5, 0.8], [0, 1.2, 0]]]);
96
94
  * console.log(partShadows(parts, 0, 90, 20).length / 9, "triangles of shadow");
97
95
  * ```
98
96
  */
99
- export function modelShadowParts(state, rig, height) {
100
- const part = box([0, height / 2 + rig.wheelRadius, 0], [rig.track * 0.8, height, rig.length * 0.85], 0, 1);
101
- const position = [];
102
- for (let i = 0; i < part.position.length; i += 3) {
103
- const w = toWorld(state, [part.position[i], part.position[i + 1], part.position[i + 2]]);
104
- position.push(w[0], w[1], w[2]);
97
+ export function modelShadowParts(state, clouds) {
98
+ const out = [];
99
+ for (const cloud of clouds) {
100
+ if (cloud.length < 3)
101
+ continue;
102
+ const position = [];
103
+ for (const p of cloud) {
104
+ const w = toWorld(state, [p[0], p[1], p[2]]);
105
+ position.push(w[0], w[1], w[2]);
106
+ }
107
+ out.push({ position, normal: [], tone: 1 });
105
108
  }
106
- return [{ ...part, position, normal: part.normal }];
109
+ return out;
107
110
  }
@@ -379,13 +379,13 @@ export function createSurfaceItem(options) {
379
379
  return;
380
380
  }
381
381
  if (state.model !== undefined) {
382
- // a model draws itself (in its own pass, after the ground); the shapes are hidden and its shadow is a box the size of its body
382
+ // a model draws itself (in its own pass, after the ground); the shapes are hidden and its shadow follows the points of its meshes
383
383
  if (vehicleMesh !== undefined)
384
384
  vehicleMesh.visible = false;
385
385
  const sun = state.sky.sun;
386
386
  state.model.place(v, [sun.enu[0], sun.enu[2], -sun.enu[1]], Math.max(0, Math.min(1, sun.altitude / 8)));
387
387
  modelDrawn = state.model;
388
- makeVehicleShadow(state, modelShadowParts(v, state.model.rig, state.model.height));
388
+ makeVehicleShadow(state, modelShadowParts(v, state.model.shadowClouds));
389
389
  return;
390
390
  }
391
391
  modelDrawn = undefined;
@@ -715,7 +715,7 @@ export function createSurfaceItem(options) {
715
715
  earth.uniforms.uHalf.value = Math.tan((sky.earthDiameter * Math.PI) / 360);
716
716
  sun.uniforms.uHalf.value = Math.tan((sky.sunDiameter * Math.PI) / 360);
717
717
  sun.mesh.visible = sky.sun.altitude > -1;
718
- earth.mesh.visible = sky.earthDisc !== false && sky.earth.altitude > -1;
718
+ earth.mesh.visible = sky.earthDisc !== false && sky.earth.altitude > 0;
719
719
  skyMesh.visible = air !== null;
720
720
  if (air !== null) {
721
721
  const e = toEnu(axes.forward);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.74.0";
1
+ export declare const VERSION = "0.74.2";
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.74.0";
2
+ export const VERSION = "0.74.2";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/wakusei-planets",
3
- "version": "0.74.0",
3
+ "version": "0.74.2",
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",