@johnmorrisdotca/wakusei-planets 0.15.0 → 0.16.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
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 0.16.0 - 2026-11-05
6
+
7
+ Every body as a journey stop (MODULES-401), for journey planners such as uchusen-rockets' journey mode.
8
+
9
+ - **`JOURNEY_STOPS`**: every body as one row, with its radius, its mean distance from the Sun, its gravitational parameter, its mass and its escape speed, and `stopPlaceAu` for where it is on a date. A body whose pages print no mass has those fields empty.
10
+
3
11
  ## 0.15.0 - 2026-11-04
4
12
 
5
13
  The family's embed panel on the code builder and the portrait builder (MODULES-380).
package/NOTICE.md CHANGED
@@ -10,6 +10,7 @@ No picture is used by the line and shaded looks: they are drawn from numbers.
10
10
  - **Planet positions**: JPL Solar System Dynamics, "Keplerian Elements for Approximate Positions of the Major Planets", Table 1, 1800 AD to 2050 AD (https://ssd.jpl.nasa.gov/planets/approx_pos.html, read 2026-11-02; Pluto from the same page's earlier edition). NASA/JPL content is not subject to copyright in the United States; credit: NASA/JPL-Caltech.
11
11
  - **Moons' orbits**: JPL Solar System Dynamics, "Planetary Satellite Mean Elements" (https://ssd.jpl.nasa.gov/sats/elem/, read 2026-11-02), made into `src/data/orbits.ts` by `scripts/make-moon-data.py`. Credit: NASA/JPL-Caltech; the elements are from R. A. Jacobson and colleagues' ephemerides cited on that page.
12
12
  - **The Moon's position**: the largest terms of the series in Jean Meeus, "Astronomical Algorithms" (2nd edition), chapter 47, written out here as numbers; the mean arguments are the standard ones.
13
+ - **Mass and escape speed** (`JOURNEY_STOPS`): JPL "Planetary Satellite Physical Parameters" (https://ssd.jpl.nasa.gov/sats/phys_par/, read 2026-11-04) for the GM of the Earth, Mars through Pluto and the moons on that page; NASA's Sun, Mercury and Venus fact sheets (https://nssdc.gsfc.nasa.gov/planetary/factsheet/, read 2026-11-04) for those three GM values and the Sun's escape speed; JPL "Planetary Physical Parameters" (https://ssd.jpl.nasa.gov/planets/phys_par.html, read 2026-11-04) for the planets' escape speeds and for the masses of Ceres, Eris, Makemake and Haumea, turned into GM with the CODATA 2018 G that page names. A moon's escape speed is computed from its GM and the radius already in this package. Nereid, Orcus, Quaoar, Gonggong, Sedna, Vanth, Hiʻiaka, Namaka and Dysnomia are left blank: those pages do not print a mass.
13
14
 
14
15
  ## The dwarf planets
15
16
 
package/README.md CHANGED
@@ -13,9 +13,9 @@ A clean line drawing, a shaded realistic drawing, or a painted surface map, with
13
13
 
14
14
  <p align="center"><a href="https://johnmorrisdotca.github.io/wakusei-planets/"><strong>Open the demo →</strong></a> · <a href="https://johnmorrisdotca.github.io/wakusei-planets/embed.html">Embed page</a> · <a href="https://johnmorrisdotca.github.io/wakusei-planets/docs/">Docs</a></p>
15
15
 
16
- <p align="center"><img alt="Jupiter and Saturn drawn in the realistic look, and Saturn as a line drawing" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.15.0/docs/images/hero-desk.png" width="640"></p>
16
+ <p align="center"><img alt="Jupiter and Saturn drawn in the realistic look, and Saturn as a line drawing" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.16.0/docs/images/hero-desk.png" width="640"></p>
17
17
 
18
- <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.15.0/docs/images/lineup-desk.png" width="640"></p>
18
+ <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.16.0/docs/images/lineup-desk.png" width="640"></p>
19
19
 
20
20
  ## One minute
21
21
 
@@ -273,7 +273,7 @@ A body that turns by itself and a moving sky, in HTML:
273
273
 
274
274
  ## The portrait builder
275
275
 
276
- <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.15.0/docs/images/portrait-family.png" width="640"></p>
276
+ <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.16.0/docs/images/portrait-family.png" width="640"></p>
277
277
 
278
278
  [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.
279
279
 
package/dist/element.d.ts CHANGED
@@ -25,7 +25,7 @@ export type WakuseiState = "line" | "loading" | "still" | "live" | "lost" | "una
25
25
  * console.log(TEXTURE_BASE);
26
26
  * ```
27
27
  */
28
- export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.15.0/dist/textures/";
28
+ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.16.0/dist/textures/";
29
29
  /**
30
30
  * 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
31
31
  * never zooms in never fetches them. Set `texture-far-base` on an element to serve them yourself.
@@ -37,7 +37,7 @@ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdot
37
37
  * console.log(TEXTURE_FAR_BASE);
38
38
  * ```
39
39
  */
40
- export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.15.0/textures/";
40
+ export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.16.0/textures/";
41
41
  /**
42
42
  * The `<wakusei-body>` custom element: a body of the solar system, drawn in a look.
43
43
  *
@@ -17,6 +17,19 @@ export declare function kepler(meanAnomaly: number, e: number): number;
17
17
  * ```
18
18
  */
19
19
  export declare function heliocentric(planet: HostId, ms: number): Vec3;
20
+ /**
21
+ * Mean distance from the Sun, in astronomical units: a planet's semi-major axis at J2000, or a dwarf planet's semi-major axis at the epoch of its elements.
22
+ * @param id - A planet or a dwarf planet.
23
+ * @returns The semi-major axis in au.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * import { meanSunAu } from "@johnmorrisdotca/wakusei-planets";
28
+ *
29
+ * console.log(meanSunAu("earth").toFixed(3));
30
+ * ```
31
+ */
32
+ export declare function meanSunAu(id: HostId): number;
20
33
  /**
21
34
  * The Moon's position from the Earth's centre (J2000 ecliptic, kilometres), from the largest terms of Meeus's lunar series.
22
35
  * @param ms - The instant, in milliseconds since 1970.
package/dist/ephemeris.js CHANGED
@@ -95,6 +95,22 @@ export function heliocentric(planet, ms) {
95
95
  const si = Math.sin(I);
96
96
  return [(cw * cn - sw * sn * ci) * x + (-sw * cn - cw * sn * ci) * y, (cw * sn + sw * cn * ci) * x + (-sw * sn + cw * cn * ci) * y, sw * si * x + cw * si * y];
97
97
  }
98
+ /**
99
+ * Mean distance from the Sun, in astronomical units: a planet's semi-major axis at J2000, or a dwarf planet's semi-major axis at the epoch of its elements.
100
+ * @param id - A planet or a dwarf planet.
101
+ * @returns The semi-major axis in au.
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * import { meanSunAu } from "@johnmorrisdotca/wakusei-planets";
106
+ *
107
+ * console.log(meanSunAu("earth").toFixed(3));
108
+ * ```
109
+ */
110
+ export function meanSunAu(id) {
111
+ const dwarf = DWARF_ELEMENTS[id];
112
+ return dwarf !== undefined ? dwarf.a : ELEMENTS[id][0];
113
+ }
98
114
  /**
99
115
  * The Moon's position from the Earth's centre (J2000 ecliptic, kilometres), from the largest terms of Meeus's lunar series.
100
116
  * @param ms - The instant, in milliseconds since 1970.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { BODIES, BODY_IDS, DWARF_IDS, MOONS_OF, PLANET_IDS, ringReach, type BodyFacts, type BodyId, type DwarfId, type Feature, type HostId, type Look, type MoonId, type PlanetId, type RingBand } from "./facts.ts";
2
- export { apparent, moonGeocentric, heliocentric, orbitPath, system, type Apparent, type MoonPlace, type Pose, type System } from "./ephemeris.ts";
2
+ export { apparent, heliocentric, meanSunAu, moonGeocentric, orbitPath, system, type Apparent, type MoonPlace, type Pose, type System } from "./ephemeris.ts";
3
+ export { JOURNEY_STOPS, journeyStop, stopPlaceAu, type JourneyStop } from "./stops.ts";
3
4
  export { drawnTilt, portrait, type PortraitOptions } from "./pose.ts";
4
5
  export { lineSvg, mix, type LineOptions } from "./line.ts";
5
6
  export { ringStrip, type RingStrip } from "./scene/rings.ts";
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { BODIES, BODY_IDS, DWARF_IDS, MOONS_OF, PLANET_IDS, ringReach } from "./facts.js";
2
- export { apparent, moonGeocentric, heliocentric, orbitPath, system } from "./ephemeris.js";
2
+ export { apparent, heliocentric, meanSunAu, moonGeocentric, orbitPath, system } from "./ephemeris.js";
3
+ export { JOURNEY_STOPS, journeyStop, stopPlaceAu } from "./stops.js";
3
4
  export { drawnTilt, portrait } from "./pose.js";
4
5
  export { lineSvg, mix } from "./line.js";
5
6
  export { ringStrip } from "./scene/rings.js";
@@ -0,0 +1,72 @@
1
+ import { type BodyFacts, type BodyId, type HostId } from "./facts.ts";
2
+ import { type Vec3 } from "./vec.ts";
3
+ /**
4
+ * One body, with what a trip needs. `gmKm3s2`, `massKg` and `escapeKmS` are empty together when no page read here gives a mass.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * import { journeyStop, type JourneyStop } from "@johnmorrisdotca/wakusei-planets";
9
+ *
10
+ * const earth: JourneyStop = journeyStop("earth");
11
+ * console.log(earth.sunAu.toFixed(3), earth.escapeKmS);
12
+ * ```
13
+ */
14
+ export interface JourneyStop {
15
+ id: BodyId;
16
+ kind: BodyFacts["kind"];
17
+ /** The body a moon goes round. */
18
+ parent?: HostId;
19
+ name: {
20
+ en: string;
21
+ ja: string;
22
+ };
23
+ /** Equatorial radius in kilometres, the same number as `BODIES` (a moon's mean radius). */
24
+ radiusKm: number;
25
+ /** Mean distance from the Sun in astronomical units. `0` for the Sun. A moon uses its parent's. */
26
+ sunAu: number;
27
+ /** Gravitational parameter, km^3/s^2. Empty when no cited page gives it. */
28
+ gmKm3s2: number | null;
29
+ /** Mass in kilograms, GM / G with CODATA 2018 G. Empty when GM is empty. */
30
+ massKg: number | null;
31
+ /** Escape speed in km/s: the published figure, or `sqrt(2 GM / radius)` for a moon. Empty when GM is empty. */
32
+ escapeKmS: number | null;
33
+ }
34
+ /**
35
+ * Every body, in the same order as `BODY_IDS`: the Sun, the planets, the dwarf planets, then the moons.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * import { BODY_IDS, JOURNEY_STOPS } from "@johnmorrisdotca/wakusei-planets";
40
+ *
41
+ * console.log(JOURNEY_STOPS.length === BODY_IDS.length, JOURNEY_STOPS[0]?.id);
42
+ * ```
43
+ */
44
+ export declare const JOURNEY_STOPS: readonly JourneyStop[];
45
+ /**
46
+ * One body's row.
47
+ * @param id - The body's name.
48
+ * @returns That body's stop.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * import { journeyStop } from "@johnmorrisdotca/wakusei-planets";
53
+ *
54
+ * console.log(journeyStop("titan").parent, journeyStop("titan").gmKm3s2);
55
+ * ```
56
+ */
57
+ export declare function journeyStop(id: BodyId): JourneyStop;
58
+ /**
59
+ * Where a body is in the Sun's frame at an instant, in astronomical units. The Sun is the origin. A moon is its parent plus its offset.
60
+ * @param id - The body's name.
61
+ * @param ms - The instant, in milliseconds since 1970.
62
+ * @returns The position as x, y, z in au.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * import { stopPlaceAu } from "@johnmorrisdotca/wakusei-planets";
67
+ *
68
+ * const [x, y, z] = stopPlaceAu("mars", Date.UTC(2026, 10, 2));
69
+ * console.log(Math.hypot(x, y, z).toFixed(3));
70
+ * ```
71
+ */
72
+ export declare function stopPlaceAu(id: BodyId, ms: number): Vec3;
package/dist/stops.js ADDED
@@ -0,0 +1,144 @@
1
+ // Every body as one row a trip can use. Gravity is typed from pages read on 2026-11-04, never guessed.
2
+ // GM, where a page prints it: JPL "Planetary Satellite Physical Parameters" (https://ssd.jpl.nasa.gov/sats/phys_par/) for the
3
+ // Earth, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto and the moons on that page. NASA fact sheets
4
+ // (https://nssdc.gsfc.nasa.gov/planetary/factsheet/) for the Sun (132,712 × 10^6), Mercury (0.022032 × 10^6) and Venus (0.32486 × 10^6).
5
+ // Ceres, Eris, Makemake and Haumea: the mass on JPL "Planetary Physical Parameters" (https://ssd.jpl.nasa.gov/planets/phys_par.html)
6
+ // times the CODATA 2018 G that page names. Escape speeds for the Sun and those planets are the speeds those pages print.
7
+ // A moon's escape speed is sqrt(2 GM / radius) from this package's radius. Nereid, and the dwarf planets and moons
8
+ // whose pages do not print a mass, are left empty.
9
+ import { heliocentric, meanSunAu, moonVector } from "./ephemeris.js";
10
+ import { BODIES, BODY_IDS } from "./facts.js";
11
+ import { add, scale } from "./vec.js";
12
+ /** The astronomical unit the ephemeris uses, in kilometres. */
13
+ const AU_KM = 149_597_870.7;
14
+ /** CODATA 2018 G, in km^3 kg^-1 s^-2: the value JPL's planetary page names (6.67430 × 10^-11 m^3 kg^-1 s^-2). */
15
+ const G_KM3_PER_KG = 6.6743e-20;
16
+ const mass = (kg) => kg * G_KM3_PER_KG;
17
+ /** GM in km^3/s^2. A body missing here has no published value in the pages above. */
18
+ const GM = {
19
+ sun: 132_712_000_000,
20
+ mercury: 22_032,
21
+ venus: 324_860,
22
+ earth: 398_600.436,
23
+ mars: 42_828.37362,
24
+ jupiter: 126_686_531.9,
25
+ saturn: 37_931_206.23,
26
+ uranus: 5_793_951.3,
27
+ neptune: 6_835_099.97,
28
+ pluto: 869.3,
29
+ ceres: mass(938.416e18),
30
+ eris: mass(16_600e18),
31
+ makemake: mass(3_100e18),
32
+ haumea: mass(4_006e18),
33
+ moon: 4_902.8,
34
+ phobos: 0.0007087,
35
+ deimos: 0.0000962,
36
+ io: 5_959.91547,
37
+ europa: 3_202.7121,
38
+ ganymede: 9_887.83275,
39
+ callisto: 7_179.2834,
40
+ mimas: 2.50349,
41
+ enceladus: 7.21037,
42
+ tethys: 41.21353,
43
+ dione: 73.11607,
44
+ rhea: 153.94175,
45
+ titan: 8_978.1371,
46
+ iapetus: 120.51511,
47
+ miranda: 4.3,
48
+ ariel: 83.5,
49
+ umbriel: 85.1,
50
+ titania: 226.9,
51
+ oberon: 205.3,
52
+ triton: 1_428.49546,
53
+ proteus: 2.58342,
54
+ charon: 106.1,
55
+ nix: 0.0015,
56
+ hydra: 0.002,
57
+ };
58
+ /** Escape speed in km/s, where a page prints one. Anything else is worked out from GM and the radius. */
59
+ const ESCAPE = {
60
+ sun: 617.6,
61
+ mercury: 4.25,
62
+ venus: 10.36,
63
+ earth: 11.19,
64
+ mars: 5.03,
65
+ jupiter: 60.2,
66
+ saturn: 36.09,
67
+ uranus: 21.38,
68
+ neptune: 23.56,
69
+ pluto: 1.21,
70
+ ceres: 0.51,
71
+ eris: 1.36,
72
+ makemake: 0.76,
73
+ haumea: 0.78,
74
+ };
75
+ const stopOf = (id) => {
76
+ const facts = BODIES[id];
77
+ const gm = GM[id] ?? null;
78
+ const host = facts.kind === "moon" ? facts.parent : id === "sun" ? undefined : id;
79
+ return {
80
+ id,
81
+ kind: facts.kind,
82
+ ...(facts.parent === undefined ? {} : { parent: facts.parent }),
83
+ name: facts.name,
84
+ radiusKm: facts.radiusKm,
85
+ sunAu: id === "sun" || host === undefined ? 0 : meanSunAu(host),
86
+ gmKm3s2: gm,
87
+ massKg: gm === null ? null : gm / G_KM3_PER_KG,
88
+ escapeKmS: ESCAPE[id] ?? (gm === null ? null : Math.sqrt((2 * gm) / facts.radiusKm)),
89
+ };
90
+ };
91
+ /**
92
+ * Every body, in the same order as `BODY_IDS`: the Sun, the planets, the dwarf planets, then the moons.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * import { BODY_IDS, JOURNEY_STOPS } from "@johnmorrisdotca/wakusei-planets";
97
+ *
98
+ * console.log(JOURNEY_STOPS.length === BODY_IDS.length, JOURNEY_STOPS[0]?.id);
99
+ * ```
100
+ */
101
+ export const JOURNEY_STOPS = BODY_IDS.map(stopOf);
102
+ const BY_ID = new Map(JOURNEY_STOPS.map((stop) => [stop.id, stop]));
103
+ /**
104
+ * One body's row.
105
+ * @param id - The body's name.
106
+ * @returns That body's stop.
107
+ *
108
+ * @example
109
+ * ```ts
110
+ * import { journeyStop } from "@johnmorrisdotca/wakusei-planets";
111
+ *
112
+ * console.log(journeyStop("titan").parent, journeyStop("titan").gmKm3s2);
113
+ * ```
114
+ */
115
+ export function journeyStop(id) {
116
+ const stop = BY_ID.get(id);
117
+ if (stop === undefined)
118
+ throw new Error(`no stop for ${id}`);
119
+ return stop;
120
+ }
121
+ /**
122
+ * Where a body is in the Sun's frame at an instant, in astronomical units. The Sun is the origin. A moon is its parent plus its offset.
123
+ * @param id - The body's name.
124
+ * @param ms - The instant, in milliseconds since 1970.
125
+ * @returns The position as x, y, z in au.
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * import { stopPlaceAu } from "@johnmorrisdotca/wakusei-planets";
130
+ *
131
+ * const [x, y, z] = stopPlaceAu("mars", Date.UTC(2026, 10, 2));
132
+ * console.log(Math.hypot(x, y, z).toFixed(3));
133
+ * ```
134
+ */
135
+ export function stopPlaceAu(id, ms) {
136
+ if (id === "sun")
137
+ return [0, 0, 0];
138
+ const facts = BODIES[id];
139
+ if (facts.kind !== "moon")
140
+ return heliocentric(id, ms);
141
+ if (facts.parent === undefined)
142
+ throw new Error(`no parent for ${id}`);
143
+ return add(heliocentric(facts.parent, ms), scale(moonVector(id, ms), 1 / AU_KM));
144
+ }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.15.0";
1
+ export declare const VERSION = "0.16.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.15.0";
1
+ export const VERSION = "0.16.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/wakusei-planets",
3
- "version": "0.15.0",
3
+ "version": "0.16.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",