@johnmorrisdotca/wakusei-planets 0.61.0 → 0.62.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 CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.62.0] - 2026-11-17
6
+
7
+ - **Standing on Mars, and at six more sites: Perseverance, Curiosity, Apollo 15, Apollo 16, Chang'e 3 and Chang'e 4** (MODULES-1482, part 2; John Morris, 2026-11-17). `SURFACE_SITES` now has seven sites and `SurfaceSite.body` is `"moon" | "mars"`; the new `ground` is `"measured"` (Apollo 17, as before) or `"flat"`, and `gravity` is the body's surface gravity (`MOON_GRAVITY` 1.62, `MARS_GRAVITY` 3.71 m/s2). `<wakusei-surface site="perseverance">` and `land(space, "perseverance")` (also `curiosity`, `apollo-15`, `apollo-16`, `chang-e-3`, `chang-e-4`) work; the seven records in `LANDING_SITES` carry `stand`, and a test pins each to the standing view's point, place and landing moment. **The ground at the six new sites is a flat stand-in until a height model is added** ("ground: flat stand-in until a DTM is added", in the page's line and in `manifest.accuracy`): flat at the site's datum, made in memory by `flatTerrain` and `flatManifest` with nothing fetched, and with no relief, no made craters and no made rocks (`detail` is ignored there), so no relief is faked. The height data would be a download (HiRISE or CTX models for Mars, LROC or LOLA for the Moon) and is not here. **Real for the place and time**: the Sun's direction and size from the package's own ephemeris (`standSky`, `localFrame` takes a body; on Mars the Sun is about a third of a degree across), the gravity (the driven rover's slope and free fall, `driveStep`'s new last argument, and the thrown dust, `DustField.step`'s), and the Moon's black sky with its Earth. **Chosen, not measured**: Mars's sky, a butterscotch day sky with a pale blue glow round a low Sun, black at night after a long twilight (`marsAir`, drawn by a new sky pass in the shader; NASA's page says the sky is hazy and reddish from suspended dust), and the ground's reddish tone; the Earth is not drawn from Mars. New exports of `/surface`: `standSky`, `marsAir`, `flatTerrain`, `flatManifest`, `MOON_GRAVITY`, `MARS_GRAVITY` and the types `StandSky`, `SkyAir` and `Rgb`; `TerrainManifest.body` is `"moon" | "mars"`. Tests: `test/surface-sites.test.ts` and `e2e/surface-sites.demo.ts` (no tiles asked for, the flat line, a butterscotch sky over a reddish ground on Mars and a black sky over a grey ground on the Moon, nothing drawn at rest). Guide: "Standing on the Moon and Mars", in both languages. **Not here yet**: the measured ground of any of them, and the rover models at the new sites (`drive-model` takes the GLB as before).
8
+
9
+ - **Belt filters and size tiers** (MODULES-558, part). `filterBeltBodies(bodies, { belts, hMax, hMin, status, part })`, `beltStatus(name)` (provisional, numbered or named), `beltPart(body, jd, jupiterLongitude)` (the main belt's inner, middle and outer parts, the Trojans' L4 and L5 camps, plutinos and detached bodies), `BELT_TIERS` and `beltTiers(bodies)` (how many bodies of each size tier are carried, against how many the database knows). All from the rows already carried: no new data. Still open on the ticket: discovery facts and pictures (need files fetched), the embed and the builder.
10
+
5
11
  ## [0.61.0] - 2026-11-17
6
12
 
7
13
  - **IM-2's three rovers stand on Athena, east of the prime meridian** (MODULES-1402; John Morris, 2026-11-17). GCAT's lander catalogue has the whole IM-2 landing at 84.7906 S, 29.1957 W; NASA's table, which the places take, puts Athena at 29.1957 E, but GRACE, MAPP and Yaoki, which NASA's table does not list, kept the catalogue's point on the far side of the prime meridian. `scripts/make-places-data.py` now moves a rover the catalogue puts at its lander's own point with the lander whenever a better source moves the lander more than 0.05 degree and has no position of its own for the rover; the rovers keep the catalogue's figure in `gcatPosition`. No other rover on the Moon or Mars disagrees with its lander, and a test pins both.
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.61.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.62.0/docs/images/lineup-desk.png" width="640"></p>
23
23
 
24
24
  ## Who it is for
25
25
 
@@ -412,7 +412,7 @@ The tiles of every body share one 48 MB budget, six loads at a time for a source
412
412
 
413
413
  ## The portrait builder
414
414
 
415
- <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.61.0/docs/images/portrait-family.png" width="640"></p>
415
+ <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.62.0/docs/images/portrait-family.png" width="640"></p>
416
416
 
417
417
  [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.
418
418
 
@@ -567,7 +567,7 @@ BODIES.pluto.kind; // "dwarf-planet"
567
567
 
568
568
  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:
569
569
 
570
- > Morris, J. (2026). *Wakusei Planets* (version 0.61.0) [Computer software]. https://github.com/johnmorrisdotca/wakusei-planets
570
+ > Morris, J. (2026). *Wakusei Planets* (version 0.62.0) [Computer software]. https://github.com/johnmorrisdotca/wakusei-planets
571
571
 
572
572
  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).
573
573
 
@@ -0,0 +1,128 @@
1
+ import { type BeltBody, type BeltId } from "./index.ts";
2
+ /**
3
+ * How far a small body has come on its way to a name: `provisional` (only a designation such as `2007 OR10`), `numbered` (a number, no name yet: `15760`) or `named` (`588 Achilles`).
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * import type { BeltStatus } from "@johnmorrisdotca/wakusei-planets/belts";
8
+ *
9
+ * const status: BeltStatus = "named";
10
+ * console.log(status);
11
+ * ```
12
+ */
13
+ export type BeltStatus = "provisional" | "numbered" | "named";
14
+ /**
15
+ * The status of a body from its name as the Small-Body Database writes it: a number then a name is `named`, a bare number is `numbered`, a designation of a year and letters is `provisional`.
16
+ *
17
+ * @param name - The body's name, such as `588 Achilles`, `15760` or `2007 OR10`.
18
+ * @returns The status.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * import { beltStatus } from "@johnmorrisdotca/wakusei-planets/belts";
23
+ *
24
+ * console.log(beltStatus("588 Achilles"), beltStatus("2007 OR10"));
25
+ * ```
26
+ */
27
+ export declare function beltStatus(name: string): BeltStatus;
28
+ /**
29
+ * A part of a belt that the filters know: the main belt's `inner-main` (inside the 3:1 gap, under 2.5 au), `middle-main` (2.5 to 2.82 au) and `outer-main` (beyond the 5:2 gap), the Trojans' two camps `trojan-l4` (ahead of Jupiter)
30
+ * and `trojan-l5` (behind it), the Kuiper belt's `plutino` (the 3:2 resonance with Neptune, 39.0 to 39.9 au) and the `detached` (a scattered body that never comes nearer than 40 au to the Sun, like Sedna).
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * import type { BeltPart } from "@johnmorrisdotca/wakusei-planets/belts";
35
+ *
36
+ * const part: BeltPart = "plutino";
37
+ * console.log(part);
38
+ * ```
39
+ */
40
+ export type BeltPart = "inner-main" | "middle-main" | "outer-main" | "trojan-l4" | "trojan-l5" | "plutino" | "detached";
41
+ /**
42
+ * Which part of its belt a body is in, or `undefined` where it is in none of the parts (a Hilda, a Centaur, a classical or other resonant body). A Trojan's camp needs Jupiter's heliocentric ecliptic longitude on the date (from `heliocentric("jupiter", ms)`);
43
+ * without it a Trojan has no part.
44
+ *
45
+ * @param body - The body.
46
+ * @param jd - The date, as a Julian date (TT).
47
+ * @param jupiterLongitude - Jupiter's longitude in degrees on that date, for the Trojans.
48
+ * @returns The part, or `undefined` where the body is in none of them.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * import { beltPart } from "@johnmorrisdotca/wakusei-planets/belts";
53
+ *
54
+ * console.log(beltPart({ name: "T", a: 2.7, e: 0.1, i: 5, node: 80, peri: 70, M0: 10, epoch: 2461200.5, H: 9, belt: "main" }, 2461200.5));
55
+ * ```
56
+ */
57
+ export declare function beltPart(body: BeltBody, jd: number, jupiterLongitude?: number): BeltPart | undefined;
58
+ /**
59
+ * What to keep: bodies of these `belts`, of at least `hMax` brightness (a body with an absolute magnitude H no greater than `hMax`: smaller H is a bigger body), at most `hMin`, with one of these `status` values, and of this `part` (for
60
+ * which `jd` and, for the Trojans, `jupiterLongitude` are needed).
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * import type { BeltFilter } from "@johnmorrisdotca/wakusei-planets/belts";
65
+ *
66
+ * const filter: BeltFilter = { belts: ["trojan"], hMax: 10, status: ["named"] };
67
+ * console.log(filter.hMax);
68
+ * ```
69
+ */
70
+ export interface BeltFilter {
71
+ belts?: readonly BeltId[];
72
+ /** Keep bodies with an absolute magnitude H of this or less (the bigger ones). */
73
+ hMax?: number;
74
+ /** Keep bodies with an absolute magnitude H of this or more (the smaller ones). */
75
+ hMin?: number;
76
+ status?: readonly BeltStatus[];
77
+ part?: BeltPart;
78
+ /** The date for `part`, as a Julian date (TT). */
79
+ jd?: number;
80
+ /** Jupiter's longitude in degrees on `jd`, for `part` of `trojan-l4` or `trojan-l5`. */
81
+ jupiterLongitude?: number;
82
+ }
83
+ /**
84
+ * The bodies that pass a filter, in their order.
85
+ *
86
+ * @param bodies - The bodies, from `loadBeltBodies`.
87
+ * @param filter - What to keep; an empty filter keeps every body.
88
+ * @returns The bodies that pass.
89
+ *
90
+ * @example
91
+ * ```ts
92
+ * import { filterBeltBodies, loadBeltBodies } from "@johnmorrisdotca/wakusei-planets/belts";
93
+ *
94
+ * const big = filterBeltBodies(await loadBeltBodies(), { belts: ["main"], hMax: 7 });
95
+ * console.log(big.length);
96
+ * ```
97
+ */
98
+ export declare function filterBeltBodies(bodies: readonly BeltBody[], filter?: BeltFilter): BeltBody[];
99
+ /**
100
+ * The size tiers: the upper edge of the absolute magnitude H of each (a body of H 10 is about 35 km across in the main belt, with an albedo of 0.06 about 60 km; H does not give a size without the albedo, so the tiers are in H).
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * import { BELT_TIERS } from "@johnmorrisdotca/wakusei-planets/belts";
105
+ *
106
+ * console.log(BELT_TIERS.join(", "));
107
+ * ```
108
+ */
109
+ export declare const BELT_TIERS: readonly [8, 10, 12, 14, 99];
110
+ /**
111
+ * How many bodies this package carries in each size tier of each belt, with the number the database holds for the belt beside it, so a page can say how small a part is drawn. Tier `k` holds the bodies with H above the
112
+ * tier before it and up to `BELT_TIERS[k]`.
113
+ *
114
+ * @param bodies - The bodies, from `loadBeltBodies`.
115
+ * @returns For each belt, the `carried` count of each tier, the total `sample` and the `known` count from `BELTS`.
116
+ *
117
+ * @example
118
+ * ```ts
119
+ * import { beltTiers, loadBeltBodies } from "@johnmorrisdotca/wakusei-planets/belts";
120
+ *
121
+ * console.log(beltTiers(await loadBeltBodies()).main.carried.join(", "));
122
+ * ```
123
+ */
124
+ export declare function beltTiers(bodies: readonly BeltBody[]): Record<BeltId, {
125
+ carried: number[];
126
+ sample: number;
127
+ known: number;
128
+ }>;
@@ -0,0 +1,117 @@
1
+ // Filters and tiers for the belts' bodies (MODULES-558): the status of a body from its name, the part of its belt it is in, a filter by belt, part, size and status, and how many bodies each size tier holds. Everything is worked out from the rows
2
+ // the package already carries; nothing is fetched. Pure: no DOM, no three.js.
3
+ import { BELT_IDS, BELTS } from "./index.js";
4
+ import { smallBodyAt } from "../door/small-bodies.js";
5
+ /**
6
+ * The status of a body from its name as the Small-Body Database writes it: a number then a name is `named`, a bare number is `numbered`, a designation of a year and letters is `provisional`.
7
+ *
8
+ * @param name - The body's name, such as `588 Achilles`, `15760` or `2007 OR10`.
9
+ * @returns The status.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { beltStatus } from "@johnmorrisdotca/wakusei-planets/belts";
14
+ *
15
+ * console.log(beltStatus("588 Achilles"), beltStatus("2007 OR10"));
16
+ * ```
17
+ */
18
+ export function beltStatus(name) {
19
+ const text = name.trim();
20
+ if (/^\d{4} [A-Z]{2}\d*$/.test(text))
21
+ return "provisional";
22
+ if (/^\d+$/.test(text))
23
+ return "numbered";
24
+ return /^\d+ \S/.test(text) ? "named" : "provisional";
25
+ }
26
+ /**
27
+ * Which part of its belt a body is in, or `undefined` where it is in none of the parts (a Hilda, a Centaur, a classical or other resonant body). A Trojan's camp needs Jupiter's heliocentric ecliptic longitude on the date (from `heliocentric("jupiter", ms)`);
28
+ * without it a Trojan has no part.
29
+ *
30
+ * @param body - The body.
31
+ * @param jd - The date, as a Julian date (TT).
32
+ * @param jupiterLongitude - Jupiter's longitude in degrees on that date, for the Trojans.
33
+ * @returns The part, or `undefined` where the body is in none of them.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * import { beltPart } from "@johnmorrisdotca/wakusei-planets/belts";
38
+ *
39
+ * console.log(beltPart({ name: "T", a: 2.7, e: 0.1, i: 5, node: 80, peri: 70, M0: 10, epoch: 2461200.5, H: 9, belt: "main" }, 2461200.5));
40
+ * ```
41
+ */
42
+ export function beltPart(body, jd, jupiterLongitude) {
43
+ if (body.belt === "main")
44
+ return body.a < 2.5 ? "inner-main" : body.a <= 2.82 ? "middle-main" : "outer-main";
45
+ if (body.belt === "resonant")
46
+ return body.a >= 39.0 && body.a <= 39.9 ? "plutino" : undefined;
47
+ if (body.belt === "scattered")
48
+ return body.a * (1 - body.e) > 40 ? "detached" : undefined;
49
+ if (body.belt === "trojan" && jupiterLongitude !== undefined) {
50
+ const [x, y] = smallBodyAt(body, jd);
51
+ const ahead = ((((Math.atan2(y, x) * 180) / Math.PI - jupiterLongitude + 180) % 360) + 360) % 360 - 180;
52
+ return ahead >= 0 ? "trojan-l4" : "trojan-l5";
53
+ }
54
+ return undefined;
55
+ }
56
+ /**
57
+ * The bodies that pass a filter, in their order.
58
+ *
59
+ * @param bodies - The bodies, from `loadBeltBodies`.
60
+ * @param filter - What to keep; an empty filter keeps every body.
61
+ * @returns The bodies that pass.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * import { filterBeltBodies, loadBeltBodies } from "@johnmorrisdotca/wakusei-planets/belts";
66
+ *
67
+ * const big = filterBeltBodies(await loadBeltBodies(), { belts: ["main"], hMax: 7 });
68
+ * console.log(big.length);
69
+ * ```
70
+ */
71
+ export function filterBeltBodies(bodies, filter = {}) {
72
+ return bodies.filter((body) => {
73
+ if (filter.belts !== undefined && !filter.belts.includes(body.belt))
74
+ return false;
75
+ if (filter.hMax !== undefined && body.H > filter.hMax)
76
+ return false;
77
+ if (filter.hMin !== undefined && body.H < filter.hMin)
78
+ return false;
79
+ if (filter.status !== undefined && !filter.status.includes(beltStatus(body.name)))
80
+ return false;
81
+ return filter.part === undefined || beltPart(body, filter.jd ?? 0, filter.jupiterLongitude) === filter.part;
82
+ });
83
+ }
84
+ /**
85
+ * The size tiers: the upper edge of the absolute magnitude H of each (a body of H 10 is about 35 km across in the main belt, with an albedo of 0.06 about 60 km; H does not give a size without the albedo, so the tiers are in H).
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * import { BELT_TIERS } from "@johnmorrisdotca/wakusei-planets/belts";
90
+ *
91
+ * console.log(BELT_TIERS.join(", "));
92
+ * ```
93
+ */
94
+ export const BELT_TIERS = [8, 10, 12, 14, 99];
95
+ /**
96
+ * How many bodies this package carries in each size tier of each belt, with the number the database holds for the belt beside it, so a page can say how small a part is drawn. Tier `k` holds the bodies with H above the
97
+ * tier before it and up to `BELT_TIERS[k]`.
98
+ *
99
+ * @param bodies - The bodies, from `loadBeltBodies`.
100
+ * @returns For each belt, the `carried` count of each tier, the total `sample` and the `known` count from `BELTS`.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * import { beltTiers, loadBeltBodies } from "@johnmorrisdotca/wakusei-planets/belts";
105
+ *
106
+ * console.log(beltTiers(await loadBeltBodies()).main.carried.join(", "));
107
+ * ```
108
+ */
109
+ export function beltTiers(bodies) {
110
+ const out = Object.fromEntries(BELT_IDS.map((id) => [id, { carried: BELT_TIERS.map(() => 0), sample: 0, known: BELTS[id].known }]));
111
+ for (const body of bodies) {
112
+ const k = BELT_TIERS.findIndex((edge) => body.H <= edge);
113
+ out[body.belt].carried[k] += 1;
114
+ out[body.belt].sample += 1;
115
+ }
116
+ return out;
117
+ }
@@ -268,3 +268,5 @@ export declare function beltFlight(belt: BeltId): {
268
268
  velocity: [number, number, number];
269
269
  };
270
270
  };
