@johnmorrisdotca/wakusei-planets 0.76.0 → 0.77.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,10 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.77.0] - 2026-11-25
6
+
7
+ - **`space.pathOf` gives a body's path over a stretch of time** (MODULES-1790). `pathOf(id, from, to, { steps, about })` returns the body's places on the screen from `from` to `to` (`steps` + 1 points, 96 by default, 1 to 512), each `{ ms, x, y, behind }` in CSS pixels in the element as `placeOf` has them, in the view's own scale (squeezed or true) and from the camera as it is now, so a page can draw a track that lies in the picture. A moon's path is taken round its planet by default (`about`), so the Moon's fortnight is a ring round the Earth; `about: null` is the line the body itself travels. It is worked out when asked from the last draw; nothing is drawn or stored for it. The Sun, the planets, the Moon, the other major bodies and the moons of the planets are placed; any other name gives an empty list. `BodyPathPoint` is exported with `BodyPlace`. The demo's space page has a Path row (a fortnight or a month, on the body in the middle). Tests: `test/body-path.test.ts` (the Moon's offset over the fortnight sweeps the 191.8 degrees an independent ephemeris gives), `e2e/body-path.demo.ts` (the path's middle is where the view draws the Moon at five moments, and a sidereal month closes the ring).
8
+
5
9
  ## [0.76.0] - 2026-11-24
6
10
 
7
11
  - **Ganymede, Callisto and Io have their poles** (MODULES-1821). Their pictures were the USGS Mercator sheets between 57 degrees north and south, with the poles faded into a band. They are now made from the USGS global mosaics of Voyager and Galileo images, with the poles (Ganymede: the grey 1 km mosaic for the relief and the colour mosaic for the colour; Callisto: the 1 km mosaic; Io: the colour merge at 1 km). Ground that was never photographed, or only at low resolution, is painted to continue the photographed ground, and the credit says so.
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.76.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.77.0/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.76.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.77.0/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
 
