@johnmorrisdotca/wakusei-planets 0.25.0 → 0.26.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,14 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.26.0] - 2026-11-09
6
+
7
+ - **The compressed scale keeps the order of the orbits** (MODULES-742). The Moon was drawn outside Venus's orbit (10 Earth radii out, with the Sun 44 away) and the Earth was not on its own orbit. The Moon is now 3.5 Earth radii out and an astronomical unit is 70 Earth radii; the Sun, the bodies and the orbit lines (the Earth's too) all go through one mapping, `placeBodies` and `orbitLine`, so every body lies on its own orbit line, and the moons of Mars, Jupiter, Saturn, Uranus, Neptune and Pluto are drawn nearer when they would cross the next planet's orbit (`moonDistance`). Tests: every body is on its orbit line at four dates in both scales, and no moon's orbit reaches a neighbouring planet's. `SUN_COMPRESSED` is 70 (was 44) and `MOON_COMPRESSED` 3.5 (was 10).
8
+ - **"Always lit" lights every body** (MODULES-742). It lit only the Earth; the Moon, Venus and the rest stayed dark. `light="lit"` now lights each body (and each moon) from the camera's side; the demo's row is called "Light" (was "Earth's light").
9
+ - **The space view pans and rolls by exactly what the controls say** (MODULES-742). `setView` takes `panX`, `panY` and `roll`: everything in the picture moves by that many CSS pixels at any depth (the window of the projection moves, so near and far bodies do not slide against each other) and a roll turns the picture clockwise about the line of sight. The element is focusable (`tabindex="0"`).
10
+ - **kazoku-ui 0.24** (MODULES-742): Ctrl or Command and a drag, two fingers, and the other gestures of the shared controls. `e2e/gestures-all.demo.ts` runs the shared `checkGestures` on the space view and on the body view (turn, roll, keys, wheel, pinch, every kind of move, fit). Pressing the body already looked at no longer starts the space page's view over, so the two presses of a double press zoom in and out.
11
+ - **The GPU objects of the space view no longer depend on which came first** (MODULES-727). When a painted body's picture arrived it kept the program of its shaded fallback for as long as the body lived, so the number of programs and vertex arrays a body held depended on whether the picture or the first draw came first (a slow machine held up to 40 more). The fallback is freed when the picture is shown. The soak now counts every walk on its own, from a state that is the same each time.
12
+
5
13
  ## [0.25.0] - 2026-11-09
6
14
 
7
15
  - **A star from its numbers** (MODULES-720). `<wakusei-body star="...">` (or the `star` property) draws any star in 3D (`realistic`) or as a line drawing, in the same look system as the planets and through the same shared renderer, from `temperatureK`, `radiusSun`, `luminosityClass`, `rotationDays`, `activity`, `oblateness`, `corona` and `estimated`: the black-body colour, edge darkening, a surface grained by class, boiling granulation, spots, prominences and flares on active stars, gravity darkening on flattened ones, a bloom and a soft corona. `starLook(numbers)`, `starLineSvg(numbers)`, `STAR_SUN` and `LUMINOSITY_CLASSES` in the main entry; `registerStarLook(name, numbers)` and `starLookOf(name)` in `/look`. Every star lists `parts`: measured, estimated, derived or illustrative, in English and Japanese. `quality="low"` is a cheaper star for weak devices (chosen by itself on 2 GB or two cores). The line look draws the Sun, the Earth's orbit and Jupiter's orbit round the star to its size. `embedCode({ star })` writes the code for every kind of page, `embed.html` takes the numbers in its address, and the demo has a star page. The package holds no star catalogue. The Sun is unchanged: `e2e/sun.demo.ts` compares its three shaded frames with pictures drawn before this change and `test/sun-line.test.ts` its line drawing.
package/README.md CHANGED
@@ -15,9 +15,9 @@ A clean line drawing, a shaded realistic drawing, or a painted surface map, with
15
15
 
16
16
  <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>
17
17
 
18
- <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.25.0/docs/images/hero-desk.png" width="640"></p>
18
+ <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.26.0/docs/images/hero-desk.png" width="640"></p>
19
19
 
20
- <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.25.0/docs/images/lineup-desk.png" width="640"></p>
20
+ <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.26.0/docs/images/lineup-desk.png" width="640"></p>
21
21
 
22
22
  ## One minute
23
23
 
@@ -290,7 +290,7 @@ A body that turns by itself and a moving sky, in HTML:
290
290
 
291
291
  ## The portrait builder
292
292
 
293
- <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.25.0/docs/images/portrait-family.png" width="640"></p>
293
+ <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.26.0/docs/images/portrait-family.png" width="640"></p>
294
294
 