271
+ export { BELT_TIERS, beltPart, beltStatus, beltTiers, filterBeltBodies } from "./filter.ts";
272
+ export type { BeltFilter, BeltPart, BeltStatus } from "./filter.ts";
@@ -306,3 +306,4 @@ export function beltFlight(belt) {
306
306
  },
307
307
  };
308
308
  }
309
+ export { BELT_TIERS, beltPart, beltStatus, beltTiers, filterBeltBodies } from "./filter.js";
@@ -107,7 +107,7 @@ export const LANDING_SITES = [
107
107
  id: "moon/apollo-15", place: "moon/apollo-15-lunar-module", body: "moon", name: { en: "Apollo 15", ja: "アポロ15号" },
108
108
  alsoAt: ["moon/apollo-15-lunar-rover"],
109
109
  date: "1971-07-30T22:16Z", lat: 26.1324, lon: 3.6333, agency: AGENCY.NASA,
110
- country: "US",
110
+ country: "US", stand: "apollo-15",
111
111
  source: SRC_NASA_MOON, page: `${NSS}1971-063C`,
112
112
  },
113
113
  {
@@ -120,7 +120,7 @@ export const LANDING_SITES = [
120
120
  id: "moon/apollo-16", place: "moon/apollo-16-lunar-module", body: "moon", name: { en: "Apollo 16", ja: "アポロ16号" },
121
121
  alsoAt: ["moon/apollo-16-lunar-rover"],
122
122
  date: "1972-04-21T02:23Z", lat: -8.9734, lon: 15.5011, agency: AGENCY.NASA,
123
- country: "US",
123
+ country: "US", stand: "apollo-16",
124
124
  source: SRC_NASA_MOON, page: `${NSS}1972-031C`,
125
125
  },
126
126
  {
@@ -152,14 +152,14 @@ export const LANDING_SITES = [
152
152
  id: "moon/chang-e-3", place: "moon/chang-e-3", body: "moon", name: { en: "Chang'e 3", ja: "嫦娥3号" },
153
153
  alsoAt: ["moon/yutu"],
154
154
  date: "2013-12-14T13:11Z", lat: 44.1214, lon: -19.5117, agency: AGENCY.CNSA,
155
- country: "CN",
155
+ country: "CN", stand: "chang-e-3",
156
156
  source: SRC_NASA_MOON,
157
157
  },
158
158
  {
159
159
  id: "moon/chang-e-4", place: "moon/chang-e-4", body: "moon", name: { en: "Chang'e 4", ja: "嫦娥4号" },
160
160
  alsoAt: ["moon/yutu-2"],
161
161
  date: "2019-01-03T02:26Z", lat: -45.4561, lon: 177.5885, agency: AGENCY.CNSA,
162
- country: "CN",
162
+ country: "CN", stand: "chang-e-4",
163
163
  source: SRC_NASA_MOON,
164
164
  },
165
165
  {
@@ -256,7 +256,7 @@ export const LANDING_SITES = [
256
256
  id: "mars/curiosity", place: "mars/curiosity", body: "mars", name: { en: "Curiosity", ja: "キュリオシティ" },
257
257
  alsoAt: ["mars/curiosity-s-descent-stage"],
258
258
  date: "2012-08-06T05:17Z", lat: -4.5895, lon: 137.4417, agency: AGENCY.NASA,
259
- country: "US",
259
+ country: "US", stand: "curiosity",
260
260
  source: SRC_GCAT, checkedAgainst: SRC_ODE, page: `${NSS}2011-070A`,
261
261
  },
262
262
  {
@@ -269,7 +269,7 @@ export const LANDING_SITES = [
269
269
  id: "mars/perseverance", place: "mars/perseverance", body: "mars", name: { en: "Perseverance", ja: "パーシビアランス" },
270
270
  alsoAt: ["mars/perseverance-s-descent-stage"],
271
271
  date: "2021-02-18T20:43Z", lat: 18.4446, lon: 77.4508, agency: AGENCY.NASA,
272
- country: "US",
272
+ country: "US", stand: "perseverance",
273
273
  source: SRC_GCAT, checkedAgainst: SRC_MARS24, page: `${NSS}2020-052A`,
274
274
  },
275
275
  {
@@ -101,8 +101,8 @@ export declare function startDrive(east: number, north: number, heading: number,
101
101
  /** Where a point of the rover's frame is in the site's plane and height (before the wheels' own turns): the heading, then the pitch, then the roll. */
102
102
  export declare function toWorld(state: Pick<DriveState, "east" | "north" | "heading" | "pitch" | "roll" | "y">, p: V3): V3;
103
103
  /**
104
- * One step of driving: the speed follows the throttle (slowed uphill by the Moon's gravity, stopped by a slope over 25 degrees and by anything in `blocked`), the heading follows the steering (the four wheels steer, the
105
- * back ones the other way), the rover moves, and its height, pitch and roll follow the four places its wheels touch, the height on a spring and in free fall (at lunar gravity) when the ground drops away.
104
+ * One step of driving: the speed follows the throttle (slowed uphill by the body's gravity, stopped by a slope over 25 degrees and by anything in `blocked`), the heading follows the steering (the four wheels steer, the
105
+ * back ones the other way), the rover moves, and its height, pitch and roll follow the four places its wheels touch, the height on a spring and in free fall (at the body's gravity) when the ground drops away.
106
106
  *
107
107
  * @param state - The rover now.
108
108
  * @param input - The throttle and the steering.
@@ -110,6 +110,7 @@ export declare function toWorld(state: Pick<DriveState, "east" | "north" | "head
110
110
  * @param ground - The ground's height over the site's ground at a place.
111
111
  * @param blocked - True at a place the rover cannot go (a big rock, the lunar module).
112
112
  * @param rig - The vehicle's measures (its wheels' places and size); the lunar rover's by default, a model's from `rigOf`.
113
+ * @param gravity - The body's surface gravity in m/s2 (the Moon's 1.62 by default; Mars's is `MARS_GRAVITY`, 3.71): what slows it uphill and what it falls at.
113
114
  * @returns The rover a moment later.
114
115
  *
115
116
  * @example
@@ -121,7 +122,7 @@ export declare function toWorld(state: Pick<DriveState, "east" | "north" | "head
121
122
  * console.log(`${rover.north.toFixed(1)} m north after two seconds, at ${rover.speed.toFixed(1)} m/s`);
122
123
  * ```
123
124
  */
124
- export declare function driveStep(state: DriveState, input: DriveInput, dt: number, ground: (east: number, north: number) => number, blocked?: (east: number, north: number) => boolean, rig?: Rig): DriveState;
125
+ export declare function driveStep(state: DriveState, input: DriveInput, dt: number, ground: (east: number, north: number) => number, blocked?: (east: number, north: number) => boolean, rig?: Rig, gravity?: number): DriveState;
125
126
  /**
126
127
  * The rover's shape as it is now, turned and placed: the parts of `roverParts` with each wheel turned by how far it has rolled and steered (the back wheels the other way), then moved by the rover's heading, pitch, roll
127
128
  * and place. Everything is in the site's plane (x east, y up, z north).
@@ -78,8 +78,8 @@ function wheelGrounds(state, ground, rig) {
78
78
  return rig.wheels.map(([x, , z]) => ground(state.east + x * c + z * s, state.north - x * s + z * c));
79
79
  }
80
80
  /**
81
- * One step of driving: the speed follows the throttle (slowed uphill by the Moon's gravity, stopped by a slope over 25 degrees and by anything in `blocked`), the heading follows the steering (the four wheels steer, the
82
- * back ones the other way), the rover moves, and its height, pitch and roll follow the four places its wheels touch, the height on a spring and in free fall (at lunar gravity) when the ground drops away.
81
+ * One step of driving: the speed follows the throttle (slowed uphill by the body's gravity, stopped by a slope over 25 degrees and by anything in `blocked`), the heading follows the steering (the four wheels steer, the
82
+ * back ones the other way), the rover moves, and its height, pitch and roll follow the four places its wheels touch, the height on a spring and in free fall (at the body's gravity) when the ground drops away.
83
83
  *
84
84
  * @param state - The rover now.
85
85
  * @param input - The throttle and the steering.
@@ -87,6 +87,7 @@ function wheelGrounds(state, ground, rig) {
87
87
  * @param ground - The ground's height over the site's ground at a place.
88
88
  * @param blocked - True at a place the rover cannot go (a big rock, the lunar module).
89
89
  * @param rig - The vehicle's measures (its wheels' places and size); the lunar rover's by default, a model's from `rigOf`.
90
+ * @param gravity - The body's surface gravity in m/s2 (the Moon's 1.62 by default; Mars's is `MARS_GRAVITY`, 3.71): what slows it uphill and what it falls at.
90
91
  * @returns The rover a moment later.
91
92
  *
92
93
  * @example
@@ -98,7 +99,7 @@ function wheelGrounds(state, ground, rig) {
98
99
  * console.log(`${rover.north.toFixed(1)} m north after two seconds, at ${rover.speed.toFixed(1)} m/s`);
99
100
  * ```
100
101
  */
101
- export function driveStep(state, input, dt, ground, blocked, rig = ROVER) {
102
+ export function driveStep(state, input, dt, ground, blocked, rig = ROVER, gravity = ROVER.gravity) {
102
103
  const d = Math.min(Math.max(dt, 0), 0.05);
103
104
  const next = { ...state, spin: [...state.spin] };
104
105
  const throttle = Math.min(1, Math.max(-1, input.throttle));
@@ -112,7 +113,7 @@ export function driveStep(state, input, dt, ground, blocked, rig = ROVER) {
112
113
  next.speed += Math.sign(delta) * Math.min(Math.abs(delta), a * d);
113
114
  if (Math.abs(throttle) < 0.02)
114
115
  next.speed -= Math.sign(next.speed) * Math.min(Math.abs(next.speed), 0.35 * d); // a little rolling resistance
115
- next.speed -= ROVER.gravity * Math.sin(state.pitch) * d;
116
+ next.speed -= gravity * Math.sin(state.pitch) * d;
116
117
  if ((state.pitch > ROVER.maxSlope && next.speed > 0) || (state.pitch < -ROVER.maxSlope && next.speed < 0))
117
118
  next.speed = 0; // uphill past 25 degrees: it does not go
118
119
  // the brake holds it once it has nearly stopped, on any slope it could climb: a rover left alone stays where it is
@@ -144,7 +145,7 @@ export function driveStep(state, input, dt, ground, blocked, rig = ROVER) {
144
145
  // the height: on its springs while the wheels are down (stiffness 81, damping 12.6, a quick and well damped settle), free where the ground has dropped more than a few centimetres away
145
146
  next.airborne = next.y - rest > 0.03;
146
147
  if (next.airborne)
147
- next.vy -= ROVER.gravity * d;
148
+ next.vy -= gravity * d;
148
149
  else
149
150
  next.vy += (81 * (rest - next.y) - 12.6 * next.vy) * d;
150
151
  next.y += next.vy * d;
@@ -41,6 +41,7 @@ export declare class DustField {
41
41
  *
42
42
  * @param dt - Seconds.
43
43
  * @param ground - The ground's height over the site's ground at a place.
44
+ * @param gravity - The body's surface gravity, m/s2 (the Moon's by default). Air's drag on a grain is not modelled.
44
45
  */
45
- step(dt: number, ground: (east: number, north: number) => number): void;
46
+ step(dt: number, ground: (east: number, north: number) => number, gravity?: number): void;
46
47
  }
@@ -72,14 +72,15 @@ export class DustField {
72
72
  *
73
73
  * @param dt - Seconds.
74
74
  * @param ground - The ground's height over the site's ground at a place.
75
+ * @param gravity - The body's surface gravity, m/s2 (the Moon's by default). Air's drag on a grain is not modelled.
75
76
  */
76
- step(dt, ground) {
77
+ step(dt, ground, gravity = G) {
77
78
  let live = 0;
78
79
  for (let i = 0; i < this.age.length; i += 1) {
79
80
  if (this.age[i] >= this.life[i])
80
81
  continue;
81
82
  this.age[i] += dt;
82
- this.velocity[i * 3 + 1] -= G * dt;
83
+ this.velocity[i * 3 + 1] -= gravity * dt;
83
84
  const [x, y, z] = [this.position[i * 3] + this.velocity[i * 3] * dt, this.position[i * 3 + 1] + this.velocity[i * 3 + 1] * dt, this.position[i * 3 + 2] + this.velocity[i * 3 + 2] * dt];
84
85
  if (this.age[i] >= this.life[i] || y < ground(x, z)) {
85
86
  this.age[i] = 1e9;
@@ -7,7 +7,7 @@ import { type HeightLevel, type TerrainManifest } from "./height.ts";
7
7
  import { type TerrainProgress } from "./load.ts";
8
8
  import { type SurfaceScene } from "./scene.ts";
9
9
  import { type SiteObject } from "./objects.ts";
10
- import { type MoonSky } from "./sky.ts";
10
+ import { type StandSky } from "./sky.ts";
11
11
  import { type Look } from "./view.ts";
12
12
  export { setThreeLoader };
13
13
  /**
@@ -26,7 +26,7 @@ export type SurfaceState = "idle" | "loading" | "live" | "lost" | "unavailable";
26
26
  /**
27
27
  * The `<wakusei-surface>` custom element: standing on a body.
28
28
  *
29
- * Attributes: `body` (`moon`), `site` (a name from `SURFACE_SITES`, `apollo-17`), `time` (an ISO date and time, or milliseconds since 1970; the site's own landing moment when left out; `now` for the real time),
29
+ * Attributes: `body` (`moon`; the site's own body is the one used), `site` (a name from `SURFACE_SITES`: `apollo-17`, `apollo-15`, `apollo-16`, `chang-e-3`, `chang-e-4`, `perseverance`, `curiosity`; all but `apollo-17` stand on a flat stand-in ground until a height model is added), `time` (an ISO date and time, or milliseconds since 1970; the site's own landing moment when left out; `now` for the real time),
30
30
  * `heading` (degrees clockwise from north to look toward), `pitch` (degrees up), `fov` (the view's height in degrees: zoom), `tiles` (the folder the height tiles are served from; the demo site's `tiles/` by default),
31
31
  * `lang` (`en` or `ja`: the words on the picture).
32
32
  *
@@ -59,7 +59,7 @@ export declare class WakuseiSurface extends HTMLElement {
59
59
  up: number;
60
60
  };
61
61
  /** The sky now: the Sun and the Earth in it. */
62
- get sky(): MoonSky | undefined;
62
+ get sky(): StandSky | undefined;
63
63
  /** The moment shown, milliseconds since 1970. */
64
64
  get time(): number;
65
65
  set time(value: number);
@@ -9,7 +9,8 @@ import { drop, groundAt } from "./height.js";
9
9
  import { loadTerrain } from "./load.js";
10
10
  import { createSurfaceItem } from "./scene.js";
11
11
  import { objectsOf, traverseOf } from "./objects.js";
12
- import { moonSky } from "./sky.js";
12
+ import { standSky } from "./sky.js";
13
+ import { flatTerrain } from "./flat.js";
13
14
  import { siteById } from "./site.js";
14
15
  import { clampLook, EYE_HEIGHT, stepOver, viewProjection, WALK_SPEED } from "./view.js";
15
16
  export { setThreeLoader };
@@ -49,7 +50,7 @@ const num = (value, fallback) => {
49
50
  /**
50
51
  * The `<wakusei-surface>` custom element: standing on a body.
51
52
  *
52
- * Attributes: `body` (`moon`), `site` (a name from `SURFACE_SITES`, `apollo-17`), `time` (an ISO date and time, or milliseconds since 1970; the site's own landing moment when left out; `now` for the real time),
53
+ * Attributes: `body` (`moon`; the site's own body is the one used), `site` (a name from `SURFACE_SITES`: `apollo-17`, `apollo-15`, `apollo-16`, `chang-e-3`, `chang-e-4`, `perseverance`, `curiosity`; all but `apollo-17` stand on a flat stand-in ground until a height model is added), `time` (an ISO date and time, or milliseconds since 1970; the site's own landing moment when left out; `now` for the real time),
53
54
  * `heading` (degrees clockwise from north to look toward), `pitch` (degrees up), `fov` (the view's height in degrees: zoom), `tiles` (the folder the height tiles are served from; the demo site's `tiles/` by default),
54
55
  * `lang` (`en` or `ja`: the words on the picture).
55
56
  *
@@ -311,6 +312,14 @@ export class WakuseiSurface extends HTMLElement {
311
312
  #site() {
312
313
  return siteById(this.getAttribute("site") ?? "apollo-17");
313
314
  }
315
+ /** The body's surface gravity at the site, m/s2. */
316
+ #gravity() {
317
+ return this.#site()?.gravity ?? 1.62;
318
+ }
319
+ /** True where no made detail is drawn: the page said `detail="off"`, or the site's ground is a flat stand-in, which has no relief to make detail on (made craters and rocks would be relief that is not there). */
320
+ #noDetail() {
321
+ return this.getAttribute("detail") === "off" || this.#site()?.ground === "flat";
322
+ }
314
323
  #readAttributes() {
315
324
  const site = this.#site();
316
325
  if (site === undefined) {
@@ -323,8 +332,9 @@ export class WakuseiSurface extends HTMLElement {
323
332
  this.#time = time === null || time === "" ? site.time : time === "now" ? Date.now() : Number.isFinite(Number(time)) ? Number(time) : Date.parse(time);
324
333
  if (!Number.isFinite(this.#time))
325
334
  this.#time = site.time;
326
- this.#sky = moonSky(site.lat, site.lon, this.#time);
327
- this.setAttribute("aria-label", `${site.name[this.#lang()]}: ${this.#lang() === "ja" ? "月面に立った視点" : "standing on the Moon"}`);
335
+ this.#sky = standSky(site.body, site.lat, site.lon, this.#time);
336
+ const onMars = site.body === "mars";
337
+ this.setAttribute("aria-label", `${site.name[this.#lang()]}: ${this.#lang() === "ja" ? (onMars ? "火星表面に立った視点" : "月面に立った視点") : onMars ? "standing on Mars" : "standing on the Moon"}`);
328
338
  }
329
339
  #lang() {
330
340
  return this.getAttribute("lang") === "ja" ? "ja" : "en";
@@ -358,7 +368,7 @@ export class WakuseiSurface extends HTMLElement {
358
368
  setKeepOut(this.#objects);
359
369
  if (!this.#placed) {
360
370
  // a step or two from the landing point, out of any made crater
361
- const stand = this.getAttribute("detail") === "off" ? { x: 0, y: 0 } : standingPlace(0, 0);
371
+ const stand = this.#noDetail() ? { x: 0, y: 0 } : standingPlace(0, 0);
362
372
  this.#at = { east: stand.x, north: stand.y };
363
373
  this.#placed = true;
364
374
  this.#syncDrive();
@@ -391,6 +401,12 @@ export class WakuseiSurface extends HTMLElement {
391
401
  this.#abort?.abort();
392
402
  this.#abort = new AbortController();
393
403
  try {
404
+ if (this.#site()?.ground === "flat") {
405
+ // a flat stand-in: nothing to fetch, the ground is whole at once
406
+ this.#terrain = flatTerrain(this.#site());
407
+ this.setAttribute("data-loading", "done");
408
+ return;
409
+ }
394
410
  const base = this.getAttribute("tiles");
395
411
  const folder = base === null || base === "" ? TILES_BASE : base;
396
412
  this.#terrain = await loadTerrain(folder, body, site, {
@@ -436,7 +452,9 @@ export class WakuseiSurface extends HTMLElement {
436
452
  const m = this.#terrain?.manifest;
437
453
  if (m === undefined)
438
454
  return "";
439
- const made = this.getAttribute("detail") === "off" ? "" : this.#lang() === "ja" ? "5 m より細かい地形(小さなクレーター、砂塵、岩)は計算で作ったもので、実測ではありません。" : "Detail finer than the 5 m grid (small craters, dust, rocks) is made, not measured.";
455
+ if (this.#site()?.ground === "flat")
456
+ 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.";
457
+ const made = this.#noDetail() ? "" : this.#lang() === "ja" ? "5 m より細かい地形(小さなクレーター、砂塵、岩)は計算で作ったもので、実測ではありません。" : "Detail finer than the 5 m grid (small craters, dust, rocks) is made, not measured.";
440
458
  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.";
441
459
  const picture = m.picture === null || m.picture === undefined ? "" : ` ${m.picture.credit}.`;
442
460
  return this.#lang() === "ja" ? `高さの実測: ${m.accuracy}。${m.credit}。${made}${things}` : `Heights measured: ${m.accuracy}. ${m.credit}.${picture} ${made}${things}`;
@@ -445,7 +463,7 @@ export class WakuseiSurface extends HTMLElement {
445
463
  #groundAt(east, north) {
446
464
  const t = this.#terrain;
447
465
  const h = groundAt(t.levels, t.manifest.height, east, north) ?? t.manifest.ground;
448
- const made = this.getAttribute("detail") === "off" ? 0 : madeGround(east, north, 0.35).h;
466
+ const made = this.#noDetail() ? 0 : madeGround(east, north, 0.35).h;
449
467
  return h - t.manifest.ground - drop(Math.hypot(east, north), t.manifest.radius) + made;
450
468
  }
451
469
  /** The eyes' height over the site's origin: the ground under them (the made craters too: the feet follow them) and a person's height. */
@@ -477,7 +495,7 @@ export class WakuseiSurface extends HTMLElement {
477
495
  const site = this.#site();
478
496
  if (site === undefined)
479
497
  return;
480
- this.#sky = moonSky(site.lat, site.lon, this.#time);
498
+ this.#sky = standSky(site.body, site.lat, site.lon, this.#time);
481
499
  // `auto`: a draw at rest is timed now and then, and a machine that takes too long at rest steps down (a card does a draw at full quality in a few milliseconds; a phone may not)
482
500
  const auto = this.getAttribute("quality") === null || this.getAttribute("quality") === "auto";
483
501
  const was = scene.drawMs;
@@ -508,7 +526,7 @@ export class WakuseiSurface extends HTMLElement {
508
526
  this.#measured += 1;
509
527
  if (this.#drawScale < 1)
510
528
  this.#scaled += 1;
511
- scene.apply({ eye: { east: this.#at.east, north: this.#at.north, up: this.#eyeUp() }, look: this.#look, sky: this.#sky, shadows: this.getAttribute("shadows") !== "off", detail: this.getAttribute("detail") !== "off", exposure: num(this.getAttribute("exposure"), 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 });
529
+ scene.apply({ eye: { east: this.#at.east, north: this.#at.north, up: this.#eyeUp() }, look: this.#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 });
512
530
  this.#view.invalidate();
513
531
  this.#draws += 1;
514
532
  this.#placeLabels();
@@ -654,7 +672,7 @@ export class WakuseiSurface extends HTMLElement {
654
672
  if (this.#blockersAt === undefined || Math.hypot(v.east - this.#blockersAt.east, v.north - this.#blockersAt.north) > 8) {
655
673
  this.#blockersAt = { east: v.east, north: v.north };
656
674
  const list = [];
657
- if (this.getAttribute("detail") !== "off")
675
+ if (!this.#noDetail())
658
676
  for (const rock of rocksAround(v.east, v.north, 28, 0.0024))
659
677
  if (rock.size >= 0.6)
660
678
  list.push({ x: rock.x, y: rock.y, r: rock.size * 0.5 + 1.1 });
@@ -676,7 +694,7 @@ export class WakuseiSurface extends HTMLElement {
676
694
  const steps = Math.max(1, Math.ceil(seconds * 60));
677
695
  const dt = seconds / steps;
678
696
  for (let i = 0; i < steps; i += 1) {
679
- v = driveStep(v, input, dt, ground, blocked, rig);
697
+ v = driveStep(v, input, dt, ground, blocked, rig, this.#gravity());
680
698
  // each wheel on the ground throws grains up and back: the faster, the more
681
699
  if (!v.airborne && Math.abs(v.speed) > 0.6) {
682
700
  const h = (v.heading * Math.PI) / 180;
@@ -693,7 +711,7 @@ export class WakuseiSurface extends HTMLElement {
693
711
  }
694
712
  }
695
713
  }
696
- this.#dust.step(dt, ground);
714
+ this.#dust.step(dt, ground, this.#gravity());
697
715
  }
698
716
  this.#vehicle = v;
699
717
  // the tracks: a point every 1.2 m
@@ -916,7 +934,7 @@ export class WakuseiSurface extends HTMLElement {
916
934
  }
917
935
  }
918
936
  if (seconds > 0)
919
- this.#dust.step(seconds, ground);
937
+ this.#dust.step(seconds, ground, this.#gravity());
920
938
  if (l.camera === "lander") {
921
939
  this.#at = { east: lx, north: ly };
922
940
  this.#landingEyeUp = lz + pose.altitude + 4;