@johnmorrisdotca/wakusei-planets 0.67.0 → 0.68.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.
Files changed (250) hide show
  1. package/CHANGELOG.md +13 -2
  2. package/NOTICE.md +10 -0
  3. package/README.md +3 -3
  4. package/dist/data/moon-catalogue.d.ts +1 -1
  5. package/dist/data/moon-catalogue.js +1 -1
  6. package/dist/data/places-added.d.ts +2 -0
  7. package/dist/data/places-added.js +2 -0
  8. package/dist/data/places-aliases.d.ts +1 -0
  9. package/dist/data/places-aliases.js +14 -0
  10. package/dist/data/places-planned.js +1 -1
  11. package/dist/data/places-search-67p.d.ts +1 -0
  12. package/dist/data/places-search-67p.js +3 -0
  13. package/dist/data/places-search-amalthea.d.ts +1 -0
  14. package/dist/data/places-search-amalthea.js +3 -0
  15. package/dist/data/places-search-ariel.d.ts +1 -0
  16. package/dist/data/places-search-ariel.js +3 -0
  17. package/dist/data/places-search-bennu.d.ts +1 -0
  18. package/dist/data/places-search-bennu.js +3 -0
  19. package/dist/data/places-search-bodies.d.ts +25 -0
  20. package/dist/data/places-search-bodies.js +125 -0
  21. package/dist/data/places-search-callisto.d.ts +1 -0
  22. package/dist/data/places-search-callisto.js +3 -0
  23. package/dist/data/places-search-ceres.d.ts +1 -0
  24. package/dist/data/places-search-ceres.js +3 -0
  25. package/dist/data/places-search-charon.d.ts +1 -0
  26. package/dist/data/places-search-charon.js +3 -0
  27. package/dist/data/places-search-dactyl.d.ts +1 -0
  28. package/dist/data/places-search-dactyl.js +3 -0
  29. package/dist/data/places-search-deimos.d.ts +1 -0
  30. package/dist/data/places-search-deimos.js +3 -0
  31. package/dist/data/places-search-didymos.d.ts +1 -0
  32. package/dist/data/places-search-didymos.js +3 -0
  33. package/dist/data/places-search-dimorphos.d.ts +1 -0
  34. package/dist/data/places-search-dimorphos.js +3 -0
  35. package/dist/data/places-search-dinkinesh.d.ts +1 -0
  36. package/dist/data/places-search-dinkinesh.js +3 -0
  37. package/dist/data/places-search-dione.d.ts +1 -0
  38. package/dist/data/places-search-dione.js +3 -0
  39. package/dist/data/places-search-donaldjohanson.d.ts +1 -0
  40. package/dist/data/places-search-donaldjohanson.js +3 -0
  41. package/dist/data/places-search-enceladus.d.ts +1 -0
  42. package/dist/data/places-search-enceladus.js +3 -0
  43. package/dist/data/places-search-epimetheus.d.ts +1 -0
  44. package/dist/data/places-search-epimetheus.js +3 -0
  45. package/dist/data/places-search-eros.d.ts +1 -0
  46. package/dist/data/places-search-eros.js +3 -0
  47. package/dist/data/places-search-europa.d.ts +1 -0
  48. package/dist/data/places-search-europa.js +3 -0
  49. package/dist/data/places-search-ganymede.d.ts +1 -0
  50. package/dist/data/places-search-ganymede.js +3 -0
  51. package/dist/data/places-search-gaspra.d.ts +1 -0
  52. package/dist/data/places-search-gaspra.js +3 -0
  53. package/dist/data/places-search-hyperion.d.ts +1 -0
  54. package/dist/data/places-search-hyperion.js +3 -0
  55. package/dist/data/places-search-iapetus.d.ts +1 -0
  56. package/dist/data/places-search-iapetus.js +3 -0
  57. package/dist/data/places-search-ida.d.ts +1 -0
  58. package/dist/data/places-search-ida.js +3 -0
  59. package/dist/data/places-search-io.d.ts +1 -0
  60. package/dist/data/places-search-io.js +3 -0
  61. package/dist/data/places-search-itokawa.d.ts +1 -0
  62. package/dist/data/places-search-itokawa.js +3 -0
  63. package/dist/data/places-search-janus.d.ts +1 -0
  64. package/dist/data/places-search-janus.js +3 -0
  65. package/dist/data/places-search-jupiter.d.ts +1 -0
  66. package/dist/data/places-search-jupiter.js +3 -0
  67. package/dist/data/places-search-lutetia.d.ts +1 -0
  68. package/dist/data/places-search-lutetia.js +3 -0
  69. package/dist/data/places-search-mars.d.ts +1 -0
  70. package/dist/data/places-search-mars.js +3 -0
  71. package/dist/data/places-search-mathilde.d.ts +1 -0
  72. package/dist/data/places-search-mathilde.js +3 -0
  73. package/dist/data/places-search-mercury.d.ts +1 -0
  74. package/dist/data/places-search-mercury.js +3 -0
  75. package/dist/data/places-search-mimas.d.ts +1 -0
  76. package/dist/data/places-search-mimas.js +3 -0
  77. package/dist/data/places-search-miranda.d.ts +1 -0
  78. package/dist/data/places-search-miranda.js +3 -0
  79. package/dist/data/places-search-moon-satellites.d.ts +1 -0
  80. package/dist/data/places-search-moon-satellites.js +3 -0
  81. package/dist/data/places-search-moon.d.ts +1 -0
  82. package/dist/data/places-search-moon.js +3 -0
  83. package/dist/data/places-search-oberon.d.ts +1 -0
  84. package/dist/data/places-search-oberon.js +3 -0
  85. package/dist/data/places-search-phobos.d.ts +1 -0
  86. package/dist/data/places-search-phobos.js +3 -0
  87. package/dist/data/places-search-phoebe.d.ts +1 -0
  88. package/dist/data/places-search-phoebe.js +3 -0
  89. package/dist/data/places-search-pluto.d.ts +1 -0
  90. package/dist/data/places-search-pluto.js +3 -0
  91. package/dist/data/places-search-proteus.d.ts +1 -0
  92. package/dist/data/places-search-proteus.js +3 -0
  93. package/dist/data/places-search-rhea.d.ts +1 -0
  94. package/dist/data/places-search-rhea.js +3 -0
  95. package/dist/data/places-search-ryugu.d.ts +1 -0
  96. package/dist/data/places-search-ryugu.js +3 -0
  97. package/dist/data/places-search-saturn.d.ts +1 -0
  98. package/dist/data/places-search-saturn.js +3 -0
  99. package/dist/data/places-search-steins.d.ts +1 -0
  100. package/dist/data/places-search-steins.js +3 -0
  101. package/dist/data/places-search-tempel-1.d.ts +1 -0
  102. package/dist/data/places-search-tempel-1.js +3 -0
  103. package/dist/data/places-search-tethys.d.ts +1 -0
  104. package/dist/data/places-search-tethys.js +3 -0
  105. package/dist/data/places-search-thebe.d.ts +1 -0
  106. package/dist/data/places-search-thebe.js +3 -0
  107. package/dist/data/places-search-titan.d.ts +1 -0
  108. package/dist/data/places-search-titan.js +3 -0
  109. package/dist/data/places-search-titania.d.ts +1 -0
  110. package/dist/data/places-search-titania.js +3 -0
  111. package/dist/data/places-search-triton.d.ts +1 -0
  112. package/dist/data/places-search-triton.js +3 -0
  113. package/dist/data/places-search-types.d.ts +1 -0
  114. package/dist/data/places-search-types.js +59 -0
  115. package/dist/data/places-search-umbriel.d.ts +1 -0
  116. package/dist/data/places-search-umbriel.js +3 -0
  117. package/dist/data/places-search-venus.d.ts +1 -0
  118. package/dist/data/places-search-venus.js +3 -0
  119. package/dist/data/places-search-vesta.d.ts +1 -0
  120. package/dist/data/places-search-vesta.js +3 -0
  121. package/dist/fact-sheets.d.ts +1 -1
  122. package/dist/fact-sheets.js +1 -1
  123. package/dist/flat/words.js +2 -0
  124. package/dist/moon-catalogue.d.ts +190 -0
  125. package/dist/moon-catalogue.js +189 -3
  126. package/dist/place-marks.js +1 -1
  127. package/dist/place-search.d.ts +157 -0
  128. package/dist/place-search.js +198 -0
  129. package/dist/places/moon.js +4 -1
  130. package/dist/places/search/67p.d.ts +12 -0
  131. package/dist/places/search/67p.js +14 -0
  132. package/dist/places/search/amalthea.d.ts +12 -0
  133. package/dist/places/search/amalthea.js +14 -0
  134. package/dist/places/search/ariel.d.ts +12 -0
  135. package/dist/places/search/ariel.js +14 -0
  136. package/dist/places/search/bennu.d.ts +12 -0
  137. package/dist/places/search/bennu.js +14 -0
  138. package/dist/places/search/callisto.d.ts +12 -0
  139. package/dist/places/search/callisto.js +14 -0
  140. package/dist/places/search/ceres.d.ts +12 -0
  141. package/dist/places/search/ceres.js +14 -0
  142. package/dist/places/search/charon.d.ts +12 -0
  143. package/dist/places/search/charon.js +14 -0
  144. package/dist/places/search/dactyl.d.ts +12 -0
  145. package/dist/places/search/dactyl.js +14 -0
  146. package/dist/places/search/deimos.d.ts +12 -0
  147. package/dist/places/search/deimos.js +14 -0
  148. package/dist/places/search/didymos.d.ts +12 -0
  149. package/dist/places/search/didymos.js +14 -0
  150. package/dist/places/search/dimorphos.d.ts +12 -0
  151. package/dist/places/search/dimorphos.js +14 -0
  152. package/dist/places/search/dinkinesh.d.ts +12 -0
  153. package/dist/places/search/dinkinesh.js +14 -0
  154. package/dist/places/search/dione.d.ts +12 -0
  155. package/dist/places/search/dione.js +14 -0
  156. package/dist/places/search/donaldjohanson.d.ts +12 -0
  157. package/dist/places/search/donaldjohanson.js +14 -0
  158. package/dist/places/search/enceladus.d.ts +12 -0
  159. package/dist/places/search/enceladus.js +14 -0
  160. package/dist/places/search/epimetheus.d.ts +12 -0
  161. package/dist/places/search/epimetheus.js +14 -0
  162. package/dist/places/search/eros.d.ts +12 -0
  163. package/dist/places/search/eros.js +14 -0
  164. package/dist/places/search/europa.d.ts +12 -0
  165. package/dist/places/search/europa.js +14 -0
  166. package/dist/places/search/ganymede.d.ts +12 -0
  167. package/dist/places/search/ganymede.js +14 -0
  168. package/dist/places/search/gaspra.d.ts +12 -0
  169. package/dist/places/search/gaspra.js +14 -0
  170. package/dist/places/search/hyperion.d.ts +12 -0
  171. package/dist/places/search/hyperion.js +14 -0
  172. package/dist/places/search/iapetus.d.ts +12 -0
  173. package/dist/places/search/iapetus.js +14 -0
  174. package/dist/places/search/ida.d.ts +12 -0
  175. package/dist/places/search/ida.js +14 -0
  176. package/dist/places/search/io.d.ts +12 -0
  177. package/dist/places/search/io.js +14 -0
  178. package/dist/places/search/itokawa.d.ts +12 -0
  179. package/dist/places/search/itokawa.js +14 -0
  180. package/dist/places/search/janus.d.ts +12 -0
  181. package/dist/places/search/janus.js +14 -0
  182. package/dist/places/search/jupiter.d.ts +12 -0
  183. package/dist/places/search/jupiter.js +14 -0
  184. package/dist/places/search/lutetia.d.ts +12 -0
  185. package/dist/places/search/lutetia.js +14 -0
  186. package/dist/places/search/mars.d.ts +12 -0
  187. package/dist/places/search/mars.js +14 -0
  188. package/dist/places/search/mathilde.d.ts +12 -0
  189. package/dist/places/search/mathilde.js +14 -0
  190. package/dist/places/search/mercury.d.ts +12 -0
  191. package/dist/places/search/mercury.js +14 -0
  192. package/dist/places/search/mimas.d.ts +12 -0
  193. package/dist/places/search/mimas.js +14 -0
  194. package/dist/places/search/miranda.d.ts +12 -0
  195. package/dist/places/search/miranda.js +14 -0
  196. package/dist/places/search/moon-satellites.d.ts +12 -0
  197. package/dist/places/search/moon-satellites.js +14 -0
  198. package/dist/places/search/moon.d.ts +12 -0
  199. package/dist/places/search/moon.js +14 -0
  200. package/dist/places/search/oberon.d.ts +12 -0
  201. package/dist/places/search/oberon.js +14 -0
  202. package/dist/places/search/phobos.d.ts +12 -0
  203. package/dist/places/search/phobos.js +14 -0
  204. package/dist/places/search/phoebe.d.ts +12 -0
  205. package/dist/places/search/phoebe.js +14 -0
  206. package/dist/places/search/pluto.d.ts +12 -0
  207. package/dist/places/search/pluto.js +14 -0
  208. package/dist/places/search/proteus.d.ts +12 -0
  209. package/dist/places/search/proteus.js +14 -0
  210. package/dist/places/search/rhea.d.ts +12 -0
  211. package/dist/places/search/rhea.js +14 -0
  212. package/dist/places/search/ryugu.d.ts +12 -0
  213. package/dist/places/search/ryugu.js +14 -0
  214. package/dist/places/search/saturn.d.ts +12 -0
  215. package/dist/places/search/saturn.js +14 -0
  216. package/dist/places/search/steins.d.ts +12 -0
  217. package/dist/places/search/steins.js +14 -0
  218. package/dist/places/search/tempel-1.d.ts +12 -0
  219. package/dist/places/search/tempel-1.js +14 -0
  220. package/dist/places/search/tethys.d.ts +12 -0
  221. package/dist/places/search/tethys.js +14 -0
  222. package/dist/places/search/thebe.d.ts +12 -0
  223. package/dist/places/search/thebe.js +14 -0
  224. package/dist/places/search/titan.d.ts +12 -0
  225. package/dist/places/search/titan.js +14 -0
  226. package/dist/places/search/titania.d.ts +12 -0
  227. package/dist/places/search/titania.js +14 -0
  228. package/dist/places/search/triton.d.ts +12 -0
  229. package/dist/places/search/triton.js +14 -0
  230. package/dist/places/search/umbriel.d.ts +12 -0
  231. package/dist/places/search/umbriel.js +14 -0
  232. package/dist/places/search/venus.d.ts +12 -0
  233. package/dist/places/search/venus.js +14 -0
  234. package/dist/places/search/vesta.d.ts +12 -0
  235. package/dist/places/search/vesta.js +14 -0
  236. package/dist/places/search.d.ts +25 -0
  237. package/dist/places/search.js +28 -0
  238. package/dist/places.d.ts +4 -3
  239. package/dist/scene/place-layer.js +1 -0
  240. package/dist/space/all-moons.d.ts +81 -10
  241. package/dist/space/all-moons.js +132 -27
  242. package/dist/space/element.d.ts +31 -5
  243. package/dist/space/element.js +122 -23
  244. package/dist/space/moon-settings.d.ts +25 -0
  245. package/dist/space/moon-settings.js +43 -0
  246. package/dist/space/orbit-rules.d.ts +25 -0
  247. package/dist/space/orbit-rules.js +36 -0
  248. package/dist/space/scene.d.ts +9 -3
  249. package/dist/space/scene.js +27 -17
  250. package/package.json +271 -1
