@johnmorrisdotca/wakusei-planets 0.38.0 → 0.40.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,19 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.40.0] - 2026-11-13
6
+
7
+ - **Paint an orbiter's path on the Moon or Mars** (MODULES-1168). `space.paint = { id, length, swath }` on `<wakusei-space>` paints that craft's ground track on the body it goes round (`id` such as `lro` or `mro`; `length` `1d` by default, or `1w`, `1m`, in the clock's time; `swath` `track` by default, or `coverage`, the ground where the craft is at least 10° up). `clearPaint()` takes it off, and another craft clears the old trail. Parts older than `length` fade and are dropped. The line is filled between frames, including backwards. One upload a frame while time moves, nothing at rest, and nothing while paint is off, when the picture and its sphere are freed on the graphics card. The craft's place is sampled at most a third of a trip apart, so a fast clock follows the orbit; a clock run backwards lays down the older end; a `coverage` swath over the date line is painted on both edges. The date-line split, the pole split and the swath radius are `@johnmorrisdotca/wakusei-planets/ground-track` (no DOM, no three.js). The space page has Paint, Clear, and 1 day, 1 week, 1 month.
8
+ - **Ride Off puts the demo's clock back** (the space page). A ride along starts the clock, and Off used to leave it running, at 3,600 times real time, with the view drawing every frame. Off now holds the clock again when the ride started it, and leaves it running at its own speed when it was already playing. Demo only.
9
+ - **The freeze test of the space view holds the clock** (MODULES-1187). "Changes to the space view give back what they took" read 183 graphics objects against a limit of 182 in the image: the rides in its round started the demo's clock, so the moons came and went with the time and the count was of a different moment each round. The round now holds the clock after the rides and waits for 30 frames with no draw before it counts. Test only.
10
+ - **The travel test watches a move on the page** (MODULES-1186). `e2e/space-travel.demo.ts` counted the draws of a move from the test, one round trip for each reading, so a loaded machine saw 6 frames of a move it needs more than 6 of. It now records each new draw at every animation frame on the page until the move ends. Test only.
11
+
12
+ ## [0.39.0] - 2026-11-13
13
+
14
+ - **The portrait builder's credit names each body's picture** (MODULES-1157). It was one fixed public-domain sentence for every painted scene; it is now `picturesCredit` for the bodies in the scene, so Saturn names Solar System Scope, Nestaeric, CC BY 4.0 and the changes. The builder's browser test now expects the source names of the body it shows, not the old public-domain sentence.
15
+ - **The painter carries the credit for the pictures it draws** (MODULES-1146). `WakuseiPainter.credit` is `{ en, ja }`. Before `make` it names every surface picture the painter can draw. After `make` it names only the bodies made in a look that draws the map, so the Moon and Mars add no CC BY 4.0 line and a shaded body with no map adds nothing. While finer map tiles are on a body it adds the `wakusei-tiles` credit from `OWN_SOURCES`, and Mercury's tiles say that their colour is the CC BY 4.0 map. `PICTURE_CREDITS` is the table of which body's map comes from which source (the rows of `NOTICE.md`), and `picturesCredit(bodies, lang)` writes the line for the bodies a page shows. Jupiter names Nestaeric and CC BY 4.0, including the changes.
16
+ - **Embed and door credits name the CC BY 4.0 pictures** (MODULES-1157). `embedCredit` and `lineupCredit` are written from `picturesCredit` for the bodies shown (`lang` is `en` or `ja`). A painted or realistic Mercury, Venus, Jupiter, Saturn, Uranus, Neptune or Sun names its CC BY 4.0 author and the changes; the Moon and Mars stay public domain. The line-up's painted Earth and Jupiter no longer share one "NASA and Nestaeric" line. `OWN_SOURCES`' `wakusei-pictures` credit is the same table for every picture, so it names Shady Tex and does not call a public-domain map CC BY 4.0. The source's licence name stays the stricter "CC BY 4.0".
17
+
5
18
  ## [0.38.0] - 2026-11-13
6
19
 
7
20
  - **You are here, and favourite places, on the space view's Earth** (MODULES-1073). `<wakusei-space>` takes `earth-places` (a JSON list of `{ id, lon, lat, label, kind, color }`, `kind` `here` or `favourite`; the property `earthPlaces` writes the attribute and an empty list takes it away) and `earth-places-look` (`beam`, the default, `pin` or `ring`; the property `earthPlacesLook`). Each place is a marker standing out of the ground that turns with the Earth, is hidden on the far side, fades at the edge, is dimmer in the night (not with `light="lit"`) and keeps its size in pixels; its name sits at the top of the marker, `here` first, never over another place's name or a body's name. It is drawn wherever the Earth is in the picture, not only when the camera looks at it, while the Earth is at least 40 CSS pixels in radius. The attribute is `earth-places`, not chikyu-earth's `places`, because `places` here already chooses the layers of marks on the body looked at. The layout is chikyu-earth's own `layoutPlaces` and `readPlaces` (its `/markers`, 0.36.0 or later), not a copy, brought by the new entry point `@johnmorrisdotca/wakusei-planets/earth-places` (an optional peer: nothing else here imports chikyu-earth, and without the import the attribute draws nothing). `/places` gains `spotView` (a body as a view draws it, flat or in perspective, as a picture a layout can use) and `pointUnder`; `/earth-places` has `readEarthPlaces` and `layEarthPlaces` for a page or a server. At most 32 markers (`here` first), the rest of those in sight counted in `earthPlacesShown().omitted`; no pulse and no animation; nothing is drawn at rest (the markers are laid inside the draws the view makes, a few SVG shapes kept and moved); the markers take no pointer. `space.earthPlacesShown` reports what was laid. A guide ("You are here, and places on the Earth") and its Japanese twin; chikyu-earth is now `^0.36.0` as a dev dependency. Unit tests (the layout agrees with chikyu-earth's own on a flat picture), browser tests of the attribute, the property and the three looks, and a freeze test.