295
295
  [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.
296
296
 
@@ -204,6 +204,8 @@ function paint(T, id, context, bases) {
204
204
  const show = (t) => {
205
205
  paintedMaterial.uniforms.uMap.value = t;
206
206
  mesh.material = paintedMaterial;
207
+ // the shaded look was drawn only until the picture came: if it was drawn at all, its program is let go now, so what a body holds does not depend on which came first
208
+ shader.dispose();
207
209
  redraw();
208
210
  };
209
211
  if (wantPainted && paintedMaterial !== undefined && widths[0] !== undefined) {
@@ -9,7 +9,7 @@ import type * as THREE from "three";
9
9
  * console.log(TEXTURE_BASE);
10
10
  * ```
11
11
  */
12
- export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.25.0/dist/textures/";
12
+ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.26.0/dist/textures/";
13
13
  /**
14
14
  * 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
15
15
  * never zooms in never fetches them. Set `texture-far-base` on an element to serve them yourself.
@@ -21,7 +21,7 @@ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdot
21
21
  * console.log(TEXTURE_FAR_BASE);
22
22
  * ```
23
23
  */
24
- export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.25.0/textures/";
24
+ export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.26.0/textures/";
25
25
  export declare const slash: (base: string) => string;
26
26
  export declare function texturePaths(element: Element): {
27
27
  textureBase(): string;
@@ -137,7 +137,7 @@ export declare class WakuseiSpace extends HTMLElement {
137
137
  get light(): SpaceLight;
138
138
  set light(value: SpaceLight);
139
139
  /**
140
- * The shared controls' camera: yaw and tilt turn the view (the Earth's surface moves right for a drag right and up for a drag up), zoom brings the camera in (1 shows the body looked at, less shows the sky round it). Pan is not used. A turn that
140
+ * The shared controls' camera: yaw and tilt turn the view (the Earth's surface moves right for a drag right and up for a drag up), zoom brings the camera in (1 shows the body looked at, less shows the sky round it), `roll` (degrees) turns the picture clockwise about the line of sight, and `panX` and `panY` move everything in the picture by exactly that many CSS pixels (right and down are positive). A turn that
141
141
  * moves nothing on the screen by half a pixel is kept for the next draw but does not cause one unless `final` is true (the default).
142
142
  *
143
143
  * @param view - The controls' yaw and tilt in degrees and zoom.
@@ -147,6 +147,9 @@ export declare class WakuseiSpace extends HTMLElement {
147
147
  yaw: number;
148
148
  tilt: number;
149
149
  zoom: number;
150
+ roll?: number;
151
+ panX?: number;
152
+ panY?: number;
150
153
  }, final?: boolean): void;
151
154
  /** The body the camera looks at (`earth`, `sun`, `moon`, `mercury` to `neptune`, `pluto`): at zoom 1 it fills the view; the yaw and tilt turn the camera round it. */
152
155
  get body(): SpaceBody;
@@ -5,7 +5,7 @@ import { createPainter } from "../scene/painter.js";
5
5
  import { setThreeLoader, takeRenderer } from "../scene/shared.js";
6
6
  import { texturePaths } from "../scene/textures.js";
7
7
  import { AU_IN_EARTH_RADII, EARTH_RADIUS_KM, frameAt, SPACE_PLANETS } from "./frame.js";
8
- import { placeAround, placeMoon, placeSun, radiusIn } from "./scale.js";
8
+ import { moonDistance, placeBodies, radiusIn } from "./scale.js";
9
9
  import { createSpaceItem, FIT_DISTANCE, newSpaceModel, SPACE_BODIES } from "./scene.js";
10
10
  export { setThreeLoader, SPACE_BODIES };
11
11
  const readLight = (value) => (value === "lit" ? "lit" : "sun");
@@ -92,6 +92,8 @@ export class WakuseiSpace extends HTMLElement {
92
92
  this.#model.stepMs = Math.max(1000, Math.abs(this.#speed) * 1000);
93
93
  if (!this.hasAttribute("role"))
94
94
  this.setAttribute("role", "img");
95
+ if (!this.hasAttribute("tabindex"))
96
+ this.setAttribute("tabindex", "0");
95
97
  if (!this.hasAttribute("aria-label"))
96
98
  this.setAttribute("aria-label", "The Earth, the Moon, the Sun and the planets in their places for the date shown");
97
99
  const root = this.shadowRoot ?? this.attachShadow({ mode: "open" });
@@ -241,7 +243,7 @@ export class WakuseiSpace extends HTMLElement {
241
243
  this.#gate?.request();
242
244
  }
243
245
  /**
244
- * The shared controls' camera: yaw and tilt turn the view (the Earth's surface moves right for a drag right and up for a drag up), zoom brings the camera in (1 shows the body looked at, less shows the sky round it). Pan is not used. A turn that
246
+ * The shared controls' camera: yaw and tilt turn the view (the Earth's surface moves right for a drag right and up for a drag up), zoom brings the camera in (1 shows the body looked at, less shows the sky round it), `roll` (degrees) turns the picture clockwise about the line of sight, and `panX` and `panY` move everything in the picture by exactly that many CSS pixels (right and down are positive). A turn that
245
247
  * moves nothing on the screen by half a pixel is kept for the next draw but does not cause one unless `final` is true (the default).
246
248
  *
247
249
  * @param view - The controls' yaw and tilt in degrees and zoom.
@@ -249,14 +251,15 @@ export class WakuseiSpace extends HTMLElement {
249
251
  */
250
252
  setView(view, final = true) {
251
253
  const now = this.#model.view;
252
- if (view.yaw === now.yaw && view.tilt === now.tilt && view.zoom === now.zoom)
254
+ const [roll, panX, panY] = [view.roll ?? 0, view.panX ?? 0, view.panY ?? 0];
255
+ if (view.yaw === now.yaw && view.tilt === now.tilt && view.zoom === now.zoom && roll === now.roll && panX === now.panX && panY === now.panY)
253
256
  return;
254
- this.#model.view = { yaw: view.yaw, tilt: view.tilt, zoom: view.zoom };
255
- this.dispatchEvent(new CustomEvent("wakusei-view", { detail: { yaw: view.yaw, tilt: view.tilt, zoom: view.zoom } }));
257
+ this.#model.view = { yaw: view.yaw, tilt: view.tilt, zoom: view.zoom, roll, panX, panY };
258
+ this.dispatchEvent(new CustomEvent("wakusei-view", { detail: { yaw: view.yaw, tilt: view.tilt, zoom: view.zoom, roll, panX, panY } }));
256
259
  const drawn = this.#model.drawnView;
257
260
  if (drawn && !final && view.zoom === drawn.zoom) {
258
- const turned = Math.max(Math.abs(view.yaw - drawn.yaw), Math.abs(view.tilt - drawn.tilt)) * RAD;
259
- if (turned * (this.#model.heightPx / 2) < 0.5)
261
+ const turned = Math.max(Math.abs(view.yaw - drawn.yaw), Math.abs(view.tilt - drawn.tilt), Math.abs(roll - drawn.roll)) * RAD;
262
+ if (turned * (this.#model.heightPx / 2) < 0.5 && Math.max(Math.abs(panX - drawn.panX), Math.abs(panY - drawn.panY)) < 0.5)
260
263
  return;
261
264
  }
262
265
  this.#gate?.request();
@@ -367,19 +370,19 @@ export class WakuseiSpace extends HTMLElement {
367
370
  if (preset.endsWith("-moons")) {
368
371
  const id = preset.slice(0, -6);
369
372
  const sites = this.#painterNow().moons(id, this.#model.time);
370
- const reach = Math.max(1, ...sites.map((site) => Math.hypot(...site.offset)).filter((r) => r <= 22));
373
+ const reach = Math.max(1, ...sites.map((site) => moonDistance(mode, id, Math.hypot(...site.offset))).filter((r) => r <= 22));
371
374
  const radius = radiusIn(id, mode);
372
375
  return Math.min(1, (FIT_DISTANCE * radius) / ((reach * radius * 1.15) / Math.tan(17.5 * RAD)));
373
376
  }
374
377
  const frame = this.#model.drawn?.frame ?? frameAt(this.#model.time);
375
- const sun = placeSun(mode, frame.sun);
376
- const around = (id) => Math.hypot(...placeAround(mode, sun, [frame.planets[id][0] - frame.sun[0], frame.planets[id][1] - frame.sun[1], frame.planets[id][2] - frame.sun[2]]));
378
+ const places = placeBodies(mode, frame);
379
+ const away = (id) => Math.hypot(...places[id]);
377
380
  const reach = {
378
381
  earth: 0,
379
- moon: Math.hypot(...placeMoon(mode, frame.moon)),
380
- sun: Math.hypot(...sun),
381
- inner: Math.max(around("mercury"), around("venus"), around("mars"), Math.hypot(...sun)),
382
- "solar-system": Math.max(...SPACE_PLANETS.map(around), Math.hypot(...sun)),
382
+ moon: away("moon"),
383
+ sun: away("sun"),
384
+ inner: Math.max(away("mercury"), away("venus"), away("mars"), away("sun")),
385
+ "solar-system": Math.max(...SPACE_PLANETS.map(away), away("sun")),
383
386
  }[preset];
384
387
  return preset === "earth" ? 1 : FIT_DISTANCE / Math.max(FIT_DISTANCE, reach * 3.4);
385
388
  }
@@ -134,9 +134,9 @@ export declare function createTrack(initialStepMs?: number): {
134
134
  setStep(ms: number): void;
135
135
  };
136
136
  /**
137
- * The path a planet takes round the Sun, as `count + 1` points round one trip from where the planet is at `ms`, from the Sun, in astronomical units and the scene's axes.
137
+ * The path a planet or the Earth takes round the Sun, as `count + 1` points round one trip from where the planet is at `ms`, from the Sun, in astronomical units and the scene's axes.
138
138
  *
139
- * @param id - The planet.
139
+ * @param id - The planet or `earth`.
140
140
  * @param ms - The moment the path starts at, in milliseconds since the Unix epoch.
141
141
  * @param count - How many segments to cut the trip into.
142
142
  * @returns `count + 1` points; the last is near the first.
@@ -149,4 +149,4 @@ export declare function createTrack(initialStepMs?: number): {
149
149
  * console.log(points.length);
150
150
  * ```
151
151
  */
152
- export declare function planetOrbit(id: SpacePlanet, ms: number, count?: number): Vec3[];
152
+ export declare function planetOrbit(id: SpacePlanet | "earth", ms: number, count?: number): Vec3[];
@@ -144,11 +144,11 @@ export function createTrack(initialStepMs = 1000) {
144
144
  },
145
145
  };
146
146
  }
147
- const PERIOD_DAYS = { mercury: 87.97, venus: 224.7, mars: 686.98, jupiter: 4332.6, saturn: 10_759, uranus: 30_688, neptune: 60_182, pluto: 90_560 };
147
+ const PERIOD_DAYS = { mercury: 87.97, venus: 224.7, earth: 365.256, mars: 686.98, jupiter: 4332.6, saturn: 10_759, uranus: 30_688, neptune: 60_182, pluto: 90_560 };
148
148
  /**
149
- * The path a planet takes round the Sun, as `count + 1` points round one trip from where the planet is at `ms`, from the Sun, in astronomical units and the scene's axes.
149
+ * The path a planet or the Earth takes round the Sun, as `count + 1` points round one trip from where the planet is at `ms`, from the Sun, in astronomical units and the scene's axes.
150
150
  *
151
- * @param id - The planet.
151
+ * @param id - The planet or `earth`.
152
152
  * @param ms - The moment the path starts at, in milliseconds since the Unix epoch.
153
153
  * @param count - How many segments to cut the trip into.
154
154
  * @returns `count + 1` points; the last is near the first.
@@ -1,4 +1,4 @@
1
1
  export { AU_IN_EARTH_RADII, blend, createTrack, EARTH_RADIUS_KM, frameAt, planetOrbit, SPACE_PLANETS, type SpaceFrame, type SpacePlanet, type SpaceVec3 } from "./frame.ts";
2
- export { compress, MOON_COMPRESSED, placeAround, placeMoon, placeSun, radiusIn, SUN_COMPRESSED, truePosition, type ScaleMode } from "./scale.ts";
2
+ export { compress, MOON_COMPRESSED, moonDistance, orbitLine, placeAround, placeBodies, placeMoon, placeSun, radiusIn, SUN_COMPRESSED, truePosition, type ScaleMode } from "./scale.ts";
3
3
  export { groundDirection } from "./aim.ts";
4
4
  export { RIDE_FOV, ridePose, type RideInput, type RideLook, type RidePose } from "./ride.ts";
@@ -1,5 +1,5 @@
1
1
  // The space view's pure parts: where the bodies are (this package's own models), the two scales and, for riding along, where a camera looks. They import on a server. The element is `@johnmorrisdotca/wakusei-planets/space/element`.
2
2
  export { AU_IN_EARTH_RADII, blend, createTrack, EARTH_RADIUS_KM, frameAt, planetOrbit, SPACE_PLANETS } from "./frame.js";
3
- export { compress, MOON_COMPRESSED, placeAround, placeMoon, placeSun, radiusIn, SUN_COMPRESSED, truePosition } from "./scale.js";
3
+ export { compress, MOON_COMPRESSED, moonDistance, orbitLine, placeAround, placeBodies, placeMoon, placeSun, radiusIn, SUN_COMPRESSED, truePosition } from "./scale.js";
4
4
  export { groundDirection } from "./aim.js";
5
5
  export { RIDE_FOV, ridePose } from "./ride.js";
@@ -1,5 +1,5 @@
1
1
  import type { Vec3 } from "../vec.ts";
2
- import { type SpacePlanet } from "./frame.ts";
2
+ import { type SpaceFrame, type SpacePlanet } from "./frame.ts";
3
3
  /**
4
4
  * The scale the space view is drawn in: `compressed` squeezes the distances so the Moon, the Sun and Neptune fit one view, and `true` keeps the real ones.
5
5
  *
@@ -13,7 +13,7 @@ import { type SpacePlanet } from "./frame.ts";
13
13
  */
14
14
  export type ScaleMode = "compressed" | "true";
15
15
  /**
16
- * The Moon's distance in a compressed view, in Earth radii (the true one is about 60).
16
+ * The Moon's distance in a compressed view, in Earth radii (the true one is about 60). It is well inside the gap between the Earth's orbit and the next one in.
17
17
  *
18
18
  * @example
19
19
  * ```ts
@@ -22,9 +22,9 @@ export type ScaleMode = "compressed" | "true";
22
22
  * console.log(MOON_COMPRESSED);
23
23
  * ```
24
24
  */
25
- export declare const MOON_COMPRESSED = 10;
25
+ export declare const MOON_COMPRESSED = 3.5;
26
26
  /**
27
- * The Sun's distance from the Earth in a compressed view, in Earth radii (the true one is about 23,500). One astronomical unit is this long there.
27
+ * One astronomical unit in a compressed view, in Earth radii (the true one is about 23,500): the Sun is this far from the Earth, and each planet's distance from the Sun is this times its distance in astronomical units to the power 0.45.
28
28
  *
29
29
  * @example
30
30
  * ```ts
@@ -33,7 +33,7 @@ export declare const MOON_COMPRESSED = 10;
33
33
  * console.log(SUN_COMPRESSED);
34
34
  * ```
35
35
  */
36
- export declare const SUN_COMPRESSED = 44;
36
+ export declare const SUN_COMPRESSED = 70;
37
37
  /**
38
38
  * A place in astronomical units from the Earth's centre, at true distance, in Earth radii.
39
39
  *
@@ -78,7 +78,7 @@ export declare function compress(v: Vec3): Vec3;
78
78
  */
79
79
  export declare const placeMoon: (mode: ScaleMode, geo: Vec3) => Vec3;
80
80
  /**
81
- * The Sun, from the Earth's centre: in a compressed view always 44 Earth radii away, in its real direction.
81
+ * The Sun, from the Earth's centre. In a compressed view it is in its real direction at the distance the Earth's orbit has from the Sun there, so the Earth lies on its own orbit.
82
82
  *
83
83
  * @param mode - The scale.
84
84
  * @param geo - The Sun's place in astronomical units from the Earth's centre.
@@ -94,7 +94,7 @@ export declare const placeMoon: (mode: ScaleMode, geo: Vec3) => Vec3;
94
94
  export declare function placeSun(mode: ScaleMode, geo: Vec3): Vec3;
95
95
  /**
96
96
  * A place `helio` astronomical units from the Sun (a planet, or a point on its orbit), round the Sun at `sun`. True: as it is. Compressed: the same direction from
97
- * the Sun, at 44 Earth radii times its distance in astronomical units to the power 0.45, so the Earth's own orbit is the 44 and Neptune's is about 200 (30 times as far, really).
97
+ * the Sun, at `SUN_COMPRESSED` Earth radii times its distance in astronomical units to the power 0.45, so Neptune's orbit is about 4.6 times the Earth's (30 times as far, really).
98
98
  *
99
99
  * @param mode - The scale.
100
100
  * @param sun - Where the Sun is drawn, in Earth radii.
@@ -109,6 +109,7 @@ export declare function placeSun(mode: ScaleMode, geo: Vec3): Vec3;
109
109
  * ```
110
110
  */
111
111
  export declare function placeAround(mode: ScaleMode, sun: Vec3, helio: Vec3): Vec3;
112
+ type BaseBody = "sun" | "earth" | "moon" | SpacePlanet;
112
113
  /**
113
114
  * A body's radius in Earth radii: the real one, or one large enough to see in a compressed view.
114
115
  *
@@ -124,3 +125,55 @@ export declare function placeAround(mode: ScaleMode, sun: Vec3, helio: Vec3): Ve
124
125
  * ```
125
126
  */
126
127
  export declare function radiusIn(id: "sun" | "earth" | "moon" | SpacePlanet, mode: ScaleMode): number;
128
+ /**
129
+ * How far from its planet a moon is drawn, in the planet's radii, when it is really `distance` radii away. True: as it is. Compressed: the same, until the farthest of the planet's moons would
130
+ * reach across the gap to the next planet's orbit; then every moon is drawn nearer, the farthest at about a third of the gap and the nearer ones in the order they are, so no moon's orbit crosses another planet's.
131
+ *
132
+ * @param mode - The scale.
133
+ * @param host - The planet or dwarf planet the moon goes round.
134
+ * @param distance - The moon's distance from the centre of the planet, in the planet's radii.
135
+ * @returns The distance to draw it at, in the planet's radii.
136
+ *
137
+ * @example
138
+ * ```ts
139
+ * import { moonDistance } from "@johnmorrisdotca/wakusei-planets/space";
140
+ *
141
+ * console.log(moonDistance("compressed", "neptune", 222).toFixed(1));
142
+ * ```
143
+ */
144
+ export declare function moonDistance(mode: ScaleMode, host: SpacePlanet, distance: number): number;
145
+ /**
146
+ * Where every body of the view is, in Earth radii from the Earth's centre, at one moment: the Earth at the centre, the Moon, the Sun and the planets. The same mapping places
147
+ * the bodies and the lines of their orbits (`orbitLine`), so a body is always on its own orbit.
148
+ *
149
+ * @param mode - The scale.
150
+ * @param frame - Where everything is, from `frameAt`.
151
+ * @returns The place of each body.
152
+ *
153
+ * @example
154
+ * ```ts
155
+ * import { frameAt, placeBodies } from "@johnmorrisdotca/wakusei-planets/space";
156
+ *
157
+ * const places = placeBodies("compressed", frameAt(Date.UTC(2026, 10, 2)));
158
+ * console.log(Object.keys(places).length);
159
+ * ```
160
+ */
161
+ export declare function placeBodies(mode: ScaleMode, frame: SpaceFrame): Record<BaseBody, Vec3>;
162
+ /**
163
+ * The line of a body's orbit as the view draws it: the points from `planetOrbit` (astronomical units from the Sun) placed round the Sun at `sun` by the same mapping as the bodies.
164
+ *
165
+ * @param mode - The scale.
166
+ * @param sun - Where the Sun is drawn, from `placeSun` or `placeBodies`.
167
+ * @param points - The orbit, from `planetOrbit`.
168
+ * @returns The same points, in Earth radii from the Earth's centre.
169
+ *
170
+ * @example
171
+ * ```ts
172
+ * import { frameAt, orbitLine, placeSun, planetOrbit } from "@johnmorrisdotca/wakusei-planets/space";
173
+ *
174
+ * const ms = Date.UTC(2026, 10, 2);
175
+ * console.log(orbitLine("compressed", placeSun("compressed", frameAt(ms).sun), planetOrbit("earth", ms, 24)).length);
176
+ * ```
177
+ */
178
+ export declare const orbitLine: (mode: ScaleMode, sun: Vec3, points: readonly Vec3[]) => Vec3[];
179
+ export {};
@@ -1,10 +1,12 @@
1
1
  // The two scales the space view can show. The true one is the Earth's radius for a unit and the real distances in it; the compressed one keeps every direction but squeezes the
2
2
  // distances so that the Moon, the Sun and Neptune fit one view. Pure.
3
- import { BODIES } from "../facts.js";
3
+ import { BODIES, MOONS_OF } from "../facts.js";
4
+ import { meanSunAu } from "../ephemeris.js";
5
+ import { moonOffset } from "../scene/orient.js";
4
6
  import { AU_IN_EARTH_RADII, EARTH_RADIUS_KM } from "./frame.js";
5
7
  const MOON_AU = 0.00257;
6
8
  /**
7
- * The Moon's distance in a compressed view, in Earth radii (the true one is about 60).
9
+ * The Moon's distance in a compressed view, in Earth radii (the true one is about 60). It is well inside the gap between the Earth's orbit and the next one in.
8
10
  *
9
11
  * @example
10
12
  * ```ts
@@ -13,9 +15,9 @@ const MOON_AU = 0.00257;
13
15
  * console.log(MOON_COMPRESSED);
14
16
  * ```
15
17
  */
16
- export const MOON_COMPRESSED = 10;
18
+ export const MOON_COMPRESSED = 3.5;
17
19
  /**
18
- * The Sun's distance from the Earth in a compressed view, in Earth radii (the true one is about 23,500). One astronomical unit is this long there.
20
+ * One astronomical unit in a compressed view, in Earth radii (the true one is about 23,500): the Sun is this far from the Earth, and each planet's distance from the Sun is this times its distance in astronomical units to the power 0.45.
19
21
  *
20
22
  * @example
21
23
  * ```ts
@@ -24,7 +26,8 @@ export const MOON_COMPRESSED = 10;
24
26
  * console.log(SUN_COMPRESSED);
25
27
  * ```
26
28
  */
27
- export const SUN_COMPRESSED = 44;
29
+ export const SUN_COMPRESSED = 70;
30
+ const SPREAD = 0.45;
28
31
  const length = (v) => Math.hypot(v[0], v[1], v[2]);
29
32
  const scaled = (v, k) => [v[0] * k, v[1] * k, v[2] * k];
30
33
  /**
@@ -74,7 +77,7 @@ export function compress(v) {
74
77
  */
75
78
  export const placeMoon = (mode, geo) => (mode === "true" ? truePosition(geo) : compress(geo));
76
79
  /**
77
- * The Sun, from the Earth's centre: in a compressed view always 44 Earth radii away, in its real direction.
80
+ * The Sun, from the Earth's centre. In a compressed view it is in its real direction at the distance the Earth's orbit has from the Sun there, so the Earth lies on its own orbit.
78
81
  *
79
82
  * @param mode - The scale.
80
83
  * @param geo - The Sun's place in astronomical units from the Earth's centre.
@@ -91,11 +94,11 @@ export function placeSun(mode, geo) {
91
94
  if (mode === "true")
92
95
  return truePosition(geo);
93
96
  const l = length(geo);
94
- return l === 0 ? [0, 0, 0] : scaled(geo, SUN_COMPRESSED / l);
97
+ return l === 0 ? [0, 0, 0] : scaled(geo, (SUN_COMPRESSED * l ** SPREAD) / l);
95
98
  }
96
99
  /**
97
100
  * A place `helio` astronomical units from the Sun (a planet, or a point on its orbit), round the Sun at `sun`. True: as it is. Compressed: the same direction from
98
- * the Sun, at 44 Earth radii times its distance in astronomical units to the power 0.45, so the Earth's own orbit is the 44 and Neptune's is about 200 (30 times as far, really).
101
+ * the Sun, at `SUN_COMPRESSED` Earth radii times its distance in astronomical units to the power 0.45, so Neptune's orbit is about 4.6 times the Earth's (30 times as far, really).
99
102
  *
100
103
  * @param mode - The scale.
101
104
  * @param sun - Where the Sun is drawn, in Earth radii.
@@ -115,7 +118,7 @@ export function placeAround(mode, sun, helio) {
115
118
  const l = length(helio);
116
119
  if (l === 0)
117
120
  return sun;
118
- const d = (SUN_COMPRESSED * l ** 0.45) / l;
121
+ const d = (SUN_COMPRESSED * l ** SPREAD) / l;
119
122
  return [sun[0] + helio[0] * d, sun[1] + helio[1] * d, sun[2] + helio[2] * d];
120
123
  }
121
124
  /** The sizes a compressed view gives bodies large enough to see, in Earth radii. */
@@ -137,3 +140,96 @@ const COMPRESSED_RADIUS = { sun: 5, earth: 1, moon: 0.9, mercury: 0.5, venus: 0.
137
140
  export function radiusIn(id, mode) {
138
141
  return mode === "true" ? BODIES[id].radiusKm / EARTH_RADIUS_KM : COMPRESSED_RADIUS[id];
139
142
  }
143
+ /** The planets, nearest the Sun first, whose orbits a moon's orbit must not reach across in a compressed view. */
144
+ const ORBIT_ROW = ["mercury", "venus", "earth", "mars", "jupiter", "saturn", "uranus", "neptune", "pluto"];
145
+ const compressedOrbit = (au) => SUN_COMPRESSED * au ** SPREAD;
146
+ /** The room a planet's moons have round it in a compressed view, in Earth radii: well inside the gap to the nearer of the orbits next to its own. */
147
+ function room(host) {
148
+ const at = ORBIT_ROW.indexOf(host);
149
+ if (at < 0)
150
+ return Number.POSITIVE_INFINITY;
151
+ const mine = compressedOrbit(meanSunAu(host));
152
+ const gaps = [ORBIT_ROW[at - 1], ORBIT_ROW[at + 1]].filter((id) => id !== undefined).map((id) => Math.abs(compressedOrbit(meanSunAu(id)) - mine));
153
+ return 0.35 * Math.min(...gaps);
154
+ }
155
+ const reaches = new Map();
156
+ /** How far out a body's moons go, in its radii: the farthest any of them is found in a year of looks. */
157
+ function reachOf(host) {
158
+ let reach = reaches.get(host);
159
+ if (reach === undefined) {
160
+ reach = 0;
161
+ const start = Date.UTC(2026, 0, 1);
162
+ for (const moon of MOONS_OF[host] ?? [])
163
+ for (let i = 0; i < 24; i += 1)
164
+ reach = Math.max(reach, length(moonOffset(moon, start + i * 15 * 86_400_000)));
165
+ reaches.set(host, reach);
166
+ }
167
+ return reach;
168
+ }
169
+ /**
170
+ * How far from its planet a moon is drawn, in the planet's radii, when it is really `distance` radii away. True: as it is. Compressed: the same, until the farthest of the planet's moons would
171
+ * reach across the gap to the next planet's orbit; then every moon is drawn nearer, the farthest at about a third of the gap and the nearer ones in the order they are, so no moon's orbit crosses another planet's.
172
+ *
173
+ * @param mode - The scale.
174
+ * @param host - The planet or dwarf planet the moon goes round.
175
+ * @param distance - The moon's distance from the centre of the planet, in the planet's radii.
176
+ * @returns The distance to draw it at, in the planet's radii.
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * import { moonDistance } from "@johnmorrisdotca/wakusei-planets/space";
181
+ *
182
+ * console.log(moonDistance("compressed", "neptune", 222).toFixed(1));
183
+ * ```
184
+ */
185
+ export function moonDistance(mode, host, distance) {
186
+ if (mode === "true")
187
+ return distance;
188
+ const reach = reachOf(host);
189
+ const radius = radiusIn(host, "compressed");
190
+ const space = room(host);
191
+ if (reach === 0 || reach * radius <= space)
192
+ return distance;
193
+ return Math.min(distance, (space * Math.sqrt(distance / reach)) / radius);
194
+ }
195
+ /**
196
+ * Where every body of the view is, in Earth radii from the Earth's centre, at one moment: the Earth at the centre, the Moon, the Sun and the planets. The same mapping places
197
+ * the bodies and the lines of their orbits (`orbitLine`), so a body is always on its own orbit.
198
+ *
199
+ * @param mode - The scale.
200
+ * @param frame - Where everything is, from `frameAt`.
201
+ * @returns The place of each body.
202
+ *
203
+ * @example
204
+ * ```ts
205
+ * import { frameAt, placeBodies } from "@johnmorrisdotca/wakusei-planets/space";
206
+ *
207
+ * const places = placeBodies("compressed", frameAt(Date.UTC(2026, 10, 2)));
208
+ * console.log(Object.keys(places).length);
209
+ * ```
210
+ */
211
+ export function placeBodies(mode, frame) {
212
+ const sun = placeSun(mode, frame.sun);
213
+ const all = { earth: [0, 0, 0], moon: placeMoon(mode, frame.moon), sun };
214
+ const helio = (geo) => [geo[0] - frame.sun[0], geo[1] - frame.sun[1], geo[2] - frame.sun[2]];
215
+ for (const [id, geo] of Object.entries(frame.planets))
216
+ all[id] = placeAround(mode, sun, helio(geo));
217
+ return all;
218
+ }
219
+ /**
220
+ * The line of a body's orbit as the view draws it: the points from `planetOrbit` (astronomical units from the Sun) placed round the Sun at `sun` by the same mapping as the bodies.
221
+ *
222
+ * @param mode - The scale.
223
+ * @param sun - Where the Sun is drawn, from `placeSun` or `placeBodies`.
224
+ * @param points - The orbit, from `planetOrbit`.
225
+ * @returns The same points, in Earth radii from the Earth's centre.
226
+ *
227
+ * @example
228
+ * ```ts
229
+ * import { frameAt, orbitLine, placeSun, planetOrbit } from "@johnmorrisdotca/wakusei-planets/space";
230
+ *
231
+ * const ms = Date.UTC(2026, 10, 2);
232
+ * console.log(orbitLine("compressed", placeSun("compressed", frameAt(ms).sun), planetOrbit("earth", ms, 24)).length);
233
+ * ```
234
+ */
235
+ export const orbitLine = (mode, sun, points) => points.map((p) => placeAround(mode, sun, p));
@@ -35,7 +35,7 @@ export declare const SPACE_BODIES: readonly ["earth", "sun", "moon", "mercury",
35
35
  */
36
36
  export type SpaceBody = (typeof SPACE_BODIES)[number];
37
37
  /**
38
- * How the Earth is lit: `sun` is the true light; `lit` is daylight from the camera's side, so a view of the night side is never black.
38
+ * How the bodies are lit: `sun` is the true light; `lit` is daylight from the camera's side on every body, so a view of a night side is never black.
39
39
  *
40
40
  * @example
41
41
  * ```ts no-run
@@ -103,6 +103,9 @@ export interface SpaceModel {
103
103
  yaw: number;
104
104
  tilt: number;
105
105
  zoom: number;
106
+ roll: number;
107
+ panX: number;
108
+ panY: number;
106
109
  };
107
110
  /** The home place: the camera starts above it. */
108
111
  centre: {
@@ -141,6 +144,9 @@ export interface SpaceModel {
141
144
  yaw: number;
142
145
  tilt: number;
143
146
  zoom: number;
147
+ roll: number;
148
+ panX: number;
149
+ panY: number;
144
150
  } | null;
145
151
  heightPx: number;
146
152
  camera: {
@@ -5,12 +5,13 @@ import "../bodies/all.js";
5
5
  import { groundDirection } from "./aim.js";
6
6
  import { createTrack, planetOrbit, SPACE_PLANETS } from "./frame.js";
7
7
  import { ridePose } from "./ride.js";
8
- import { placeAround, placeMoon, placeSun, radiusIn } from "./scale.js";
8
+ import { moonDistance, orbitLine, placeBodies, radiusIn } from "./scale.js";
9
9
  const RAD = Math.PI / 180;
10
10
  /** The camera's distance, in radii of the body it looks at, at which that body fills the view at zoom 1. */
11
11
  export const FIT_DISTANCE = 3.4;
12
12
  const FOV = 35;
13
13
  const ORBIT_POINTS = 96;
14
+ const ORBIT_BODIES = ["earth", ...SPACE_PLANETS];
14
15
  /** The moons of a planet are shown once the planet is this many CSS pixels across its radius, and each is drawn at least this many pixels across its radius. */
15
16
  const MOON_MIN_PLANET_PX = 4;
16
17
  const MOON_MIN_PX = 2.2;
@@ -30,7 +31,7 @@ export const SPACE_BODIES = ["earth", "sun", "moon", ...SPACE_PLANETS];
30
31
  export const newSpaceModel = () => ({
31
32
  time: Date.now(),
32
33
  mode: "compressed",
33
- view: { yaw: 0, tilt: 0, zoom: 1 },
34
+ view: { yaw: 0, tilt: 0, zoom: 1, roll: 0, panX: 0, panY: 0 },
34
35
  centre: { lon: 0, lat: 0 },
35
36
  anchor: null,
36
37
  orbits: true,
@@ -107,11 +108,11 @@ export function createSpaceItem(model, deps) {
107
108
  return slot;
108
109
  };
109
110
  const orbits = new Map();
110
- for (const id of SPACE_PLANETS) {
111
+ for (const id of ORBIT_BODIES) {
111
112
  const positions = new Float32Array((ORBIT_POINTS + 1) * 3);
112
113
  const geometry = new three.BufferGeometry();
113
114
  geometry.setAttribute("position", new three.BufferAttribute(positions, 3));
114
- const line = new three.Line(geometry, new three.LineBasicMaterial({ color: BODIES[id].colour, transparent: true, opacity: 0.55 }));
115
+ const line = new three.Line(geometry, new three.LineBasicMaterial({ color: id === "earth" ? "#6aa8ff" : BODIES[id].colour, transparent: true, opacity: 0.55 }));
115
116
  line.frustumCulled = false;
116
117
  scene.add(line);
117
118
  orbits.set(id, { line, positions, samples: [], epoch: Number.NaN });
@@ -135,17 +136,16 @@ export function createSpaceItem(model, deps) {
135
136
  track.setStep(model.stepMs);
136
137
  }
137
138
  const mode = model.mode;
138
- const sunPos = placeSun(mode, frame.sun);
139
- const pos = { earth: [0, 0, 0], moon: placeMoon(mode, frame.moon), sun: sunPos };
140
- for (const id of SPACE_PLANETS)
141
- pos[id] = placeAround(mode, sunPos, minus(frame.planets[id], frame.sun));
139
+ const pos = placeBodies(mode, frame);
140
+ const sunPos = pos.sun;
142
141
  const radiusOf = (id) => radiusIn(id, mode);
143
- const placeAll = (at) => {
144
- const sunAt = placeSun(mode, at.sun);
145
- const all = { earth: [0, 0, 0], moon: placeMoon(mode, at.moon), sun: sunAt };
146
- for (const id of SPACE_PLANETS)
147
- all[id] = placeAround(mode, sunAt, minus(at.planets[id], at.sun));
148
- return all;
142
+ const placeAll = (at) => placeBodies(mode, at);
143
+ // where a moon is round its planet, as the view draws it: in the planet's radii, drawn nearer in a compressed view where the real distance would cross the next planet's orbit
144
+ const moonSite = (id, at, host) => {
145
+ const real = moonOffset(id, at);
146
+ const d = Math.hypot(real[0], real[1], real[2]);
147
+ const k = d === 0 ? 1 : moonDistance(mode, host, d) / d;
148
+ return [real[0] * k, real[1] * k, real[2] * k];
149
149
  };
150
150
  const toSunOf = (id) => unit(minus(frame.sun, id === "earth" ? [0, 0, 0] : id === "moon" ? frame.moon : id === "sun" ? [0, 0, 0] : frame.planets[id]));
151
151
  // 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
@@ -187,8 +187,8 @@ export function createSpaceItem(model, deps) {
187
187
  }
188
188
  else if (typeof t === "string") {
189
189
  const id = t;
190
- const offset = moonOffset(id, model.time);
191
- const later = moonOffset(id, model.time + 1000);
190
+ const offset = moonSite(id, model.time, around);
191
+ const later = moonSite(id, model.time + 1000, around);
192
192
  if (ride.view === "follow") {
193
193
  focusPos = [centre[0] + offset[0] * unitWorld, centre[1] + offset[1] * unitWorld, centre[2] + offset[2] * unitWorld];
194
194
  focusRadius = Math.max(1e-6, (BODIES[id].radiusKm / BODIES[around].radiusKm) * unitWorld);
@@ -265,15 +265,22 @@ export function createSpaceItem(model, deps) {
265
265
  if (k >= 1)
266
266
  model.transition = null;
267
267
  }
268
+ // the controls' roll turns the picture clockwise about the line of sight, and a pan moves everything by that many CSS pixels at any depth: the window of the projection moves the other way
269
+ if (model.view.roll !== 0)
270
+ camera.rotateZ(model.view.roll * RAD);
268
271
  camera.fov = fovNow;
269
272
  camera.aspect = size.width / Math.max(1, size.height);
273
+ if (model.view.panX !== 0 || model.view.panY !== 0)
274
+ camera.setViewOffset(size.width, size.height, -model.view.panX, -model.view.panY, size.width, size.height);
275
+ else
276
+ camera.clearViewOffset();
270
277
  camera.updateProjectionMatrix();
271
278
  camera.updateMatrixWorld();
272
279
  const hiddenBody = rideFrom?.hiddenBody ?? null;
273
280
  const hiddenMoon = rideFrom?.hiddenMoon ?? null;
274
281
  model.camera = { position: [camera.position.x, camera.position.y, camera.position.z], fov: fovNow };
275
282
  model.pose = { p: [camera.position.x, camera.position.y, camera.position.z], q: [camera.quaternion.x, camera.quaternion.y, camera.quaternion.z, camera.quaternion.w], fov: fovNow, valid: true };
276
- model.drawnView = { yaw: model.view.yaw, tilt: model.view.tilt, zoom: model.view.zoom };
283
+ model.drawnView = { yaw: model.view.yaw, tilt: model.view.tilt, zoom: model.view.zoom, roll: model.view.roll, panX: model.view.panX, panY: model.view.panY };
277
284
  model.heightPx = size.height;
278
285
  // how many pixels across each body is: for the pictures it needs and for what is chosen
279
286
  const half = Math.tan((fovNow / 2) * RAD);
@@ -304,13 +311,13 @@ export function createSpaceItem(model, deps) {
304
311
  drawing.object.scale.setScalar(radiusOf(id));
305
312
  if (drawing.billboard)
306
313
  drawing.object.quaternion.copy(camera.quaternion);
307
- const lit = id === "earth" && model.light === "lit";
308
- const toSun = lit ? unit([camera.position.x, camera.position.y, camera.position.z]) : toSunOf(id);
314
+ const lit = id !== "sun" && model.light === "lit";
315
+ const toSun = lit ? unit([camera.position.x - pos[id][0], camera.position.y - pos[id][1], camera.position.z - pos[id][2]]) : toSunOf(id);
309
316
  drawing.update({ toSun, ms: model.time, radiusPx: px[id] });
310
317
  }
311
318
  model.painted.bodies = paintedBodies;
312
- // the planets' orbits round the Sun
313
- for (const id of SPACE_PLANETS) {
319
+ // the orbits round the Sun, placed by the same mapping as the bodies
320
+ for (const id of ORBIT_BODIES) {
314
321
  const o = orbits.get(id);
315
322
  o.line.visible = model.orbits;
316
323
  if (!model.orbits)
@@ -319,11 +326,11 @@ export function createSpaceItem(model, deps) {
319
326
  o.samples = planetOrbit(id, model.time, ORBIT_POINTS);
320
327
  o.epoch = model.time;
321
328
  }
329
+ const line = orbitLine(mode, sunPos, o.samples);
322
330
  for (let i = 0; i <= ORBIT_POINTS; i += 1) {
323
- const p = placeAround(mode, sunPos, o.samples[i]);
324
- o.positions[i * 3] = p[0];
325
- o.positions[i * 3 + 1] = p[1];
326
- o.positions[i * 3 + 2] = p[2];
331
+ o.positions[i * 3] = line[i][0];
332
+ o.positions[i * 3 + 1] = line[i][1];
333
+ o.positions[i * 3 + 2] = line[i][2];
327
334
  }
328
335
  o.line.geometry.getAttribute("position").needsUpdate = true;
329
336
  }
@@ -336,7 +343,9 @@ export function createSpaceItem(model, deps) {
336
343
  continue;
337
344
  const radius = radiusOf(id);
338
345
  for (const site of deps.painter().moons(id, model.time)) {
339
- const at = [pos[id][0] + site.offset[0] * radius, pos[id][1] + site.offset[1] * radius, pos[id][2] + site.offset[2] * radius];
346
+ const reach = Math.hypot(site.offset[0], site.offset[1], site.offset[2]);
347
+ const k = reach === 0 ? 1 : moonDistance(mode, id, reach) / reach;
348
+ const at = [pos[id][0] + site.offset[0] * k * radius, pos[id][1] + site.offset[1] * k * radius, pos[id][2] + site.offset[2] * k * radius];
340
349
  projected.set(at[0], at[1], at[2]).project(camera);
341
350
  if (projected.z > 1 || Math.abs(projected.x) > 1.25 || Math.abs(projected.y) > 1.25)
342
351
  continue;
@@ -358,7 +367,7 @@ export function createSpaceItem(model, deps) {
358
367
  drawing.object.position.set(at[0], at[1], at[2]);
359
368
  drawing.object.scale.setScalar(drawn);
360
369
  const moonPx = away <= drawn * 1.001 ? 1e5 : ((size.height / 2) * (drawn / Math.sqrt(away * away - drawn * drawn))) / half;
361
- drawing.update({ toSun: toSunOf(id), ms: model.time, radiusPx: moonPx });
370
+ drawing.update({ toSun: model.light === "lit" ? unit([camera.position.x - at[0], camera.position.y - at[1], camera.position.z - at[2]]) : toSunOf(id), ms: model.time, radiusPx: moonPx });
362
371
  }
363
372
  }
364
373
  let soonest = Number.POSITIVE_INFINITY;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.25.0";
1
+ export declare const VERSION = "0.26.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "0.25.0";
1
+ export const VERSION = "0.26.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/wakusei-planets",
3
- "version": "0.25.0",
3
+ "version": "0.26.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",
@@ -385,7 +385,7 @@
385
385
  },
386
386
  "packageManager": "pnpm@10.28.0",
387
387
  "dependencies": {
388
- "@johnmorrisdotca/kazoku-ui": "^0.22.0"
388
+ "@johnmorrisdotca/kazoku-ui": "^0.24.0"
389
389
  },
390
390
  "peerDependencies": {
391
391
  "@johnmorrisdotca/chikyu-earth": ">=0.10.0",