@@ -0,0 +1,36 @@
1
+ // Which orbit lines the space view keeps, and which part of one it lets go, when a body is close (MODULES-1569). Pure: no DOM, no clock, no three.js.
2
+ /**
3
+ * Whether an orbit line belongs to the nearest body's own system, so that it is kept when that body is close: the body's own line (the Earth's, round the Sun, passes through the Earth) and, for the Earth and the Moon, the Moon's ring round the Earth.
4
+ *
5
+ * @param id - The body whose orbit line it is.
6
+ * @param nearId - The body that is close, the one the view is about.
7
+ * @returns True when the line is kept in a close view.
8
+ */
9
+ export function isOwnLine(id, nearId) {
10
+ return id === nearId || (id === "moon" && (nearId === "earth" || nearId === "moon"));
11
+ }
12
+ /**
13
+ * Whether the part of an orbit line near the close body is let go (faded out from 3 radii to 12), so that no line is drawn across the disc. Only a line that passes through the body needs it: a body's own line round the Sun, and the Moon's ring when it is the Moon that is close (the Moon
14
+ * is on it). The Moon's ring round the Earth does not pass through the Earth, and in the squeezed scale it lies 4 to 5 Earth radii out, inside the band, so fading it took the whole ring away when the Earth was close.
15
+ *
16
+ * @param id - The body whose orbit line it is.
17
+ * @param nearId - The body that is close.
18
+ * @param closeUp - Whether the close body's disc is big enough on the screen for the close view.
19
+ * @returns True when the line is faded near the body.
20
+ */
21
+ export function fadesNearBody(id, nearId, closeUp) {
22
+ if (!closeUp || !isOwnLine(id, nearId))
23
+ return false;
24
+ // the Moon's ring round the Earth never meets the Earth
25
+ return !(id === "moon" && nearId === "earth");
26
+ }
27
+ /**
28
+ * How much of an orbit line's colour is kept at a point of it that is `away` radii of the close body from the body's middle: none within 3 radii and all from 12, a smooth step between.
29
+ *
30
+ * @param away - The distance from the body's middle, in the body's radii.
31
+ * @returns The share of the line's alpha, 0 to 1.
32
+ */
33
+ export function nearBodyKeep(away) {
34
+ const t = Math.max(0, Math.min(1, (away - 3) / 9));
35
+ return t * t * (3 - 2 * t);
36
+ }
@@ -4,7 +4,7 @@ import { type BodyId, type MoonId } from "../facts.ts";
4
4
  import type { ThreeParts } from "../scene/body.ts";