package/NOTICE.md CHANGED
@@ -97,7 +97,7 @@ The painted looks' pictures in `textures/` (the 512 and 1024 pixel widths are al
97
97
 
98
98
  NASA says its content "generally are not subject to copyright in the United States" and asks for acknowledgement (https://www.nasa.gov/nasa-brand-center/images-and-media/); USGS and JPL maps are works of the United States government. This package is not endorsed by NASA, the USGS or any mission, and uses none of their insignia or logotypes.
99
99
 
100
- Venus, Saturn, Neptune and the Sun were replaced from Solar System Scope's equirectangular maps (https://www.solarsystemscope.com/textures/), CC BY 4.0. Mercury is the natural grey 8K map, credited to Shady Tex (https://sketchfab.com/3d-models/mercury-realistic-8k-215f364627054d25ae03bcd72afda714) and to Solar System Scope, also CC BY 4.0. Jupiter and Uranus use Nestaeric's band maps, and Saturn's poles, including the north-polar hexagon, are reprojected from Nestaeric's Saturn (https://sketchfab.com/3d-models/saturn-c09a1970148c43ad99db134a9d6d00b5), also CC BY 4.0. The originals are kept outside this repository. The code of this package stays MIT.
100
+ The same rows are `PICTURE_CREDITS` (`picturesCredit` writes the line for the bodies a page shows; the English credit is the credit column below). Venus, Saturn, Neptune and the Sun were replaced from Solar System Scope's equirectangular maps (https://www.solarsystemscope.com/textures/), CC BY 4.0. Mercury is the natural grey 8K map, credited to Shady Tex (https://sketchfab.com/3d-models/mercury-realistic-8k-215f364627054d25ae03bcd72afda714) and to Solar System Scope, also CC BY 4.0. Jupiter and Uranus use Nestaeric's band maps, and Saturn's poles, including the north-polar hexagon, are reprojected from Nestaeric's Saturn (https://sketchfab.com/3d-models/saturn-c09a1970148c43ad99db134a9d6d00b5), also CC BY 4.0. The originals are kept outside this repository. The code of this package stays MIT.
101
101
 
102
102
  | Pictures | Body | Source file | Licence | Credit | What was done |
103
103
  |---|---|---|---|---|---|
@@ -205,7 +205,7 @@ Credit: Horizons is NASA/JPL-Caltech's service; the trajectories above are credi
205
205
 
206
206
  ## The data door
207
207
 
208
- - **The package's own credits (`OWN_SOURCES` in `@johnmorrisdotca/wakusei-planets/door`, MODULES-831, written 2026-11-10)**: three rows, written from the entries of this file and read nowhere else. `wakusei-pictures` is the surface pictures (Surface pictures above: NASA, USGS and JPL maps that are public domain, and Solar System Scope's and Nestaeric's maps, CC BY 4.0; its licence name is the stricter, "CC BY 4.0", read 2026-11-02). `wakusei-tiles` is the finer map tiles (Finer map tiles above: public domain, read 2026-11-09). `wakusei-orbits` is the series and tables the positions come from (The numbers above: IMCCE's VSOP87B and ELP2000-82B, which "carry no licence text" and are published for use with the credit, and JPL Horizons, NASA/JPL-Caltech, read 2026-11-07; its licence name says "Published for use with credit"). A test holds that none of the three is marked non-commercial or share-alike.
208
+ - **The package's own credits (`OWN_SOURCES` in `@johnmorrisdotca/wakusei-planets/door`, MODULES-831, written 2026-11-10)**: three rows, written from the entries of this file and read nowhere else. `wakusei-pictures` is the surface pictures (Surface pictures above). Its credit is `picturesCredit` over every pictured body, so a public-domain map stays public domain and a CC BY 4.0 map names Solar System Scope, Shady Tex or Nestaeric and the changes. The source's licence name stays the stricter, "CC BY 4.0", read 2026-11-02. `wakusei-tiles` is the finer map tiles (Finer map tiles above: public domain, read 2026-11-09). `wakusei-orbits` is the series and tables the positions come from (The numbers above: IMCCE's VSOP87B and ELP2000-82B, which "carry no licence text" and are published for use with the credit, and JPL Horizons, NASA/JPL-Caltech, read 2026-11-07; its licence name says "Published for use with credit"). A test holds that none of the three is marked non-commercial or share-alike.
209
209
  - **Data a caller hands in is not part of this package.** A source passed to `addSource` or `sources` carries its own credit and licence, and the credit line prints them (with "non-commercial" or "share-alike" where the source says so). This package bundles no such data and takes none as a dependency. The small-body source is a list of orbital elements a caller supplies; this package holds no catalogue of them.
210
210
 
211
211
  ## Orbiter's MIT notice
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.38.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.40.0/docs/images/lineup-desk.png" width="640"></p>
23
23
 
24
24
  ## Who it is for
25
25
 
@@ -125,7 +125,7 @@ Import the element once in client code, and the entry point of each body you dra
125
125
  |---|---|---|
126
126
  | `line` | A clean outline drawing with the body's key features: bands, craters, rings and their gaps, caps, the dark side dashed off. An SVG. | nothing |
127
127
  | `realistic` | A shaded sphere drawn from the body's real colours and features, lit from the Sun's side, with the rings casting shadows. No pictures: the surface is worked out in a shader. | `three`, the body's entry point |
128
- | `painted` | A real surface map from public-domain NASA, USGS and JPL imagery. Small pictures first (1.31 MB for all of them in the package), a sharper one fetched when you zoom in, and finer map tiles for the part in view when you zoom right up, in a body, a portrait or the space view (Mars, the Moon, the Earth and ten moons: [close zoom](docs/guides/close-zoom.md)). | `three`, the body's entry point |
128
+ | `painted` | A real surface map: public-domain NASA, USGS and JPL imagery, or for Mercury, Venus, Jupiter, Saturn, Uranus, Neptune and the Sun a CC BY 4.0 map (`picturesCredit` writes each body's credit). Small pictures first (1.31 MB for all of them in the package), a sharper one fetched when you zoom in, and finer map tiles for the part in view when you zoom right up, in a body, a portrait or the space view (Mars, the Moon, the Earth and ten moons: [close zoom](docs/guides/close-zoom.md)). | `three`, the body's entry point |
129
129
 
130
130
  Every body has its real size relative to the others (`scale-to="jupiter"`), its axial tilt and its rotation. The Sun, Mercury, Venus, Mars, Jupiter, Saturn, Uranus, Neptune and Pluto are drawn, and so are the eight other dwarf planets (Ceres, Orcus, Haumea, Quaoar, Makemake, Gonggong, Eris and Sedna; Haumea and Quaoar as the long shapes they are, and Ceres with a painted map from Dawn) five minor bodies (Vesta, with Dawn's own map, Pallas, Chiron, Pholus and Halley's comet, each its own shape, size and spin as the Small-Body Database has them) and 29 moons (the Moon, Phobos and Deimos, the four Galilean moons, Saturn's seven larger moons, Uranus's five, Proteus, Triton and Nereid, Charon, Nix and Hydra, and Vanth, Hiʻiaka, Namaka and Dysnomia, the moons of the dwarf planets whose orbits are published with a date). The Earth is drawn like the rest in the realistic and painted looks (NASA's Blue Marble), and its line look is [chikyu-earth](https://github.com/johnmorrisdotca/chikyu-earth)'s own globe: `import "@johnmorrisdotca/wakusei-planets/earth"` (it needs `@johnmorrisdotca/chikyu-earth` 0.10.0 or later installed). The painted looks cover the Sun, the planets from Mercury to Earth and Pluto, Ceres, the Moon, the four Galilean moons, Saturn's Mimas, Enceladus, Tethys, Dione, Rhea, Titan and Iapetus, Triton and Charon, and Saturn's rings are Cassini's own picture of them.
131
131
 
@@ -388,7 +388,7 @@ The tiles of every body share one 48 MB budget, six loads at a time for a source
388
388
 
389
389
  ## The portrait builder
390
390
 
391
- <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.38.0/docs/images/portrait-family.png" width="640"></p>
391
+ <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.40.0/docs/images/portrait-family.png" width="640"></p>
392
392
 
393
393
  [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.
394
394
 
@@ -534,7 +534,7 @@ BODIES.pluto.kind; // "dwarf-planet"
534
534
 
535
535
  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:
536
536
 
537
- > Morris, J. (2026). *Wakusei Planets* (version 0.38.0) [Computer software]. https://github.com/johnmorrisdotca/wakusei-planets
537
+ > Morris, J. (2026). *Wakusei Planets* (version 0.40.0) [Computer software]. https://github.com/johnmorrisdotca/wakusei-planets
538
538
 
539
539
  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).
540
540
 
package/dist/door/own.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { PICTURE_CREDITS, picturesCredit } from "../picture-credits.js";
2
+ const PICTURE_IDS = PICTURE_CREDITS.map((row) => row.id);
1
3
  const NOTICE = "https://github.com/johnmorrisdotca/wakusei-planets/blob/main/NOTICE.md";
2
4
  function freeze(value) {
3
5
  if (typeof value === "object" && value !== null)
@@ -21,8 +23,8 @@ export const OWN_SOURCES = freeze([
21
23
  id: "wakusei-pictures",
22
24
  name: { en: "Surface pictures", ja: "表面の地図" },
23
25
  credit: {
24
- en: "Surface pictures: maps by NASA, USGS and JPL (public domain), Solar System Scope and Nestaeric",
25
- ja: "表面の地図:NASA、USGS、JPLの地図(パブリックドメイン)、Solar System ScopeとNestaericの地図",
26
+ en: picturesCredit(PICTURE_IDS, "en"),
27
+ ja: picturesCredit(PICTURE_IDS, "ja"),
26
28
  },
27
29
  licence: { name: "CC BY 4.0", url: `${NOTICE}#surface-pictures`, spdx: "CC-BY-4.0" },
28
30
  url: "https://github.com/johnmorrisdotca/wakusei-planets/tree/main/textures",
package/dist/embed.d.ts CHANGED
@@ -49,6 +49,8 @@ export interface EmbedOptions {
49
49
  turn?: number;
50
50
  /** Pixels across. */
51
51
  size?: number;
52
+ /** The credit's language: `en` (the default) or `ja`. */
53
+ lang?: "en" | "ja";
52
54
  /** How far in the embed page starts, as its `zoom` address key has it (1 is the whole body). Left out or 1, the page starts at Fit. Only the iframe way carries it: the element's own start is Fit. */
53
55
  zoom?: number;
54
56
  }
@@ -171,6 +173,7 @@ export interface LineupEmbed {
171
173
  export declare function lineupCode(options: LineupEmbed, kind?: EmbedKind, settings?: EmbedSettings): string;
172
174
  /**
173
175
  * The credits that travel with a picture of the size line-up: the radii are from refereed papers, the stars are drawn from numbers and not photographs, and the planets' sizes are the IAU's and NASA's.
176
+ * A painted Earth and Jupiter add `picturesCredit` for those two, in `options.lang` (`en` when left out).
174
177
  *
175
178
  * @param options - The choices, so the planets and their pictures are named only when they are used.
176
179
  * @returns A short line of credit to put near the picture.
@@ -184,7 +187,7 @@ export declare function lineupCode(options: LineupEmbed, kind?: EmbedKind, setti
184
187
  */
185
188
  export declare function lineupCredit(options: LineupEmbed): string;
186
189
  /**
187
- * The credits that travel with a picture of a body: the line and illustrated looks are drawn from numbers, and `realistic` and `painted` use the surface maps.
190
+ * The credits that travel with a picture of a body: the line and illustrated looks are drawn from numbers, and `realistic` and `painted` use the surface map of that body (`picturesCredit`). `lang` is `en` or `ja` (`en` when left out).
188
191
  *
189
192
  * @param options - The choices, so only what is used is named.
190
193
  * @returns A short line of credit to put near the picture.
package/dist/embed.js CHANGED
@@ -2,6 +2,7 @@
2
2
  // section shows these as the reader changes a choice, and the tests build or parse every one. Pure: no DOM.
3
3
  import { embedSnippet } from "@johnmorrisdotca/kazoku-ui/embed-panel";
4
4
  import { BODIES, DWARF_IDS, MINOR_IDS } from "./facts.js";
5
+ import { picturesCredit } from "./picture-credits.js";
5
6
  import { decodeScene } from "./portrait/model.js";
6
7
  import { VERSION } from "./version.js";
7
8
  /**
@@ -177,6 +178,7 @@ export function lineupCode(options, kind = "html", settings = {}) {
177
178
  }
178
179
  /**
179
180
  * The credits that travel with a picture of the size line-up: the radii are from refereed papers, the stars are drawn from numbers and not photographs, and the planets' sizes are the IAU's and NASA's.
181
+ * A painted Earth and Jupiter add `picturesCredit` for those two, in `options.lang` (`en` when left out).
180
182
  *
181
183
  * @param options - The choices, so the planets and their pictures are named only when they are used.
182
184
  * @returns A short line of credit to put near the picture.
@@ -189,12 +191,18 @@ export function lineupCode(options, kind = "html", settings = {}) {
189
191
  * ```
190
192
  */
191
193
  export function lineupCredit(options) {
192
- const base = "Wakusei Planets by John Morris (MIT). Sizes at true relative scale; each star's radius is from a refereed paper that measured its angular diameter (sources and disagreements in the package's NOTICE.md). The stars are drawn from their numbers, not photographs: the cells, spots and glow are illustrative.";
193
- const planets = options.planets === true ? " Earth and Jupiter: IAU and NASA sizes." + (options.look === "painted" ? " Surface pictures: NASA and Nestaeric (CC BY 4.0), see NOTICE.md." : "") : "";
194
- return `${base}${planets}`;
194
+ const lang = options.lang ?? "en";
195
+ const base = lang === "ja"
196
+ ? "Wakusei Planets(John Morris、MIT)。大きさは実際の比です。星の半径は、角直径を測った査読論文によります(出典と食い違いはパッケージのNOTICE.md)。星は数字から描いたもので、写真ではありません。表面の模様、黒点、輝きは説明のためのものです。"
197
+ : "Wakusei Planets by John Morris (MIT). Sizes at true relative scale; each star's radius is from a refereed paper that measured its angular diameter (sources and disagreements in the package's NOTICE.md). The stars are drawn from their numbers, not photographs: the cells, spots and glow are illustrative.";
198
+ if (options.planets !== true)
199
+ return base;
200
+ const sizes = lang === "ja" ? " 地球と木星:IAUとNASAの大きさ。" : " Earth and Jupiter: IAU and NASA sizes.";
201
+ const pictures = options.look === "painted" ? ` ${picturesCredit(["earth", "jupiter"], lang)}` : "";
202
+ return `${base}${sizes}${pictures}`;
195
203
  }
196
204
  /**
197
- * The credits that travel with a picture of a body: the line and illustrated looks are drawn from numbers, and `realistic` and `painted` use the surface maps.
205
+ * The credits that travel with a picture of a body: the line and illustrated looks are drawn from numbers, and `realistic` and `painted` use the surface map of that body (`picturesCredit`). `lang` is `en` or `ja` (`en` when left out).
198
206
  *
199
207
  * @param options - The choices, so only what is used is named.
200
208
  * @returns A short line of credit to put near the picture.
@@ -207,11 +215,14 @@ export function lineupCredit(options) {
207
215
  * ```
208
216
  */
209
217
  export function embedCredit(options) {
210
- if (options.star !== undefined)
211
- return "Wakusei Planets by John Morris (MIT). A star drawn from its numbers, not a photo: the colour from its temperature, the size from its radius; the surface cells, spots and glow are illustrative.";
212
- const base = "Wakusei Planets by John Morris (MIT). Sizes, tilt and rotation: IAU and NASA fact sheets.";
218
+ const lang = options.lang ?? "en";
219
+ if (options.star !== undefined) {
220
+ return lang === "ja"
221
+ ? "Wakusei Planets(John Morris、MIT)。数字から描いた星で、写真ではありません。色は温度から、大きさは半径から。表面の模様、黒点、輝きは説明のためのものです。"
222
+ : "Wakusei Planets by John Morris (MIT). A star drawn from its numbers, not a photo: the colour from its temperature, the size from its radius; the surface cells, spots and glow are illustrative.";
223
+ }
224
+ const base = lang === "ja" ? "Wakusei Planets(John Morris、MIT)。大きさ、傾き、自転はIAUとNASAのファクトシートによります。" : "Wakusei Planets by John Morris (MIT). Sizes, tilt and rotation: IAU and NASA fact sheets.";
213
225
  const photos = options.look !== "line" && options.look !== "illustrated";
214
- const painted = photos ? " Surface pictures: NASA, USGS and JPL imagery in the public domain (details in the package's NOTICE.md)." : "";
215
- const earth = options.body === "earth" ? " Earth: NASA Earth Observatory, Blue Marble." : "";
216
- return `${base}${painted}${earth}`;
226
+ const pictures = photos ? picturesCredit([options.body], lang) : "";
227
+ return pictures === "" ? base : `${base} ${pictures}`;
217
228
  }
@@ -0,0 +1,80 @@
1
+ /**
2
+ * A point on a body: longitude and latitude in degrees. Longitude runs from −180 to 180.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * import { splitDateLine, type GroundPoint } from "@johnmorrisdotca/wakusei-planets/ground-track";
7
+ *
8
+ * const point: GroundPoint = { lon: 170, lat: 10 };
9
+ * console.log(splitDateLine(point, { lon: -170, lat: 12 }).length);
10
+ * ```
11
+ */
12
+ export interface GroundPoint {
13
+ lon: number;
14
+ lat: number;
15
+ }
16
+ /**
17
+ * The angle at the body's centre, in radians, out to where a craft `heightKm` above the surface is `elevationDeg` above the horizon (10 when left out).
18
+ * 0 when the craft is on the surface or below, or so low that it is never that high. `radiusKm` is the body's radius.
19
+ *
20
+ * @param heightKm - Height above the surface, in kilometres.
21
+ * @param radiusKm - The body's radius, in kilometres.
22
+ * @param elevationDeg - The elevation that still counts, in degrees. 10 when left out.
23
+ * @returns The angle, in radians.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * import { coverageAngleRad } from "@johnmorrisdotca/wakusei-planets/ground-track";
28
+ *
29
+ * console.log(coverageAngleRad(400, 6371) > coverageAngleRad(50, 1737.4));
30
+ * ```
31
+ */
32
+ export declare function coverageAngleRad(heightKm: number, radiusKm: number, elevationDeg?: number): number;
33
+ /**
34
+ * Points from `a` to `b` along the great circle, about `stepDeg` apart, including both ends. A fast clock stays a continuous line.
35
+ *
36
+ * @param a - The start.
37
+ * @param b - The end.
38
+ * @param stepDeg - The longest step, in degrees.
39
+ * @returns The points, including both ends.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * import { trackSteps } from "@johnmorrisdotca/wakusei-planets/ground-track";
44
+ *
45
+ * console.log(trackSteps({ lon: 0, lat: 0 }, { lon: 10, lat: 0 }, 2).length > 2);
46
+ * ```
47
+ */
48
+ export declare function trackSteps(a: GroundPoint, b: GroundPoint, stepDeg: number): GroundPoint[];
49
+ /**
50
+ * One segment, or two when the short way from `a` to `b` crosses the date line, so an equirectangular line does not cross the whole map.
51
+ * Longitude is degrees, −180 to 180. This is the same split chikyu-earth uses for a satellite over the Earth.
52
+ *
53
+ * @param a - The start.
54
+ * @param b - The end.
55
+ * @returns One segment, or two that meet at ±180.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * import { splitDateLine } from "@johnmorrisdotca/wakusei-planets/ground-track";
60
+ *
61
+ * console.log(splitDateLine({ lon: 170, lat: 0 }, { lon: -170, lat: 0 }).length);
62
+ * ```
63
+ */
64
+ export declare function splitDateLine(a: GroundPoint, b: GroundPoint): [GroundPoint, GroundPoint][];
65
+ /**
66
+ * `splitDateLine`, and a split at a pole when the short way between two high-latitude points would cross the pole.
67
+ * Each piece is safe to draw as a straight line on an equirectangular map.
68
+ *
69
+ * @param a - The start.
70
+ * @param b - The end.
71
+ * @returns The pieces, in order.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * import { splitTrail } from "@johnmorrisdotca/wakusei-planets/ground-track";
76
+ *
77
+ * console.log(splitTrail({ lon: 10, lat: 80 }, { lon: 170, lat: 75 }).length > 1);
78
+ * ```
79
+ */
80
+ export declare function splitTrail(a: GroundPoint, b: GroundPoint): [GroundPoint, GroundPoint][];
@@ -0,0 +1,137 @@
1
+ // The ground track of a craft over a body: the date line, the poles, and the circle where the craft stands 10° up.
2
+ // Pure: no DOM, no three.js, no clock. chikyu-earth can import this later. Its Earth-only `coverageAngleRad(heightKm)` matches `coverageAngleRad(heightKm, 6371)`.
3
+ const RAD = Math.PI / 180;
4
+ /**
5
+ * The angle at the body's centre, in radians, out to where a craft `heightKm` above the surface is `elevationDeg` above the horizon (10 when left out).
6
+ * 0 when the craft is on the surface or below, or so low that it is never that high. `radiusKm` is the body's radius.
7
+ *
8
+ * @param heightKm - Height above the surface, in kilometres.
9
+ * @param radiusKm - The body's radius, in kilometres.
10
+ * @param elevationDeg - The elevation that still counts, in degrees. 10 when left out.
11
+ * @returns The angle, in radians.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { coverageAngleRad } from "@johnmorrisdotca/wakusei-planets/ground-track";
16
+ *
17
+ * console.log(coverageAngleRad(400, 6371) > coverageAngleRad(50, 1737.4));
18
+ * ```
19
+ */
20
+ export function coverageAngleRad(heightKm, radiusKm, elevationDeg = 10) {
21
+ const r = radiusKm + heightKm;
22
+ if (!(r > radiusKm) || !(radiusKm > 0))
23
+ return 0;
24
+ const elevation = elevationDeg * RAD;
25
+ const cosAlpha = (radiusKm / r) * Math.cos(elevation);
26
+ if (!(cosAlpha < 1))
27
+ return 0;
28
+ const alpha = Math.acos(Math.max(-1, cosAlpha));
29
+ return Math.max(0, alpha - elevation);
30
+ }
31
+ /** A unit vector for a longitude and latitude (+z at longitude 0, +x east, +y north). */
32
+ const unitOf = (point) => {
33
+ const lon = point.lon * RAD;
34
+ const lat = point.lat * RAD;
35
+ const c = Math.cos(lat);
36
+ return [c * Math.sin(lon), Math.sin(lat), c * Math.cos(lon)];
37
+ };
38
+ const fromUnit = (x, y, z) => {
39
+ const length = Math.hypot(x, y, z) || 1;
40
+ return { lon: (Math.atan2(x, z) * 180) / Math.PI, lat: (Math.asin(Math.max(-1, Math.min(1, y / length))) * 180) / Math.PI };
41
+ };
42
+ /**
43
+ * Points from `a` to `b` along the great circle, about `stepDeg` apart, including both ends. A fast clock stays a continuous line.
44
+ *
45
+ * @param a - The start.
46
+ * @param b - The end.
47
+ * @param stepDeg - The longest step, in degrees.
48
+ * @returns The points, including both ends.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * import { trackSteps } from "@johnmorrisdotca/wakusei-planets/ground-track";
53
+ *
54
+ * console.log(trackSteps({ lon: 0, lat: 0 }, { lon: 10, lat: 0 }, 2).length > 2);
55
+ * ```
56
+ */
57
+ export function trackSteps(a, b, stepDeg) {
58
+ const u = unitOf(a);
59
+ const v = unitOf(b);
60
+ const dot = Math.max(-1, Math.min(1, u[0] * v[0] + u[1] * v[1] + u[2] * v[2]));
61
+ const angle = Math.acos(dot);
62
+ const step = Math.max(0.25, stepDeg) * RAD;
63
+ if (!(angle > step))
64
+ return [a, b];
65
+ const count = Math.ceil(angle / step);
66
+ const sin = Math.sin(angle) || 1;
67
+ const out = [];
68
+ for (let i = 0; i <= count; i += 1) {
69
+ const t = i / count;
70
+ const left = Math.sin((1 - t) * angle) / sin;
71
+ const right = Math.sin(t * angle) / sin;
72
+ out.push(fromUnit(u[0] * left + v[0] * right, u[1] * left + v[1] * right, u[2] * left + v[2] * right));
73
+ }
74
+ return out;
75
+ }
76
+ /**
77
+ * One segment, or two when the short way from `a` to `b` crosses the date line, so an equirectangular line does not cross the whole map.
78
+ * Longitude is degrees, −180 to 180. This is the same split chikyu-earth uses for a satellite over the Earth.
79
+ *
80
+ * @param a - The start.
81
+ * @param b - The end.
82
+ * @returns One segment, or two that meet at ±180.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * import { splitDateLine } from "@johnmorrisdotca/wakusei-planets/ground-track";
87
+ *
88
+ * console.log(splitDateLine({ lon: 170, lat: 0 }, { lon: -170, lat: 0 }).length);
89
+ * ```
90
+ */
91
+ export function splitDateLine(a, b) {
92
+ let delta = b.lon - a.lon;
93
+ if (delta > 180)
94
+ delta -= 360;
95
+ if (delta < -180)
96
+ delta += 360;
97
+ const end = a.lon + delta;
98
+ if (end <= 180 && end >= -180)
99
+ return [[a, { lon: end, lat: b.lat }]];
100
+ const edge = end > 180 ? 180 : -180;
101
+ const span = end - a.lon;
102
+ const t = span === 0 ? 0 : (edge - a.lon) / span;
103
+ const lat = a.lat + (b.lat - a.lat) * t;
104
+ const other = edge === 180 ? -180 : 180;
105
+ const rest = end > 180 ? end - 360 : end + 360;
106
+ return [
107
+ [a, { lon: edge, lat }],
108
+ [{ lon: other, lat }, { lon: rest, lat: b.lat }],
109
+ ];
110
+ }
111
+ /**
112
+ * `splitDateLine`, and a split at a pole when the short way between two high-latitude points would cross the pole.
113
+ * Each piece is safe to draw as a straight line on an equirectangular map.
114
+ *
115
+ * @param a - The start.
116
+ * @param b - The end.
117
+ * @returns The pieces, in order.
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * import { splitTrail } from "@johnmorrisdotca/wakusei-planets/ground-track";
122
+ *
123
+ * console.log(splitTrail({ lon: 10, lat: 80 }, { lon: 170, lat: 75 }).length > 1);
124
+ * ```
125
+ */
126
+ export function splitTrail(a, b) {
127
+ let delta = b.lon - a.lon;
128
+ if (delta > 180)
129
+ delta -= 360;
130
+ if (delta < -180)
131
+ delta += 360;
132
+ if (Math.abs(delta) > 90 && Math.abs(a.lat) > 45 && Math.abs(b.lat) > 45 && Math.sign(a.lat) === Math.sign(b.lat)) {
133
+ const pole = a.lat > 0 ? 90 : -90;
134
+ return [...splitDateLine(a, { lon: a.lon, lat: pole }), ...splitDateLine({ lon: b.lon, lat: pole }, b)];
135
+ }
136
+ return splitDateLine(a, b);
137
+ }
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export { drawnTilt, portrait, type PortraitOptions } from "./pose.ts";
5
5
  export { lineSvg, mix, type LineOptions } from "./line.ts";
6
6
  export { ringStrip, type RingStrip } from "./scene/rings.ts";
7
7
  export { embedCode, embedCredit, EMBED_KINDS, lineupCode, lineupCredit, portraitCode, type EmbedKind, type EmbedOptions, type EmbedSettings, type LineupEmbed, type PortraitEmbed } from "./embed.ts";
8
+ export { mercuryTilesCredit, PICTURE_CREDITS, picturesCredit, type PictureCredit } from "./picture-credits.ts";
8
9
  export { addBody, decodeScene, defaultPortrait, encodeScene, PRESETS as PORTRAIT_PRESETS, resolve as layoutPortrait, type Item as PortraitItem, type Placed as PlacedItem, type Portrait, type Preset as PortraitPreset, type Resolved as PortraitLayout } from "./portrait/model.ts";
9
10
  export { LUMINOSITY_CLASSES, STAR_SUN, starLook, type LuminosityClass, type StarLook, type StarNumberName, type StarNumbers, type StarPart, type StarStatus } from "./star.ts";
10
11
  export { starLineSvg } from "./star-line.ts";
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ export { drawnTilt, portrait } from "./pose.js";
5
5
  export { lineSvg, mix } from "./line.js";
6
6
  export { ringStrip } from "./scene/rings.js";
7
7
  export { embedCode, embedCredit, EMBED_KINDS, lineupCode, lineupCredit, portraitCode } from "./embed.js";
8
+ export { mercuryTilesCredit, PICTURE_CREDITS, picturesCredit } from "./picture-credits.js";
8
9
  export { addBody, decodeScene, defaultPortrait, encodeScene, PRESETS as PORTRAIT_PRESETS, resolve as layoutPortrait } from "./portrait/model.js";
9
10
  export { LUMINOSITY_CLASSES, STAR_SUN, starLook } from "./star.js";
10
11
  export { starLineSvg } from "./star-line.js";
@@ -0,0 +1,80 @@
1
+ import { type BodyId } from "../facts.ts";
2
+ import { type GroundPoint } from "../ground-track.ts";
3
+ import { type Vec3 } from "../vec.ts";
4
+ export type PaintLength = "1d" | "1w" | "1m";
5
+ export type PaintSwath = "track" | "coverage";
6
+ /**
7
+ * What to paint: which craft, how long the trail is kept, and whether it is the line under the craft or the ground where it stands 10° up.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * import type { PaintSpec } from "@johnmorrisdotca/wakusei-planets/space/element";
12
+ *
13
+ * const spec: PaintSpec = { id: "lro", length: "1d", swath: "track" };
14
+ * console.log(spec.id);
15
+ * ```
16
+ */
17
+ export interface PaintSpec {
18
+ /** An orbiter id, such as `lro` or `mro`. */
19
+ id: string;
20
+ /** How long the trail is kept, in simulated time. `1d` when left out. */
21
+ length?: PaintLength;
22
+ /** `track` paints the point under the craft (the default). `coverage` paints where it is at least 10° above the horizon. */
23
+ swath?: PaintSwath;
24
+ }
25
+ /** Equirectangular, north at the first row, longitude −180 at the first column. */
26
+ export declare const PAINT_W = 1024;
27
+ export declare const PAINT_H = 512;
28
+ export declare const paintLengthOf: (length: PaintLength | undefined) => PaintLength;
29
+ export declare const paintSwathOf: (swath: PaintSwath | undefined) => PaintSwath;
30
+ /** Ticks since the epoch, in 16 bits. One tick is two minutes, so a month fits in a signed 16-bit age. */
31
+ export declare const paintMinute: (ms: number) => number;
32
+ /**
33
+ * Where a craft is on a body's surface. `eclipticKm` is from the body's centre, ecliptic J2000, the same axes `/orbiters` uses.
34
+ *
35
+ * @param body - The body the craft goes round.
36
+ * @param eclipticKm - The place, in kilometres from the body's centre.
37
+ * @param ms - The instant, so the body has turned under the craft.
38
+ * @returns Longitude, latitude and height.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * import { orientation } from "@johnmorrisdotca/wakusei-planets/painter";
43
+ *
44
+ * console.log(orientation("moon", Date.UTC(2026, 10, 11)).pole.length === 3);
45
+ * ```
46
+ */
47
+ export declare function groundUnder(body: BodyId, eclipticKm: Vec3, ms: number): GroundPoint & {
48
+ heightKm: number;
49
+ };
50
+ export interface PaintTrail {
51
+ readonly data: Uint8Array;
52
+ readonly width: number;
53
+ readonly height: number;
54
+ readonly pixels: number;
55
+ readonly on: boolean;
56
+ readonly length: PaintLength;
57
+ readonly swath: PaintSwath;
58
+ readonly id: string;
59
+ readonly spanMinutes: number;
60
+ set(spec: PaintSpec | null): void;
61
+ clear(): void;
62
+ /**
63
+ * Stamp the ground crossed since the last call, and drop what has fallen out of the length. Returns true when `data` changed and should be uploaded. At rest, or with painting off, false.
64
+ * `periodMs` is one trip of the craft: samples are taken often enough that the line between two follows the orbit, however fast the clock. A clock run backwards fills in the older end of the length.
65
+ */
66
+ step(ms: number, radiusKm: number, sample: (ms: number) => (GroundPoint & {
67
+ heightKm: number;
68
+ }) | null, periodMs?: number): boolean;
69
+ }
70
+ /**
71
+ * The trail buffer. One for a view. `set` with another craft clears what was painted.
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * import { splitDateLine } from "@johnmorrisdotca/wakusei-planets/ground-track";
76
+ *
77
+ * console.log(splitDateLine({ lon: 170, lat: 0 }, { lon: -170, lat: 4 }).length === 2);
78
+ * ```
79
+ */
80
+ export declare function createPaintTrail(): PaintTrail;