@@ -514,7 +514,7 @@ Each guide has a Japanese twin in [docs/guides/ja](docs/guides/ja/getting-starte
514
514
  | [A name on the body](docs/guides/name-on-the-body.md) | The body's name written on its globe: looks, how many, where, facing you, the font |
515
515
  | [Why two packages](docs/guides/two-packages.md) | This package and chikyu-earth: which to install, alone or together |
516
516
  | [Moons and time](docs/guides/moons-and-time.md) | The sky on a date, time that runs fast |
517
- | [The space view](docs/guides/space-view.md) | The Earth, Moon, Sun and planets in their places; two scales; time both ways |
517
+ | [The space view](docs/guides/space-view.md) | The Earth, Moon, Sun and planets in their places; two scales; time both ways; `pathOf` draws a body's path over a stretch of time |
518
518
  | [A star from its numbers](docs/guides/star-look.md) | Any star in 3D or as lines, what is measured and what is drawn, every way to put it in a page |
519
519
  | [The size line-up](docs/guides/size-lineup.md) | The Sun and the largest stars at true relative size, with each radius, its error and its paper, where the papers disagree, every way to put it in a page |
520
520
  | [Flat maps of any planet or moon](docs/guides/flat.md) | Any planet or moon on a flat map, as a photo or a line map: day and night with the sunrise line, the sites and named features, the Moon's and Mars's orbiters moving with their coverage and ground tracks, marks of your own, the same attributes, key and events as the Earth's flat map |
@@ -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.76.0) [Computer software]. https://github.com/johnmorrisdotca/wakusei-planets
583
+ > Morris, J. (2026). *Wakusei Planets* (version 0.77.0) [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
 
@@ -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.76.0/dist/textures/";
14
+ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.77.0/dist/textures/";
15
15
  /**
16
16
  * Where the sharpest surface pictures are: the files of this exact version in the repository, on jsDelivr's GitHub address. The npm package holds only the two smaller widths, so a page that
17
17
  * never zooms in never fetches them. Set `texture-far-base` on an element to serve them yourself.
@@ -23,7 +23,7 @@ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdot
23
23
  * console.log(TEXTURE_FAR_BASE);
24
24
  * ```
25
25
  */
26
- export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.76.0/textures/";
26
+ export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.77.0/textures/";
27
27
  /**
28
28
  * Where the finer map tiles are by default: the demo site's `tiles/` folder (GitHub Pages sends `access-control-allow-origin: *`). The tiles are made by `scripts/make-body-tiles.py` and are in no package and no repository:
29
29
  * a page that serves its own gives the folder in the `tiles` attribute, and `tiles="off"` turns them off. A page that sets `texture-base` (it serves its own pictures) has none unless it says where they are.
@@ -21,7 +21,7 @@ import { type Place } from "../places.ts";
21
21
  import { type PlaceLayer } from "../place-marks.ts";
22
22
  import { type EarthPlace, type EarthPlaceLook, type EarthPlaceMark } from "../scene/earth-places.ts";
23
23
  import { type PlaceOnBody, type PlaceOnBodyMark } from "../scene/body-places.ts";
24
- import { SPACE_BODIES, type BodyPlace, type RidePoint, type RideState, type RideTarget, type SpaceBody, type SpaceLight } from "./scene.ts";
24
+ import { SPACE_BODIES, type BodyPathPoint, type BodyPlace, type RidePoint, type RideState, type RideTarget, type SpaceBody, type SpaceLight } from "./scene.ts";
25
25
  import { type PaintSpec } from "../paint/trail.ts";
26
26
  export type { PaintSpec };
27
27
  export { setPlacesLoader } from "../scene/place-layer.ts";
@@ -29,7 +29,7 @@ export { EARTH_PLACE_LOOKS, EARTH_PLACE_MARKS, type EarthPlace, type EarthPlaceC
29
29
  export type { PlaceOnBody, PlaceOnBodyMark } from "../scene/body-places.ts";
30
30
  export { setThreeLoader, SPACE_BODIES, type RidePoint, type RideTarget, type Sight, type SightEdge, type SpaceBody, type SpaceLight };
31
31
  /** Where a body is on the screen, in CSS pixels in the element: its centre and its radius. */
32
- export type { BodyPlace };
32
+ export type { BodyPathPoint, BodyPlace };
33
33
  /**
34
34
  * What a body behind another gets: `hide` (fade its name and ring out), `arrow` (a quiet arrow on the disc's edge) or `name` (draw it over the disc).
35
35
  *
@@ -973,6 +973,32 @@ export declare class WakuseiSpace extends HTMLElement {
973
973
  pair: string | null;
974
974
  };
975
975
  };
976
+ /**
977
+ * Where a body is, on the screen, over a stretch of time: the path it takes between two moments, in the view's own scale (the squeezed one or true distances) and as the camera sees it now, so a page can draw a track
978
+ * that lies in the picture (the Moon's path round the Earth over a fortnight). The points run from `from` to `to`, `steps` + 1 of them (96 by default, from 1 to 512), each in CSS pixels in the element as `placeOf` has them;
979
+ * one where the body is behind the camera has `behind` true and no place. `about` names the body the path is taken round: each place is the body's offset from `about` at that moment, put where `about` is now. A moon's
980
+ * default is its planet (a ring round it, as its orbit is drawn, whatever the planet does meanwhile) and anything else's is none (the line it travels, as the camera sees it); `about: null` asks for none of a moon too.
981
+ * Worked out when asked, from the last draw: nothing is drawn or stored for it, so it costs nothing while it is not called. The Sun, the planets, the Moon and the other major bodies and the moons of the planets are
982
+ * placed; any other id, or a call before the first draw, gives an empty list. The path is of the view as it is now: a camera that turns or moves gives another.
983
+ *
984
+ * @param id - A body's name (`moon`, `mars`, `io`).
985
+ * @param from - The first moment, in milliseconds since 1970.
986
+ * @param to - The last moment.
987
+ * @param options - `steps` (how many steps between the two moments) and `about` (the body the path is taken round).
988
+ * @returns The points, oldest first.
989
+ *
990
+ * @example
991
+ * ```ts
992
+ * const space = document.querySelector("wakusei-space")!;
993
+ * const day = 86_400_000;
994
+ * const track = space.pathOf("moon", space.time - 7 * day, space.time + 7 * day);
995
+ * console.log(track.length); // 97 once the view has drawn
996
+ * ```
997
+ */
998
+ pathOf(id: BodyId, from: number, to: number, options?: {
999
+ steps?: number;
1000
+ about?: BodyId | null;
1001
+ }): BodyPathPoint[];
976
1002
  /** Where a body is on the screen now: its centre and radius in CSS pixels in the element, or `null` when it is behind the camera or not drawn. */
977
1003
  placeOf(id: BodyId): BodyPlace | null;
978
1004
  /**
@@ -3050,6 +3050,36 @@ export class WakuseiSpace extends HTMLElement {
3050
3050
  const words = SCALE_WORDS[this.getAttribute("lang") === "ja" ? "ja" : "en"];
3051
3051
  this.#scaleLine.textContent = this.#scaleNames[this.#model.mode] ?? words[this.#model.mode];
3052
3052
  }
3053
+ /**
3054
+ * Where a body is, on the screen, over a stretch of time: the path it takes between two moments, in the view's own scale (the squeezed one or true distances) and as the camera sees it now, so a page can draw a track
3055
+ * that lies in the picture (the Moon's path round the Earth over a fortnight). The points run from `from` to `to`, `steps` + 1 of them (96 by default, from 1 to 512), each in CSS pixels in the element as `placeOf` has them;
3056
+ * one where the body is behind the camera has `behind` true and no place. `about` names the body the path is taken round: each place is the body's offset from `about` at that moment, put where `about` is now. A moon's
3057
+ * default is its planet (a ring round it, as its orbit is drawn, whatever the planet does meanwhile) and anything else's is none (the line it travels, as the camera sees it); `about: null` asks for none of a moon too.
3058
+ * Worked out when asked, from the last draw: nothing is drawn or stored for it, so it costs nothing while it is not called. The Sun, the planets, the Moon and the other major bodies and the moons of the planets are
3059
+ * placed; any other id, or a call before the first draw, gives an empty list. The path is of the view as it is now: a camera that turns or moves gives another.
3060
+ *
3061
+ * @param id - A body's name (`moon`, `mars`, `io`).
3062
+ * @param from - The first moment, in milliseconds since 1970.
3063
+ * @param to - The last moment.
3064
+ * @param options - `steps` (how many steps between the two moments) and `about` (the body the path is taken round).
3065
+ * @returns The points, oldest first.
3066
+ *
3067
+ * @example
3068
+ * ```ts
3069
+ * const space = document.querySelector("wakusei-space")!;
3070
+ * const day = 86_400_000;
3071
+ * const track = space.pathOf("moon", space.time - 7 * day, space.time + 7 * day);
3072
+ * console.log(track.length); // 97 once the view has drawn
3073
+ * ```
3074
+ */
3075
+ pathOf(id, from, to, options = {}) {
3076
+ if (!Number.isFinite(from) || !Number.isFinite(to) || findBody(id) === undefined)
3077
+ return [];
3078
+ const steps = options.steps;
3079
+ const count = Math.max(1, Math.min(512, Math.round(steps !== undefined && Number.isFinite(steps) ? steps : 96)));
3080
+ const about = options.about === undefined ? (id === "moon" ? "earth" : (hostOf(id) ?? null)) : options.about;
3081
+ return this.#model.bodyPath(id, Array.from({ length: count + 1 }, (_, i) => from + ((to - from) * i) / count), about);
3082
+ }
3053
3083
  /** Where a body is on the screen now: its centre and radius in CSS pixels in the element, or `null` when it is behind the camera or not drawn. */
3054
3084
  placeOf(id) {
3055
3085
  const at = this.#places?.[id];
@@ -267,6 +267,8 @@ export interface SpaceModel {
267
267
  };
268
268
  /** The orbit lines on the screen as the last draw left them (every kind, the catalogue moons' too), for a hover and a press; with `only`, the one line of that key. */
269
269
  orbitPaths: (only?: string) => ScreenLine[];
270
+ /** A body's places at the moments given, on the screen of the last draw, in the scale and the camera drawn (`space.pathOf` asks it). Empty before the first draw and for a body this view does not place. */
271
+ bodyPath: (id: BodyId, times: readonly number[], about: BodyId | null) => BodyPathPoint[];
270
272
  /** The arrowheads on the orbit lines at the last draw, by line: where each is and the way it points. */
271
273
  arrows: Record<string, OrbitArrow[]>;
272
274
  /** Help mode: draw, on the body looked at, the axis it turns about and a curved arrow showing which way it turns. */
@@ -485,6 +487,24 @@ export interface BodyPlace {
485
487
  /** The id of the nearer body whose disc covers this body's place on the screen, when one does. */
486
488
  behind?: string;
487
489
  }
490
+ /**
491
+ * One point of a body's path over a window of time, on the screen: `x` and `y` in CSS pixels in the element, as `placeOf` has them. `behind` is true (and `x`, `y` are NaN) where the body, at that moment, is behind the camera.
492
+ *
493
+ * @example
494
+ * ```ts
495
+ * import type { BodyPathPoint } from "@johnmorrisdotca/wakusei-planets/space/element";
496
+ *
497
+ * const point: BodyPathPoint = { ms: Date.UTC(2026, 10, 2), x: 320, y: 200, behind: false };
498
+ * console.log(point.behind);
499
+ * ```
500
+ */
501
+ export interface BodyPathPoint {
502
+ /** The moment, in milliseconds since 1970. */
503
+ ms: number;
504
+ x: number;
505
+ y: number;
506
+ behind: boolean;
507
+ }
488
508
  export interface SpaceDeps {
489
509
  painter: () => WakuseiPainter;
490
510
  /** The view's sources (the data door): small bodies are drawn as points from it. Left out, none are. */
@@ -163,6 +163,7 @@ export const newSpaceModel = () => ({
163
163
  tiles: { requested: 0, loading: 0, failed: 0, shown: null },
164
164
  rings: { drawn: [], miss: {}, hidden: [], faded: [], fade: { crowd: 0, outness: 0, opacity: LINE_OPACITY } },
165
165
  orbitPaths: () => [],
166
+ bodyPath: () => [],
166
167
  arrows: {},
167
168
  help: false,
168
169
  helpThrough: false,
@@ -556,6 +557,31 @@ export function createSpaceItem(model, deps) {
556
557
  placed[id] = minus(placed[id], origin);
557
558
  return placed;
558
559
  };
560
+ // a body's path over a window: its place at each moment as the view places it now (the same scale, the same origin and the same camera as this draw), worked out when asked. With `about`, each place is
561
+ // taken from where that body is at the same moment and put where that body is now, so a moon's path is a ring round its planet and not the line the planet itself travels
562
+ model.bodyPath = (id, times, about) => {
563
+ const siteOf = (who, ms) => {
564
+ const placed = placeAll(frameAt(ms));
565
+ if (SPACE_BODIES.includes(who))
566
+ return placed[who];
567
+ const host = hostOf(who);
568
+ if (host === undefined)
569
+ return null;
570
+ const offset = moonSite(who, ms, host);
571
+ const hostRadius = radiusOf(host);
572
+ return [placed[host][0] + offset[0] * hostRadius, placed[host][1] + offset[1] * hostRadius, placed[host][2] + offset[2] * hostRadius];
573
+ };
574
+ if (siteOf(id, model.time) === null)
575
+ return [];
576
+ const anchor = about === null ? null : siteOf(about, model.time);
577
+ return times.map((ms) => {
578
+ const site = siteOf(id, ms);
579
+ const base = anchor === null ? null : siteOf(about, ms);
580
+ const at = base === null || anchor === null ? site : [site[0] - base[0] + anchor[0], site[1] - base[1] + anchor[1], site[2] - base[2] + anchor[2]];
581
+ const spot = labelFor(at);
582
+ return spot ? { ms, x: spot.x, y: spot.y, behind: false } : { ms, x: Number.NaN, y: Number.NaN, behind: true };
583
+ });
584
+ };
559
585
  const toSunOf = (id) => unit(minus(frame.sun, id === "earth" ? [0, 0, 0] : id === "moon" ? frame.moon : id === "sun" ? [0, 0, 0] : SPACE_DWARFS.includes(id) ? frame.dwarfs[id] : SPACE_MINORS.includes(id) ? frame.minors[id] : frame.planets[id]));
560
586
  // riding along: the camera sits at a moving point and looks at the body it goes round (a moon over its planet, a point over any body). The point's place and way of going are in radii of
561
587
  // that body, from its centre; the body is drawn at `centre` with the radius `unitWorld`, so the same numbers place the camera in the scene.
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.76.0";
1
+ export declare const VERSION = "0.77.0";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // The published package version. Snippets and texture addresses name it. test/version.test.ts keeps it equal to package.json.
2
- export const VERSION = "0.76.0";
2
+ export const VERSION = "0.77.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/wakusei-planets",
3
- "version": "0.76.0",
3
+ "version": "0.77.0",
4
4
  "description": "Wakusei Planets 惑星 — The Sun, planets and moons for the web: each as a clean line drawing, a shaded realistic drawing or a painted surface map, with real sizes, axial tilt and rotation as data, and positions of the moons for any date and time. SVG for the lines, three.js (optional) for the rest.",
5
5
  "keywords": [
6
6
  "planets",