5
5
  import type { SourceBook } from "../door/book.ts";
6
6
  import type { SmallBody } from "../door/small-bodies.ts";
7
- import { type MoonDot } from "./all-moons.ts";
7
+ import { type MoonColorChoice, type MoonSource, type MoonSpot } from "./all-moons.ts";
8
8
  import { type BeltId } from "../belts/index.ts";
9
9
  import { type PaintLabel, type WakuseiPainter } from "../scene/painter.ts";
10
10
  import "../bodies/all.ts";
@@ -184,9 +184,14 @@ export interface SpaceModel {
184
184
  anchor: number | null;
185
185
  orbits: boolean;
186
186
  labels: boolean;
187
- /** The catalogue's moons to draw as dots at a moment (`all-moons`), or null for none; and how many were drawn at the last draw. */
188
- allMoons: ((ms: number) => readonly MoonDot[]) | null;
187
+ /** The catalogue as a source of places and orbits, for the planets set to show all their moons (`moons`), or null for none (or before it has loaded); the planets chosen; what the orbits' colours say. */
188
+ moonSource: MoonSource | null;
189
+ moonHosts: ReadonlySet<string>;
190
+ moonColors: MoonColorChoice;
191
+ /** How many moon dots and orbits the last draw drew, and where the dots are on the screen (for a press). */
189
192
  moonDots: number;
193
+ moonOrbits: number;
194
+ moonSpots: readonly MoonSpot[];
190
195
  /** Milliseconds of game time one second of wall time covers (the ephemeris is looked up once per such span). */
191
196
  stepMs: number;
192
197
  /** Game seconds for each second of wall time, with its sign (0 when the clock holds): the places a move is worked out for are those the clock reaches by its end. */
@@ -251,6 +256,7 @@ export interface SpaceModel {
251
256
  drawn: string[];
252
257
  miss: Record<string, number>;
253
258
  hidden: string[];
259
+ faded: string[];
254
260
  };
255
261
  /** The arrowheads on the orbit lines at the last draw, by line: where each is and the way it points. */
256
262
  arrows: Record<string, OrbitArrow[]>;
@@ -1,7 +1,7 @@
1
1
  import { BODIES, MOONS_OF } from "../facts.js";
2
2
  import { createSmallBodyPoints, smallBodyPlace } from "../door/points.js";
3
3
  import { asteroidKey } from "./asteroid-ids.js";
4
- import { createMoonDots } from "./all-moons.js";
4
+ import { createMoonLayer } from "./all-moons.js";
5
5
  import { BELT_IDS, BELTS, OORT } from "../belts/index.js";
6
6
  import { toTerrestrialTime } from "../clock.js";
7
7
  import { moonOffset, orientation } from "../scene/orient.js";
@@ -20,6 +20,7 @@ import { createPaintOverlay } from "./paint-overlay.js";
20
20
  import { createPaintTrail, groundUnder, paintMinute } from "../paint/trail.js";
21
21
  import { BALL_FRAGMENT, VERTEX } from "../scene/glsl.js";
22
22
  import { ridePose } from "./ride.js";
23
+ import { fadesNearBody, isOwnLine, nearBodyKeep } from "./orbit-rules.js";
23
24
  import { moonDistance, moonSizeFactor, orbitLine, placeAround, placeBodies, placeMoon, radiusIn } from "./scale.js";
24
25
  import { regionOrbits, regionView } from "./regions.js";
25
26
  import { TRAVEL_BUDGET_MS, travelPlan, travelPose } from "./travel.js";
@@ -40,6 +41,9 @@ const ARROW_PX = 9;
40
41
  const CLOSE_UP_PX = 30;
41
42
  /** How long the Moon's ring is kept before it is worked out again from the Moon's place, in milliseconds: its path changes by a couple of hundred kilometres in that time. */
42
43
  const MOON_RING_KEEP_MS = 5 * 86_400_000;
44
+ /** A source with no moon: what the moon layer is handed before the catalogue has loaded. */
45
+ const EMPTY_MOON_SOURCE = { moons: [], position: () => [0, 0, 0], orbit: () => [] };
46
+ const NO_HOSTS = new Set();
43
47
  /** How many radii across the picture of a body is at zoom 1 when it has more than its globe: Saturn's rings (to 2.27 radii) are inside the view, not cut by it. */
44
48
  const FRAMED = { saturn: 2.3 };
45
49
  /** How much of the picture's shorter side a body's disc is framed across at zoom 1, in the body's radii: 1, and more for a ringed body. */
@@ -127,8 +131,12 @@ export const newSpaceModel = () => ({
127
131
  anchor: null,
128
132
  orbits: true,
129
133
  labels: true,
130
- allMoons: null,
134
+ moonSource: null,
135
+ moonHosts: new Set(),
136
+ moonColors: "group",
131
137
  moonDots: 0,
138
+ moonOrbits: 0,
139
+ moonSpots: [],
132
140
  stepMs: 1000,
133
141
  speed: 1,
134
142
  focus: "earth",
@@ -145,7 +153,7 @@ export const newSpaceModel = () => ({
145
153
  drawn: null,
146
154
  painted: { bodies: 0, moons: 0, held: 0 },
147
155
  tiles: { requested: 0, loading: 0, failed: 0, shown: null },
148
- rings: { drawn: [], miss: {}, hidden: [] },
156
+ rings: { drawn: [], miss: {}, hidden: [], faded: [] },
149
157
  arrows: {},
150
158
  help: false,
151
159
  helpThrough: false,
@@ -252,10 +260,8 @@ export function createSpaceItem(model, deps) {
252
260
  if (points !== undefined)
253
261
  scene.add(points.object);
254
262
  let pointsVersion = -1;
255
- // the catalogue's other moons as dots (a page's own subset of three needs Points and PointsMaterial for them)
256
- const dots = typeof three.Points === "function" ? createMoonDots(three) : undefined;
257
- if (dots !== undefined)
258
- scene.add(dots.object);
263
+ // the catalogue's moons of the planets set to `all`, as dots and orbits (a page's own subset of three needs Points, PointsMaterial, LineSegments and LineBasicMaterial for them)
264
+ const moonLayer = typeof three.Points === "function" && typeof three.LineSegments === "function" ? createMoonLayer(three, scene) : undefined;
259
265
  let pointsBelts = null;
260
266
  // the Oort cloud: three great circles at the shell's inner edge, drawn where the squeezed scale fits it (true to scale it is 2,000 astronomical units out, far past this view's reach)
261
267
  const OORT_SEGMENTS = 96;
@@ -866,21 +872,24 @@ export function createSpaceItem(model, deps) {
866
872
  }
867
873
  }
868
874
  }
869
- if (dots !== undefined) {
870
- const list = model.allMoons?.(model.time) ?? [];
871
- dots.object.visible = list.length > 0;
872
- model.moonDots = list.length === 0 ? 0 : dots.update(list, mode, (host) => pos[host], radiusOf, model.ratio());
875
+ if (moonLayer !== undefined) {
876
+ const source = model.moonSource;
877
+ const drawn = moonLayer.update({ source: source ?? EMPTY_MOON_SOURCE, hosts: source === null ? NO_HOSTS : model.moonHosts, by: model.moonColors, mode, time: model.time, orbits: model.orbits, at: (host) => pos[host], radius: radiusOf, ratio: model.ratio(), spot: labelFor });
878
+ model.moonDots = drawn.dots;
879
+ model.moonOrbits = drawn.orbits;
880
+ model.moonSpots = drawn.spots;
873
881
  }
874
882
  // the orbits round the Sun, placed by the same mapping as the bodies
875
883
  const drawnRings = [];
876
884
  const hiddenRings = [];
885
+ const fadedRings = [];
877
886
  const miss = {};
878
887
  // Close to a body (its disc is a few dozen pixels across) the other orbit lines are seen edge-on, long straight scratches across it: only the lines of its own system are kept, and of those the part near it fades
879
888
  const nearId = (rideFrom ? rideFrom.around : SPACE_BODIES.includes(focus) ? focus : (hostOf(focus) ?? "earth"));
880
889
  const closeUp = px[nearId] >= CLOSE_UP_PX;
881
890
  // flying through a belt (a point of the ride's own, round the Sun): the planets' orbit lines would be long scratches across the dots, so they are let go
882
891
  const flying = rideFrom !== null && rideFrom.around === "sun" && typeof model.ride?.target !== "string";
883
- const ownLine = (id) => id === nearId || (id === "moon" && (nearId === "earth" || nearId === "moon"));
892
+ const ownLine = (id) => isOwnLine(id, nearId);
884
893
  const nearRadius = radiusOf(nearId);
885
894
  for (const id of ORBIT_BODIES) {
886
895
  const o = orbits.get(id);
@@ -902,12 +911,13 @@ export function createSpaceItem(model, deps) {
902
911
  }
903
912
  o.line.geometry.getAttribute("position").needsUpdate = true;
904
913
  // the part of its own line near the body is let go, from 3 radii out to 12 (a close view sees a few radii across): never a line across the disc
905
- const fade = closeUp && ownLine(id);
914
+ const fade = fadesNearBody(id, nearId, closeUp);
915
+ if (fade)
916
+ fadedRings.push(id);
906
917
  if (fade || o.faded) {
907
918
  for (let i = 0; i <= ORBIT_POINTS; i += 1) {
908
919
  const away = Math.hypot(line[i][0] - pos[nearId][0], line[i][1] - pos[nearId][1], line[i][2] - pos[nearId][2]) / nearRadius;
909
- const t = Math.max(0, Math.min(1, (away - 3) / 9));
910
- o.colours[i * 4 + 3] = fade ? t * t * (3 - 2 * t) : 1;
920
+ o.colours[i * 4 + 3] = fade ? nearBodyKeep(away) : 1;
911
921
  }
912
922
  o.line.geometry.getAttribute("color").needsUpdate = true;
913
923
  o.faded = fade;
@@ -920,7 +930,7 @@ export function createSpaceItem(model, deps) {
920
930
  drawnRings.push(id);
921
931
  miss[id] = distanceToLine(pos[id], line) / radius;
922
932
  }
923
- model.rings = { drawn: drawnRings, miss, hidden: hiddenRings };
933
+ model.rings = { drawn: drawnRings, miss, hidden: hiddenRings, faded: fadedRings };
924
934
  // Starman and the Roadster: where the table puts the car, in the same mapping as the planets, as a dot a few pixels across, on its orbit line (about one trip round the Sun, from the table, worked out again every month)
925
935
  const path = model.roadster ? model.roadsterPath : null;
926
936
  let roadsterAt = null;
@@ -1427,7 +1437,7 @@ export function createSpaceItem(model, deps) {
1427
1437
  },
1428
1438
  dispose() {
1429
1439
  points?.dispose();
1430
- dots?.dispose();
1440
+ moonLayer?.dispose();
1431
1441
  oortGeometry.dispose();
1432
1442
  oortLines.material.dispose();
1433
1443
  paintOverlay?.dispose();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/wakusei-planets",
3
- "version": "0.67.0",
3
+ "version": "0.68.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",
@@ -436,6 +436,276 @@
436
436
  "import": "./dist/places/saturn.js",
437
437
  "default": "./dist/places/saturn.js"
438
438
  },
439
+ "./places/search": {
440
+ "types": "./dist/places/search.d.ts",
441
+ "import": "./dist/places/search.js",
442
+ "default": "./dist/places/search.js"
443
+ },
444
+ "./places/search/moon": {
445
+ "types": "./dist/places/search/moon.d.ts",
446
+ "import": "./dist/places/search/moon.js",
447
+ "default": "./dist/places/search/moon.js"
448
+ },
449
+ "./places/search/mars": {
450
+ "types": "./dist/places/search/mars.d.ts",
451
+ "import": "./dist/places/search/mars.js",
452
+ "default": "./dist/places/search/mars.js"
453
+ },
454
+ "./places/search/mercury": {
455
+ "types": "./dist/places/search/mercury.d.ts",
456
+ "import": "./dist/places/search/mercury.js",
457
+ "default": "./dist/places/search/mercury.js"
458
+ },
459
+ "./places/search/venus": {
460
+ "types": "./dist/places/search/venus.d.ts",
461
+ "import": "./dist/places/search/venus.js",
462
+ "default": "./dist/places/search/venus.js"
463
+ },
464
+ "./places/search/io": {
465
+ "types": "./dist/places/search/io.d.ts",
466
+ "import": "./dist/places/search/io.js",
467
+ "default": "./dist/places/search/io.js"
468
+ },
469
+ "./places/search/europa": {
470
+ "types": "./dist/places/search/europa.d.ts",
471
+ "import": "./dist/places/search/europa.js",
472
+ "default": "./dist/places/search/europa.js"
473
+ },
474
+ "./places/search/ganymede": {
475
+ "types": "./dist/places/search/ganymede.d.ts",
476
+ "import": "./dist/places/search/ganymede.js",
477
+ "default": "./dist/places/search/ganymede.js"
478
+ },
479
+ "./places/search/callisto": {
480
+ "types": "./dist/places/search/callisto.d.ts",
481
+ "import": "./dist/places/search/callisto.js",
482
+ "default": "./dist/places/search/callisto.js"
483
+ },
484
+ "./places/search/titan": {
485
+ "types": "./dist/places/search/titan.d.ts",
486
+ "import": "./dist/places/search/titan.js",
487
+ "default": "./dist/places/search/titan.js"
488
+ },
489
+ "./places/search/enceladus": {
490
+ "types": "./dist/places/search/enceladus.d.ts",
491
+ "import": "./dist/places/search/enceladus.js",
492
+ "default": "./dist/places/search/enceladus.js"
493
+ },
494
+ "./places/search/mimas": {
495
+ "types": "./dist/places/search/mimas.d.ts",
496
+ "import": "./dist/places/search/mimas.js",
497
+ "default": "./dist/places/search/mimas.js"
498
+ },
499
+ "./places/search/tethys": {
500
+ "types": "./dist/places/search/tethys.d.ts",
501
+ "import": "./dist/places/search/tethys.js",
502
+ "default": "./dist/places/search/tethys.js"
503
+ },
504
+ "./places/search/dione": {
505
+ "types": "./dist/places/search/dione.d.ts",
506
+ "import": "./dist/places/search/dione.js",
507
+ "default": "./dist/places/search/dione.js"
508
+ },
509
+ "./places/search/rhea": {
510
+ "types": "./dist/places/search/rhea.d.ts",
511
+ "import": "./dist/places/search/rhea.js",
512
+ "default": "./dist/places/search/rhea.js"
513
+ },
514
+ "./places/search/iapetus": {
515
+ "types": "./dist/places/search/iapetus.d.ts",
516
+ "import": "./dist/places/search/iapetus.js",
517
+ "default": "./dist/places/search/iapetus.js"
518
+ },
519
+ "./places/search/miranda": {
520
+ "types": "./dist/places/search/miranda.d.ts",
521
+ "import": "./dist/places/search/miranda.js",
522
+ "default": "./dist/places/search/miranda.js"
523
+ },
524
+ "./places/search/ariel": {
525
+ "types": "./dist/places/search/ariel.d.ts",
526
+ "import": "./dist/places/search/ariel.js",
527
+ "default": "./dist/places/search/ariel.js"
528
+ },
529
+ "./places/search/umbriel": {
530
+ "types": "./dist/places/search/umbriel.d.ts",
531
+ "import": "./dist/places/search/umbriel.js",
532
+ "default": "./dist/places/search/umbriel.js"
533
+ },
534
+ "./places/search/titania": {
535
+ "types": "./dist/places/search/titania.d.ts",
536
+ "import": "./dist/places/search/titania.js",
537
+ "default": "./dist/places/search/titania.js"
538
+ },
539
+ "./places/search/oberon": {
540
+ "types": "./dist/places/search/oberon.d.ts",
541
+ "import": "./dist/places/search/oberon.js",
542
+ "default": "./dist/places/search/oberon.js"
543
+ },
544
+ "./places/search/triton": {
545
+ "types": "./dist/places/search/triton.d.ts",
546
+ "import": "./dist/places/search/triton.js",
547
+ "default": "./dist/places/search/triton.js"
548
+ },
549
+ "./places/search/pluto": {
550
+ "types": "./dist/places/search/pluto.d.ts",
551
+ "import": "./dist/places/search/pluto.js",
552
+ "default": "./dist/places/search/pluto.js"
553
+ },
554
+ "./places/search/charon": {
555
+ "types": "./dist/places/search/charon.d.ts",
556
+ "import": "./dist/places/search/charon.js",
557
+ "default": "./dist/places/search/charon.js"
558
+ },
559
+ "./places/search/ceres": {
560
+ "types": "./dist/places/search/ceres.d.ts",
561
+ "import": "./dist/places/search/ceres.js",
562
+ "default": "./dist/places/search/ceres.js"
563
+ },
564
+ "./places/search/vesta": {
565
+ "types": "./dist/places/search/vesta.d.ts",
566
+ "import": "./dist/places/search/vesta.js",
567
+ "default": "./dist/places/search/vesta.js"
568
+ },
569
+ "./places/search/eros": {
570
+ "types": "./dist/places/search/eros.d.ts",
571
+ "import": "./dist/places/search/eros.js",
572
+ "default": "./dist/places/search/eros.js"
573
+ },
574
+ "./places/search/ryugu": {
575
+ "types": "./dist/places/search/ryugu.d.ts",
576
+ "import": "./dist/places/search/ryugu.js",
577
+ "default": "./dist/places/search/ryugu.js"
578
+ },
579
+ "./places/search/bennu": {
580
+ "types": "./dist/places/search/bennu.d.ts",
581
+ "import": "./dist/places/search/bennu.js",
582
+ "default": "./dist/places/search/bennu.js"
583
+ },
584
+ "./places/search/dimorphos": {
585
+ "types": "./dist/places/search/dimorphos.d.ts",
586
+ "import": "./dist/places/search/dimorphos.js",
587
+ "default": "./dist/places/search/dimorphos.js"
588
+ },
589
+ "./places/search/tempel-1": {
590
+ "types": "./dist/places/search/tempel-1.d.ts",
591
+ "import": "./dist/places/search/tempel-1.js",
592
+ "default": "./dist/places/search/tempel-1.js"
593
+ },
594
+ "./places/search/67p": {
595
+ "types": "./dist/places/search/67p.d.ts",
596
+ "import": "./dist/places/search/67p.js",
597
+ "default": "./dist/places/search/67p.js"
598
+ },
599
+ "./places/search/jupiter": {
600
+ "types": "./dist/places/search/jupiter.d.ts",
601
+ "import": "./dist/places/search/jupiter.js",
602
+ "default": "./dist/places/search/jupiter.js"
603
+ },
604
+ "./places/search/saturn": {
605
+ "types": "./dist/places/search/saturn.d.ts",
606
+ "import": "./dist/places/search/saturn.js",
607
+ "default": "./dist/places/search/saturn.js"
608
+ },
609
+ "./places/search/amalthea": {
610
+ "types": "./dist/places/search/amalthea.d.ts",
611
+ "import": "./dist/places/search/amalthea.js",
612
+ "default": "./dist/places/search/amalthea.js"
613
+ },
614
+ "./places/search/dactyl": {
615
+ "types": "./dist/places/search/dactyl.d.ts",
616
+ "import": "./dist/places/search/dactyl.js",
617
+ "default": "./dist/places/search/dactyl.js"
618
+ },
619
+ "./places/search/deimos": {
620
+ "types": "./dist/places/search/deimos.d.ts",
621
+ "import": "./dist/places/search/deimos.js",
622
+ "default": "./dist/places/search/deimos.js"
623
+ },
624
+ "./places/search/didymos": {
625
+ "types": "./dist/places/search/didymos.d.ts",
626
+ "import": "./dist/places/search/didymos.js",
627
+ "default": "./dist/places/search/didymos.js"
628
+ },
629
+ "./places/search/dinkinesh": {
630
+ "types": "./dist/places/search/dinkinesh.d.ts",
631
+ "import": "./dist/places/search/dinkinesh.js",
632
+ "default": "./dist/places/search/dinkinesh.js"
633
+ },
634
+ "./places/search/donaldjohanson": {
635
+ "types": "./dist/places/search/donaldjohanson.d.ts",
636
+ "import": "./dist/places/search/donaldjohanson.js",
637
+ "default": "./dist/places/search/donaldjohanson.js"
638
+ },
639
+ "./places/search/epimetheus": {
640
+ "types": "./dist/places/search/epimetheus.d.ts",
641
+ "import": "./dist/places/search/epimetheus.js",
642
+ "default": "./dist/places/search/epimetheus.js"
643
+ },
644
+ "./places/search/gaspra": {
645
+ "types": "./dist/places/search/gaspra.d.ts",
646
+ "import": "./dist/places/search/gaspra.js",
647
+ "default": "./dist/places/search/gaspra.js"
648
+ },
649
+ "./places/search/hyperion": {
650
+ "types": "./dist/places/search/hyperion.d.ts",
651
+ "import": "./dist/places/search/hyperion.js",
652
+ "default": "./dist/places/search/hyperion.js"
653
+ },
654
+ "./places/search/ida": {
655
+ "types": "./dist/places/search/ida.d.ts",
656
+ "import": "./dist/places/search/ida.js",
657
+ "default": "./dist/places/search/ida.js"
658
+ },
659
+ "./places/search/itokawa": {
660
+ "types": "./dist/places/search/itokawa.d.ts",
661
+ "import": "./dist/places/search/itokawa.js",
662
+ "default": "./dist/places/search/itokawa.js"
663
+ },
664
+ "./places/search/janus": {
665
+ "types": "./dist/places/search/janus.d.ts",
666
+ "import": "./dist/places/search/janus.js",
667
+ "default": "./dist/places/search/janus.js"
668
+ },
669
+ "./places/search/lutetia": {
670
+ "types": "./dist/places/search/lutetia.d.ts",
671
+ "import": "./dist/places/search/lutetia.js",
672
+ "default": "./dist/places/search/lutetia.js"
673
+ },
674
+ "./places/search/mathilde": {
675
+ "types": "./dist/places/search/mathilde.d.ts",
676
+ "import": "./dist/places/search/mathilde.js",
677
+ "default": "./dist/places/search/mathilde.js"
678
+ },
679
+ "./places/search/phobos": {
680
+ "types": "./dist/places/search/phobos.d.ts",
681
+ "import": "./dist/places/search/phobos.js",
682
+ "default": "./dist/places/search/phobos.js"
683
+ },
684
+ "./places/search/phoebe": {
685
+ "types": "./dist/places/search/phoebe.d.ts",
686
+ "import": "./dist/places/search/phoebe.js",
687
+ "default": "./dist/places/search/phoebe.js"
688
+ },
689
+ "./places/search/proteus": {
690
+ "types": "./dist/places/search/proteus.d.ts",
691
+ "import": "./dist/places/search/proteus.js",
692
+ "default": "./dist/places/search/proteus.js"
693
+ },
694
+ "./places/search/steins": {
695
+ "types": "./dist/places/search/steins.d.ts",
696
+ "import": "./dist/places/search/steins.js",
697
+ "default": "./dist/places/search/steins.js"
698
+ },
699
+ "./places/search/thebe": {
700
+ "types": "./dist/places/search/thebe.d.ts",
701
+ "import": "./dist/places/search/thebe.js",
702
+ "default": "./dist/places/search/thebe.js"
703
+ },
704
+ "./places/search/moon-satellites": {
705
+ "types": "./dist/places/search/moon-satellites.d.ts",
706
+ "import": "./dist/places/search/moon-satellites.js",
707
+ "default": "./dist/places/search/moon-satellites.js"
708
+ },
439
709
  "./orbiters": {
440
710
  "types": "./dist/orbiters.d.ts",
441
711
  "import": "./dist/orbiters.js",