@johnmorrisdotca/wakusei-planets 0.34.0 → 0.35.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 (203) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/NOTICE.md +48 -0
  3. package/README.md +21 -3
  4. package/dist/approaches.d.ts +276 -0
  5. package/dist/approaches.js +255 -0
  6. package/dist/asteroids.d.ts +397 -0
  7. package/dist/asteroids.js +338 -0
  8. package/dist/comets.d.ts +316 -0
  9. package/dist/comets.js +404 -0
  10. package/dist/craft/bepicolombo.d.ts +1 -0
  11. package/dist/craft/bepicolombo.js +923 -0
  12. package/dist/craft/europaclipper.d.ts +1 -0
  13. package/dist/craft/europaclipper.js +342 -0
  14. package/dist/craft/hayabusa2.d.ts +1 -0
  15. package/dist/craft/hayabusa2.js +73 -0
  16. package/dist/craft/juice.d.ts +1 -0
  17. package/dist/craft/juice.js +40 -0
  18. package/dist/craft/lucy.d.ts +1 -0
  19. package/dist/craft/lucy.js +42 -0
  20. package/dist/craft/osirisapex.d.ts +1 -0
  21. package/dist/craft/osirisapex.js +69 -0
  22. package/dist/craft/psyche.d.ts +1 -0
  23. package/dist/craft/psyche.js +30 -0
  24. package/dist/craft/solarorbiter.d.ts +1 -0
  25. package/dist/craft/solarorbiter.js +94 -0
  26. package/dist/data/approaches.d.ts +17 -0
  27. package/dist/data/approaches.js +4192 -0
  28. package/dist/data/asteroids.d.ts +3 -0
  29. package/dist/data/asteroids.js +107 -0
  30. package/dist/data/comets.d.ts +2 -0
  31. package/dist/data/comets.js +36 -0
  32. package/dist/data/places-67p.d.ts +27 -0
  33. package/dist/data/places-67p.js +2 -0
  34. package/dist/data/places-ariel.d.ts +602 -0
  35. package/dist/data/places-ariel.js +27 -0
  36. package/dist/data/places-bennu.d.ts +25 -0
  37. package/dist/data/places-bennu.js +2 -0
  38. package/dist/data/places-callisto.d.ts +3547 -0
  39. package/dist/data/places-callisto.js +155 -0
  40. package/dist/data/places-ceres.d.ts +3436 -0
  41. package/dist/data/places-ceres.js +150 -0
  42. package/dist/data/places-charon.d.ts +349 -0
  43. package/dist/data/places-charon.js +16 -0
  44. package/dist/data/places-dimorphos.d.ts +23 -0
  45. package/dist/data/places-dimorphos.js +2 -0
  46. package/dist/data/places-dione.d.ts +2258 -0
  47. package/dist/data/places-dione.js +99 -0
  48. package/dist/data/places-enceladus.d.ts +2009 -0
  49. package/dist/data/places-enceladus.js +88 -0
  50. package/dist/data/places-eros.d.ts +26 -0
  51. package/dist/data/places-eros.js +2 -0
  52. package/dist/data/places-europa.d.ts +2977 -0
  53. package/dist/data/places-europa.js +130 -0
  54. package/dist/data/places-ganymede.d.ts +4518 -0
  55. package/dist/data/places-ganymede.js +197 -0
  56. package/dist/data/places-iapetus.d.ts +1616 -0
  57. package/dist/data/places-iapetus.js +71 -0
  58. package/dist/data/places-io.d.ts +6012 -0
  59. package/dist/data/places-io.js +262 -0
  60. package/dist/data/places-jupiter.d.ts +46 -0
  61. package/dist/data/places-jupiter.js +3 -0
  62. package/dist/data/places-mars.d.ts +20701 -0
  63. package/dist/data/places-mars.js +942 -0
  64. package/dist/data/places-mercury.d.ts +9256 -0
  65. package/dist/data/places-mercury.js +403 -0
  66. package/dist/data/places-mimas.d.ts +968 -0
  67. package/dist/data/places-mimas.js +43 -0
  68. package/dist/data/places-miranda.d.ts +419 -0
  69. package/dist/data/places-miranda.js +19 -0
  70. package/dist/data/places-moon.d.ts +18849 -0
  71. package/dist/data/places-moon.js +861 -0
  72. package/dist/data/places-oberon.d.ts +235 -0
  73. package/dist/data/places-oberon.js +11 -0
  74. package/dist/data/places-pluto.d.ts +1687 -0
  75. package/dist/data/places-pluto.js +74 -0
  76. package/dist/data/places-rhea.d.ts +3317 -0
  77. package/dist/data/places-rhea.js +145 -0
  78. package/dist/data/places-ryugu.d.ts +87 -0
  79. package/dist/data/places-ryugu.js +5 -0
  80. package/dist/data/places-saturn.d.ts +25 -0
  81. package/dist/data/places-saturn.js +2 -0
  82. package/dist/data/places-tempel-1.d.ts +25 -0
  83. package/dist/data/places-tempel-1.js +2 -0
  84. package/dist/data/places-tethys.d.ts +1222 -0
  85. package/dist/data/places-tethys.js +54 -0
  86. package/dist/data/places-titan.d.ts +7031 -0
  87. package/dist/data/places-titan.js +306 -0
  88. package/dist/data/places-titania.d.ts +418 -0
  89. package/dist/data/places-titania.js +19 -0
  90. package/dist/data/places-triton.d.ts +1457 -0
  91. package/dist/data/places-triton.js +64 -0
  92. package/dist/data/places-umbriel.d.ts +303 -0
  93. package/dist/data/places-umbriel.js +14 -0
  94. package/dist/data/places-venus.d.ts +9290 -0
  95. package/dist/data/places-venus.js +405 -0
  96. package/dist/data/places-vesta.d.ts +2444 -0
  97. package/dist/data/places-vesta.js +107 -0
  98. package/dist/data/roadster.d.ts +8 -0
  99. package/dist/data/roadster.js +686 -0
  100. package/dist/element.js +17 -3
  101. package/dist/places/67p.d.ts +13 -0
  102. package/dist/places/67p.js +14 -0
  103. package/dist/places/ariel.d.ts +13 -0
  104. package/dist/places/ariel.js +14 -0
  105. package/dist/places/bennu.d.ts +13 -0
  106. package/dist/places/bennu.js +14 -0
  107. package/dist/places/callisto.d.ts +13 -0
  108. package/dist/places/callisto.js +14 -0
  109. package/dist/places/ceres.d.ts +13 -0
  110. package/dist/places/ceres.js +14 -0
  111. package/dist/places/charon.d.ts +13 -0
  112. package/dist/places/charon.js +14 -0
  113. package/dist/places/dimorphos.d.ts +13 -0
  114. package/dist/places/dimorphos.js +14 -0
  115. package/dist/places/dione.d.ts +13 -0
  116. package/dist/places/dione.js +14 -0
  117. package/dist/places/enceladus.d.ts +13 -0
  118. package/dist/places/enceladus.js +14 -0
  119. package/dist/places/eros.d.ts +13 -0
  120. package/dist/places/eros.js +14 -0
  121. package/dist/places/europa.d.ts +13 -0
  122. package/dist/places/europa.js +14 -0
  123. package/dist/places/ganymede.d.ts +13 -0
  124. package/dist/places/ganymede.js +14 -0
  125. package/dist/places/iapetus.d.ts +13 -0
  126. package/dist/places/iapetus.js +14 -0
  127. package/dist/places/io.d.ts +13 -0
  128. package/dist/places/io.js +14 -0
  129. package/dist/places/jupiter.d.ts +13 -0
  130. package/dist/places/jupiter.js +14 -0
  131. package/dist/places/mars.d.ts +12 -0
  132. package/dist/places/mars.js +13 -0
  133. package/dist/places/mercury.d.ts +13 -0
  134. package/dist/places/mercury.js +14 -0
  135. package/dist/places/mimas.d.ts +13 -0
  136. package/dist/places/mimas.js +14 -0
  137. package/dist/places/miranda.d.ts +13 -0
  138. package/dist/places/miranda.js +14 -0
  139. package/dist/places/moon.d.ts +12 -0
  140. package/dist/places/moon.js +13 -0
  141. package/dist/places/oberon.d.ts +13 -0
  142. package/dist/places/oberon.js +14 -0
  143. package/dist/places/pluto.d.ts +13 -0
  144. package/dist/places/pluto.js +14 -0
  145. package/dist/places/rhea.d.ts +13 -0
  146. package/dist/places/rhea.js +14 -0
  147. package/dist/places/ryugu.d.ts +13 -0
  148. package/dist/places/ryugu.js +14 -0
  149. package/dist/places/saturn.d.ts +13 -0
  150. package/dist/places/saturn.js +14 -0
  151. package/dist/places/tempel-1.d.ts +13 -0
  152. package/dist/places/tempel-1.js +14 -0
  153. package/dist/places/tethys.d.ts +13 -0
  154. package/dist/places/tethys.js +14 -0
  155. package/dist/places/titan.d.ts +13 -0
  156. package/dist/places/titan.js +14 -0
  157. package/dist/places/titania.d.ts +13 -0
  158. package/dist/places/titania.js +14 -0
  159. package/dist/places/triton.d.ts +13 -0
  160. package/dist/places/triton.js +14 -0
  161. package/dist/places/umbriel.d.ts +13 -0
  162. package/dist/places/umbriel.js +14 -0
  163. package/dist/places/venus.d.ts +13 -0
  164. package/dist/places/venus.js +14 -0
  165. package/dist/places/vesta.d.ts +13 -0
  166. package/dist/places/vesta.js +14 -0
  167. package/dist/places.d.ts +354 -0
  168. package/dist/places.js +357 -0
  169. package/dist/plan/element.d.ts +52 -0
  170. package/dist/plan/element.js +258 -0
  171. package/dist/plan/index.d.ts +2 -0
  172. package/dist/plan/index.js +2 -0
  173. package/dist/plan/layout.d.ts +230 -0
  174. package/dist/plan/layout.js +229 -0
  175. package/dist/plan/svg.d.ts +125 -0
  176. package/dist/plan/svg.js +185 -0
  177. package/dist/roadster.d.ts +415 -0
  178. package/dist/roadster.js +496 -0
  179. package/dist/scene/body.js +10 -9
  180. package/dist/scene/painter.d.ts +1 -1
  181. package/dist/scene/painter.js +23 -7
  182. package/dist/scene/textures.d.ts +2 -2
  183. package/dist/space/beside.d.ts +4 -1
  184. package/dist/space/beside.js +47 -6
  185. package/dist/space/covered.d.ts +102 -0
  186. package/dist/space/covered.js +98 -0
  187. package/dist/space/element.d.ts +21 -1
  188. package/dist/space/element.js +126 -11
  189. package/dist/space/index.d.ts +1 -0
  190. package/dist/space/index.js +1 -0
  191. package/dist/space/scale.d.ts +2 -1
  192. package/dist/space/scale.js +13 -2
  193. package/dist/space/scene.d.ts +10 -0
  194. package/dist/space/scene.js +45 -22
  195. package/dist/spacecraft-facts.d.ts +4 -4
  196. package/dist/spacecraft-facts.js +158 -3
  197. package/dist/spacecraft.d.ts +69 -2
  198. package/dist/spacecraft.js +45 -2
  199. package/dist/textures/mimas-1024.webp +0 -0
  200. package/dist/textures/mimas-512.webp +0 -0
  201. package/dist/version.d.ts +1 -1
  202. package/dist/version.js +1 -1
  203. package/package.json +203 -1
@@ -0,0 +1,496 @@
1
+ // Starman and the Tesla Roadster: where the car launched on the first Falcon Heavy is at a date, its distances, speeds, orbit and the moments worth looking at. The path is a table of state vectors from JPL Horizons
2
+ // (target -143205, solution s11; scripts/make-roadster-data.py, src/data/roadster.ts) joined by cubic Hermite interpolation on position and velocity, and only this entry point imports it. Positions are heliocentric, in
3
+ // kilometres, in the J2000 ecliptic frame, like `spacecraftPosition` (`heliocentric` gives the planets in astronomical units in the same axes). Pure: no DOM, no clock reads, no three.js.
4
+ import { ROADSTER_ROWS, ROADSTER_START, ROADSTER_STEP_DAYS, ROADSTER_WORST_KM } from "./data/roadster.js";
5
+ import { toTerrestrialTime, ttMinusUtc } from "./clock.js";
6
+ import { heliocentric } from "./ephemeris.js";
7
+ import { add, cross, dot, length, scale, sub, unit } from "./vec.js";
8
+ import { moment } from "./when.js";
9
+ const AU_KM = 149_597_870.7;
10
+ const MILE_KM = 1.609344;
11
+ const LIGHT_KM_PER_SECOND = 299_792.458;
12
+ /** The Sun's gravitational parameter in cubic kilometres a second squared (the value of the DE440 ephemeris that Horizons uses). */
13
+ const GM_SUN = 132_712_440_041.279_42;
14
+ const DAY_MS = 86_400_000;
15
+ const STRIDE = 7;
16
+ /** The launch: 2018-02-06 20:45 UTC, from Horizons' own notes on the object. */
17
+ const LAUNCH = Date.UTC(2018, 1, 6, 20, 45);
18
+ const ROWS = ROADSTER_ROWS;
19
+ const COUNT = ROWS.length / STRIDE;
20
+ const SPAN_SECONDS = ROWS[(COUNT - 1) * STRIDE] * 3600;
21
+ const utcOfTerrestrial = (tt) => tt - ttMinusUtc(tt) * 1000;
22
+ const RECORD_START = utcOfTerrestrial(ROADSTER_START);
23
+ const RECORD_END = utcOfTerrestrial(ROADSTER_START + SPAN_SECONDS * 1000);
24
+ /**
25
+ * What is known about the car: its names, launch, Horizons' number and the span of the path.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * import { ROADSTER } from "@johnmorrisdotca/wakusei-planets/roadster";
30
+ *
31
+ * console.log(ROADSTER.name.en, "and the", ROADSTER.car.en, "were launched", new Date(ROADSTER.launch).toISOString());
32
+ * ```
33
+ */
34
+ export const ROADSTER = {
35
+ /** The mannequin at the wheel, in English and Japanese. */
36
+ name: { en: "Starman", ja: "スターマン" },
37
+ /** The car, in English and Japanese. */
38
+ car: { en: "Tesla Roadster", ja: "テスラ・ロードスター" },
39
+ /** The launch, in milliseconds since 1970 (UTC): the first flight of the Falcon Heavy, 2018-02-06 20:45, from launch complex 39A of the Kennedy Space Center. */
40
+ launch: LAUNCH,
41
+ /** The number JPL Horizons gives the car. */
42
+ horizonsId: "-143205",
43
+ /** The span the path covers, in milliseconds since 1970 (UTC): from about six hours after the launch (where Horizons' record starts) to 2036-01-01. A date outside it throws a `RangeError`. */
44
+ record: { start: RECORD_START, end: RECORD_END },
45
+ };
46
+ /**
47
+ * How far to trust the path, stated: the span it covers, the worst error of the interpolation against Horizons' own record as measured when the table was made, and what the table cannot know.
48
+ * The car's path is a prediction from a fit to 374 telescope observations made in February and March 2018 (Horizons' solution s11), with sunlight's push on the car estimated from them: a date years after the fit drifts from where the car really is, by more the further away it is.
49
+ *
50
+ * @example
51
+ * ```ts
52
+ * import { ROADSTER_ACCURACY } from "@johnmorrisdotca/wakusei-planets/roadster";
53
+ *
54
+ * console.log(`rows ${ROADSTER_ACCURACY.stepDays} days apart, within ${ROADSTER_ACCURACY.interpolationKm} km of Horizons' own path`);
55
+ * ```
56
+ */
57
+ export const ROADSTER_ACCURACY = {
58
+ /** The first moment the path covers, in milliseconds since 1970 (UTC). */
59
+ from: RECORD_START,
60
+ /** The last moment the path covers, in milliseconds since 1970 (UTC). */
61
+ to: RECORD_END,
62
+ /** The days between rows of the table once the car is ten days out. */
63
+ stepDays: ROADSTER_STEP_DAYS,
64
+ /** The worst distance, in kilometres, between the table's interpolation and Horizons' own record of the same path, measured every day of the span, every hour of the first 13 days and every hour round the Mars passes of October 2020 and April 2035. */
65
+ interpolationKm: ROADSTER_WORST_KM,
66
+ /** In words, what the numbers leave out. */
67
+ note: "Horizons' path was fitted to observations from February and March 2018 and is a prediction after that; sunlight's push is modelled only as one number fitted to those observations, so the real car drifts from the predicted path, and the further from 2018 the more. The interpolation error above is separate and small beside it.",
68
+ };
69
+ /** The state from the table at a UTC moment: terrestrial seconds after the start of the table, position and velocity. */
70
+ function state(ms) {
71
+ const seconds = (toTerrestrialTime(ms) - ROADSTER_START) / 1000;
72
+ if (!(seconds >= -1e-3 && seconds <= SPAN_SECONDS + 1e-3)) {
73
+ throw new RangeError(`when ${new Date(ms).toISOString()} is outside the path of the Tesla Roadster, which runs from ${new Date(RECORD_START).toISOString()} to ${new Date(RECORD_END).toISOString()}`);
74
+ }
75
+ let lo = 0;
76
+ let hi = COUNT - 2;
77
+ while (lo < hi) {
78
+ const mid = (lo + hi + 1) >> 1;
79
+ if (ROWS[mid * STRIDE] * 3600 <= seconds)
80
+ lo = mid;
81
+ else
82
+ hi = mid - 1;
83
+ }
84
+ const a = lo * STRIDE;
85
+ const b = a + STRIDE;
86
+ const t0 = ROWS[a] * 3600;
87
+ const h = ROWS[b] * 3600 - t0;
88
+ const s = (seconds - t0) / h;
89
+ const s2 = s * s;
90
+ const s3 = s2 * s;
91
+ const h00 = 2 * s3 - 3 * s2 + 1;
92
+ const h10 = s3 - 2 * s2 + s;
93
+ const h01 = -2 * s3 + 3 * s2;
94
+ const h11 = s3 - s2;
95
+ const d00 = (6 * s2 - 6 * s) / h;
96
+ const d10 = 3 * s2 - 4 * s + 1;
97
+ const d01 = (-6 * s2 + 6 * s) / h;
98
+ const d11 = 3 * s2 - 2 * s;
99
+ const position = [0, 0, 0];
100
+ const velocity = [0, 0, 0];
101
+ for (let k = 0; k < 3; k += 1) {
102
+ const p0 = ROWS[a + 1 + k];
103
+ const p1 = ROWS[b + 1 + k];
104
+ const v0 = ROWS[a + 4 + k];
105
+ const v1 = ROWS[b + 4 + k];
106
+ position[k] = h00 * p0 + h10 * h * v0 + h01 * p1 + h11 * h * v1;
107
+ velocity[k] = d00 * p0 + d10 * v0 + d01 * p1 + d11 * v1;
108
+ }
109
+ return { position, velocity, seconds };
110
+ }
111
+ /**
112
+ * Where the car is at a moment: x, y, z in kilometres from the Sun, in the J2000 ecliptic frame (the axes of `heliocentric`, which is in astronomical units, and of `spacecraftPosition`).
113
+ * The path is Horizons' prediction from 2018's observations (see `ROADSTER_ACCURACY`). A moment outside `ROADSTER.record` throws a `RangeError`.
114
+ *
115
+ * @param when - A `Date` or milliseconds since 1970 (UTC).
116
+ * @returns The position in kilometres.
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * import { roadsterPosition } from "@johnmorrisdotca/wakusei-planets/roadster";
121
+ *
122
+ * const [x, y, z] = roadsterPosition(new Date("2020-10-07T06:00:00Z"));
123
+ * console.log((Math.hypot(x, y, z) / 149597870.7).toFixed(3), "au from the Sun");
124
+ * ```
125
+ */
126
+ export function roadsterPosition(when) {
127
+ return state(moment(when)).position;
128
+ }
129
+ /**
130
+ * The same position in astronomical units, the unit `heliocentric` gives the planets in, so the car and a planet subtract directly.
131
+ *
132
+ * @param when - A `Date` or milliseconds since 1970 (UTC).
133
+ * @returns The position in au.
134
+ *
135
+ * @example
136
+ * ```ts
137
+ * import { heliocentric } from "@johnmorrisdotca/wakusei-planets";
138
+ * import { roadsterPositionAu } from "@johnmorrisdotca/wakusei-planets/roadster";
139
+ *
140
+ * const day = Date.UTC(2020, 9, 7);
141
+ * const [c, m] = [roadsterPositionAu(day), heliocentric("mars", day)];
142
+ * console.log(Math.hypot(c[0] - m[0], c[1] - m[1], c[2] - m[2]).toFixed(3), "au from Mars");
143
+ * ```
144
+ */
145
+ export function roadsterPositionAu(when) {
146
+ return scale(roadsterPosition(when), 1 / AU_KM);
147
+ }
148
+ /**
149
+ * The car's velocity relative to the Sun at a moment, in kilometres a second, in the same frame as `roadsterPosition`. It is the slope of the interpolation, within 2.3 metres a second of Horizons' own after the first day (up to 115 metres a second in the first day, while the Earth still bends the path).
150
+ *
151
+ * @param when - A `Date` or milliseconds since 1970 (UTC).
152
+ * @returns The velocity.
153
+ *
154
+ * @example
155
+ * ```ts
156
+ * import { roadsterVelocity } from "@johnmorrisdotca/wakusei-planets/roadster";
157
+ *
158
+ * console.log(roadsterVelocity(Date.UTC(2024, 0, 1)).map((v) => v.toFixed(2)));
159
+ * ```
160
+ */
161
+ export function roadsterVelocity(when) {
162
+ return state(moment(when)).velocity;
163
+ }
164
+ /**
165
+ * The car's speed relative to the Sun at a moment, in kilometres a second.
166
+ *
167
+ * @param when - A `Date` or milliseconds since 1970 (UTC).
168
+ * @returns The speed.
169
+ *
170
+ * @example
171
+ * ```ts
172
+ * import { roadsterSpeed } from "@johnmorrisdotca/wakusei-planets/roadster";
173
+ *
174
+ * console.log(roadsterSpeed(Date.UTC(2026, 10, 11)).toFixed(1), "km/s");
175
+ * ```
176
+ */
177
+ export function roadsterSpeed(when) {
178
+ return length(roadsterVelocity(when));
179
+ }
180
+ /** A planet's position (km) and velocity (km/s) from the Sun at a UTC moment: `heliocentric`, and its slope over two hours either side (the curve is smooth, so the error is far below a millimetre a second). */
181
+ function planetState(id, ms) {
182
+ const h = 3_600_000;
183
+ const at = (t) => scale(heliocentric(id, t), AU_KM);
184
+ return { position: at(ms), velocity: scale(sub(at(ms + h), at(ms - h)), 1 / 7200) };
185
+ }
186
+ /** The osculating orbit of a state about the Sun. */
187
+ function elementsOf(position, velocity) {
188
+ const r = length(position);
189
+ const v2 = dot(velocity, velocity);
190
+ const h = cross(position, velocity);
191
+ const hLength = length(h);
192
+ const eccentricityVector = sub(scale(cross(velocity, h), 1 / GM_SUN), scale(position, 1 / r));
193
+ const e = length(eccentricityVector);
194
+ const a = 1 / (2 / r - v2 / GM_SUN);
195
+ const node = unit([-h[1], h[0], 0]);
196
+ const nodeAngle = Math.atan2(h[0], -h[1]);
197
+ const perihelionAngle = Math.atan2(dot(cross(node, eccentricityVector), unit(h)), dot(node, eccentricityVector));
198
+ const trueAnomaly = Math.atan2(dot(cross(eccentricityVector, position), unit(h)), dot(eccentricityVector, position));
199
+ const eccentricAnomaly = 2 * Math.atan2(Math.sqrt(1 - e) * Math.sin(trueAnomaly / 2), Math.sqrt(1 + e) * Math.cos(trueAnomaly / 2));
200
+ const meanAnomaly = eccentricAnomaly - e * Math.sin(eccentricAnomaly);
201
+ const turn = (radians) => (((radians * 180) / Math.PI) % 360 + 360) % 360;
202
+ return {
203
+ semiMajorAxisKm: a,
204
+ semiMajorAxisAu: a / AU_KM,
205
+ eccentricity: e,
206
+ inclination: (Math.acos(h[2] / hLength) * 180) / Math.PI,
207
+ ascendingNode: turn(nodeAngle),
208
+ argumentOfPerihelion: turn(perihelionAngle),
209
+ meanAnomaly: turn(meanAnomaly),
210
+ trueAnomaly: turn(trueAnomaly),
211
+ periodDays: (2 * Math.PI * Math.sqrt((a * a * a) / GM_SUN)) / 86_400,
212
+ perihelionKm: a * (1 - e),
213
+ perihelionAu: (a * (1 - e)) / AU_KM,
214
+ aphelionKm: a * (1 + e),
215
+ aphelionAu: (a * (1 + e)) / AU_KM,
216
+ };
217
+ }
218
+ /**
219
+ * The osculating orbital elements about the Sun at a moment, from the state vector (the same numbers Horizons lists as EC, QR, IN, OM, W, A, AD and PR).
220
+ *
221
+ * @param when - A `Date` or milliseconds since 1970 (UTC).
222
+ * @returns The elements.
223
+ *
224
+ * @example
225
+ * ```ts
226
+ * import { roadsterElements } from "@johnmorrisdotca/wakusei-planets/roadster";
227
+ *
228
+ * const orbit = roadsterElements(new Date("2026-11-11T00:00:00Z"));
229
+ * console.log(`perihelion ${orbit.perihelionAu.toFixed(3)} au, aphelion ${orbit.aphelionAu.toFixed(3)} au, period ${orbit.periodDays.toFixed(0)} days`);
230
+ * ```
231
+ */
232
+ export function roadsterElements(when) {
233
+ const { position, velocity } = state(moment(when));
234
+ return elementsOf(position, velocity);
235
+ }
236
+ /** The angle, in radians, that the car sweeps round the Sun between two states, about the direction of their angular momentum. */
237
+ function sweep(p0, v0, p1, v1) {
238
+ const axis = unit(add(cross(p0, v0), cross(p1, v1)));
239
+ return Math.atan2(dot(cross(p0, p1), axis), dot(p0, p1));
240
+ }
241
+ /** The angle swept round the Sun, in radians, from the first row to each row. A deterministic function of the table, worked out once. */
242
+ let swept;
243
+ function sweptAtRows() {
244
+ if (swept !== undefined)
245
+ return swept;
246
+ const out = new Float64Array(COUNT);
247
+ for (let i = 1; i < COUNT; i += 1) {
248
+ const a = (i - 1) * STRIDE;
249
+ const b = i * STRIDE;
250
+ out[i] = out[i - 1] + sweep([ROWS[a + 1], ROWS[a + 2], ROWS[a + 3]], [ROWS[a + 4], ROWS[a + 5], ROWS[a + 6]], [ROWS[b + 1], ROWS[b + 2], ROWS[b + 3]], [ROWS[b + 4], ROWS[b + 5], ROWS[b + 6]]);
251
+ }
252
+ swept = out;
253
+ return out;
254
+ }
255
+ /** The orbits of the Sun the car has made at a moment: the angle swept round the Sun since the launch over a full turn. The six hours from the launch to the first row are counted at the rate of that row (under a thousandth of an orbit). */
256
+ function orbitsAt(ms) {
257
+ const { position, velocity, seconds } = state(ms);
258
+ let lo = 0;
259
+ let hi = COUNT - 2;
260
+ while (lo < hi) {
261
+ const mid = (lo + hi + 1) >> 1;
262
+ if (ROWS[mid * STRIDE] * 3600 <= seconds)
263
+ lo = mid;
264
+ else
265
+ hi = mid - 1;
266
+ }
267
+ const a = lo * STRIDE;
268
+ const angle = sweptAtRows()[lo] + sweep([ROWS[a + 1], ROWS[a + 2], ROWS[a + 3]], [ROWS[a + 4], ROWS[a + 5], ROWS[a + 6]], position, velocity);
269
+ const first = { position: [ROWS[1], ROWS[2], ROWS[3]], velocity: [ROWS[4], ROWS[5], ROWS[6]] };
270
+ const rate = length(cross(first.position, first.velocity)) / dot(first.position, first.position);
271
+ const before = Math.max(0, (ROADSTER_START - toTerrestrialTime(LAUNCH)) / 1000);
272
+ return (angle + rate * before) / (2 * Math.PI);
273
+ }
274
+ /** The scan step for close approaches, in milliseconds. */
275
+ const UTC_STEP_MS = 2 * DAY_MS;
276
+ /** A closest approach counts when the distance falls under this many astronomical units: the Earth and Mars come to a least distance every few years, and most of those are far off. */
277
+ const APPROACH_AU = 1;
278
+ const approachMemo = new Map();
279
+ /** The distance between the car and a planet at a UTC moment, in kilometres. */
280
+ function distanceTo(id, ms) {
281
+ return length(sub(state(ms).position, scale(heliocentric(id, ms), AU_KM)));
282
+ }
283
+ /**
284
+ * Every closest approach of the car to the Earth or to Mars inside the span of the path, in date order: a least value of the distance between the centres that is under one astronomical unit (found by scanning every two days and then narrowing each minimum to about a second).
285
+ * The car's launch, before the span, and the end of the span are not counted. The answer is the same every time, so it is worked out once and kept.
286
+ *
287
+ * @param body - `"earth"` or `"mars"`.
288
+ * @returns The approaches.
289
+ *
290
+ * @example
291
+ * ```ts
292
+ * import { roadsterApproaches } from "@johnmorrisdotca/wakusei-planets/roadster";
293
+ *
294
+ * for (const a of roadsterApproaches("mars")) console.log(new Date(a.date).toISOString().slice(0, 10), (a.distanceKm / 149597870.7).toFixed(3), "au");
295
+ * ```
296
+ */
297
+ export function roadsterApproaches(body) {
298
+ if (body !== "earth" && body !== "mars")
299
+ throw new RangeError(`body must be "earth" or "mars", got ${JSON.stringify(body)}`);
300
+ const kept = approachMemo.get(body);
301
+ if (kept !== undefined)
302
+ return kept;
303
+ const times = [];
304
+ const distances = [];
305
+ for (let t = RECORD_START; t < RECORD_END; t += UTC_STEP_MS) {
306
+ times.push(t);
307
+ distances.push(distanceTo(body, t));
308
+ }
309
+ times.push(RECORD_END);
310
+ distances.push(distanceTo(body, RECORD_END));
311
+ const found = [];
312
+ const phi = (Math.sqrt(5) - 1) / 2;
313
+ for (let i = 1; i < times.length - 1; i += 1) {
314
+ if (!(distances[i] < distances[i - 1] && distances[i] <= distances[i + 1] && distances[i] < APPROACH_AU * AU_KM * 1.05))
315
+ continue;
316
+ let lo = times[i - 1];
317
+ let hi = Math.min(times[i + 1], RECORD_END);
318
+ let c = hi - phi * (hi - lo);
319
+ let d = lo + phi * (hi - lo);
320
+ let fc = distanceTo(body, c);
321
+ let fd = distanceTo(body, d);
322
+ while (hi - lo > 1000) {
323
+ if (fc < fd) {
324
+ hi = d;
325
+ d = c;
326
+ fd = fc;
327
+ c = hi - phi * (hi - lo);
328
+ fc = distanceTo(body, c);
329
+ }
330
+ else {
331
+ lo = c;
332
+ c = d;
333
+ fc = fd;
334
+ d = lo + phi * (hi - lo);
335
+ fd = distanceTo(body, d);
336
+ }
337
+ }
338
+ const date = (lo + hi) / 2;
339
+ const distanceKm = distanceTo(body, date);
340
+ if (distanceKm < APPROACH_AU * AU_KM)
341
+ found.push({ date, distanceKm });
342
+ }
343
+ approachMemo.set(body, found);
344
+ return found;
345
+ }
346
+ const distanceOf = (km) => ({ km, miles: km / MILE_KM, au: km / AU_KM, lightSeconds: km / LIGHT_KM_PER_SECOND });
347
+ function neighbours(list, ms) {
348
+ let previous = null;
349
+ let next = null;
350
+ for (const a of list) {
351
+ if (a.date <= ms)
352
+ previous = a;
353
+ else {
354
+ next = a;
355
+ break;
356
+ }
357
+ }
358
+ return { previous, next };
359
+ }
360
+ /**
361
+ * The car's numbers at a moment: its distance from the Sun, the Earth and Mars in kilometres, miles and astronomical units with the light time, its speed relative to each, the days since launch, the orbits of the Sun made, the period of its orbit now,
362
+ * and the closest approaches to the Earth and Mars before and after the moment inside the span. The Earth and Mars come from the package's own positions (`heliocentric`), with no allowance for the light's travel.
363
+ * A moment outside `ROADSTER.record` throws a `RangeError`.
364
+ *
365
+ * @param when - A `Date` or milliseconds since 1970 (UTC).
366
+ * @returns The numbers.
367
+ *
368
+ * @example
369
+ * ```ts
370
+ * import { roadsterStats } from "@johnmorrisdotca/wakusei-planets/roadster";
371
+ *
372
+ * const stats = roadsterStats(new Date("2026-11-11T12:00:00Z"));
373
+ * console.log(Math.round(stats.earth.km / 1e6), "million km from the Earth,", stats.orbitsCompleted, "orbits of the Sun,", stats.speed.sun.toFixed(1), "km/s");
374
+ * ```
375
+ */
376
+ export function roadsterStats(when) {
377
+ const ms = moment(when);
378
+ const { position, velocity } = state(ms);
379
+ const earth = planetState("earth", ms);
380
+ const mars = planetState("mars", ms);
381
+ const orbits = orbitsAt(ms);
382
+ return {
383
+ when: ms,
384
+ sun: distanceOf(length(position)),
385
+ earth: distanceOf(length(sub(position, earth.position))),
386
+ mars: distanceOf(length(sub(position, mars.position))),
387
+ speed: { sun: length(velocity), earth: length(sub(velocity, earth.velocity)), mars: length(sub(velocity, mars.velocity)) },
388
+ daysSinceLaunch: (ms - LAUNCH) / DAY_MS,
389
+ orbits,
390
+ orbitsCompleted: Math.floor(orbits),
391
+ periodDays: elementsOf(position, velocity).periodDays,
392
+ approaches: { earth: neighbours(roadsterApproaches("earth"), ms), mars: neighbours(roadsterApproaches("mars"), ms) },
393
+ };
394
+ }
395
+ const NAMES = {
396
+ launch: { en: "Launch", ja: "打ち上げ" },
397
+ "earth-approach": { en: "Closest approach to the Earth", ja: "地球に最接近" },
398
+ "mars-approach": { en: "Closest approach to Mars", ja: "火星に最接近" },
399
+ perihelion: { en: "Perihelion (closest to the Sun)", ja: "近日点通過" },
400
+ aphelion: { en: "Aphelion (furthest from the Sun)", ja: "遠日点通過" },
401
+ };
402
+ let eventMemo;
403
+ /** The moments of perihelion and aphelion: where the radial speed (the dot product of the position and the velocity) changes sign, found between rows and narrowed by bisection. */
404
+ function sunExtremes() {
405
+ const out = [];
406
+ const radial = (i) => ROWS[i * STRIDE + 1] * ROWS[i * STRIDE + 4] + ROWS[i * STRIDE + 2] * ROWS[i * STRIDE + 5] + ROWS[i * STRIDE + 3] * ROWS[i * STRIDE + 6];
407
+ for (let i = 0; i < COUNT - 1; i += 1) {
408
+ const before = radial(i);
409
+ const after = radial(i + 1);
410
+ if (before === 0 || Math.sign(before) === Math.sign(after))
411
+ continue;
412
+ let lo = ROADSTER_START + ROWS[i * STRIDE] * 3_600_000;
413
+ let hi = ROADSTER_START + ROWS[(i + 1) * STRIDE] * 3_600_000;
414
+ const at = (tt) => {
415
+ const s = state(utcOfTerrestrial(tt));
416
+ return dot(s.position, s.velocity);
417
+ };
418
+ const sign = Math.sign(before);
419
+ while (hi - lo > 100) {
420
+ const mid = (lo + hi) / 2;
421
+ if (Math.sign(at(mid)) === sign)
422
+ lo = mid;
423
+ else
424
+ hi = mid;
425
+ }
426
+ const date = utcOfTerrestrial((lo + hi) / 2);
427
+ const kind = sign < 0 ? "perihelion" : "aphelion";
428
+ out.push({ kind, date, name: NAMES[kind], distanceKm: length(state(date).position) });
429
+ }
430
+ return out;
431
+ }
432
+ /**
433
+ * Every moment of the car's story the table can find, in date order, each with a name in English and Japanese: the launch, each closest approach to the Earth and to Mars, and each perihelion and aphelion passage inside the span.
434
+ * A page can list them and jump to any one. The answer is the same every time, so it is worked out once and kept.
435
+ *
436
+ * @returns The events.
437
+ *
438
+ * @example
439
+ * ```ts
440
+ * import { roadsterEvents } from "@johnmorrisdotca/wakusei-planets/roadster";
441
+ *
442
+ * for (const e of roadsterEvents().slice(0, 5)) console.log(new Date(e.date).toISOString().slice(0, 10), e.name.en);
443
+ * ```
444
+ */
445
+ export function roadsterEvents() {
446
+ if (eventMemo !== undefined)
447
+ return eventMemo;
448
+ const list = [{ kind: "launch", date: LAUNCH, name: NAMES.launch }];
449
+ for (const a of roadsterApproaches("earth"))
450
+ list.push({ kind: "earth-approach", date: a.date, name: NAMES["earth-approach"], distanceKm: a.distanceKm });
451
+ for (const a of roadsterApproaches("mars"))
452
+ list.push({ kind: "mars-approach", date: a.date, name: NAMES["mars-approach"], distanceKm: a.distanceKm });
453
+ list.push(...sunExtremes());
454
+ eventMemo = list.sort((a, b) => a.date - b.date);
455
+ return eventMemo;
456
+ }
457
+ /** The most moments one series holds, so that one call cannot take the page's time. */
458
+ const MAX_SERIES = 100_000;
459
+ /**
460
+ * The car's distance from the Sun, the Earth and Mars, and its speed relative to the Sun, at equal steps from one moment to another, ready to graph. Both ends must be inside `ROADSTER.record`; a step that is not positive, or a series of more than 100,000 moments, throws a `RangeError`.
461
+ *
462
+ * @param from - The first moment: a `Date` or milliseconds since 1970 (UTC).
463
+ * @param to - The last moment, not before the first.
464
+ * @param stepMs - The step in milliseconds.
465
+ * @returns The series.
466
+ *
467
+ * @example
468
+ * ```ts
469
+ * import { roadsterSeries } from "@johnmorrisdotca/wakusei-planets/roadster";
470
+ *
471
+ * const { times, earthKm } = roadsterSeries(new Date("2019-01-01T00:00:00Z"), new Date("2020-01-01T00:00:00Z"), 7 * 86_400_000);
472
+ * console.log(times.length, "weeks; nearest", Math.round(Math.min(...earthKm) / 1e6), "million km from the Earth");
473
+ * ```
474
+ */
475
+ export function roadsterSeries(from, to, stepMs) {
476
+ const start = moment(from, "from");
477
+ const end = moment(to, "to");
478
+ if (!Number.isFinite(stepMs) || !(stepMs > 0))
479
+ throw new RangeError(`stepMs must be a positive number of milliseconds, got ${String(stepMs)}`);
480
+ if (end < start)
481
+ throw new RangeError("to must not be before from");
482
+ const count = Math.floor((end - start) / stepMs) + 1;
483
+ if (count > MAX_SERIES)
484
+ throw new RangeError(`${count} moments is more than the ${MAX_SERIES} a series holds: use a larger step`);
485
+ const series = { times: [], sunKm: [], earthKm: [], marsKm: [], speed: [] };
486
+ for (let i = 0; i < count; i += 1) {
487
+ const ms = start + i * stepMs;
488
+ const { position, velocity } = state(ms);
489
+ series.times.push(ms);
490
+ series.sunKm.push(length(position));
491
+ series.earthKm.push(length(sub(position, scale(heliocentric("earth", ms), AU_KM))));
492
+ series.marsKm.push(length(sub(position, scale(heliocentric("mars", ms), AU_KM))));
493
+ series.speed.push(length(velocity));
494
+ }
495
+ return series;
496
+ }
@@ -8,7 +8,7 @@ import { fallbackLook } from "./fallback.js";
8
8
  import { writeBasis } from "./basis.js";
9
9
  import { loadImage } from "./textures.js";
10
10
  import { ringStrip } from "./rings.js";
11
- import { createNameLabel, nameLabelKey } from "./name-label.js";
11
+ import { createNameLabel } from "./name-label.js";
12
12
  export { fallbackLook } from "./fallback.js";
13
13
  /** The shader material of a body: its surface code with the look's lighting and glow uniforms. A star made from numbers is drawn with it too (the size line-up). */
14
14
  export function makeBodyMaterial(T, look, painted) {
@@ -355,13 +355,13 @@ export function createBodyItem(options) {
355
355
  }
356
356
  };
357
357
  // the name on the globe: a child of the mesh, so it turns with the body
358
+ // the element hands over the same label object until a setting changes, so a draw compares by reference and does no work when nothing did
358
359
  let label;
359
- let labelKey = "";
360
+ let labelApplied = undefined;
360
361
  const syncLabel = (state) => {
361
- const key = state.label ? nameLabelKey(state.label.text, state.label) : "";
362
- if (key === labelKey)
362
+ if (state.label === labelApplied)
363
363
  return;
364
- labelKey = key;
364
+ labelApplied = state.label;
365
365
  if (!state.label) {
366
366
  if (label !== undefined) {
367
367
  mesh.remove(label.object);
@@ -370,13 +370,14 @@ export function createBodyItem(options) {
370
370
  }
371
371
  return;
372
372
  }
373
- const { text, ...rest } = state.label;
374
373
  if (label === undefined) {
375
- label = createNameLabel(T, text, rest, look.emissive === true, () => options.redraw());
374
+ label = createNameLabel(T, state.label.text, state.label, look.emissive === true, () => options.redraw());
376
375
  mesh.add(label.object);
377
376
  }
378
- else
379
- label.set(text, rest);
377
+ else {
378
+ label.set(state.label.text, state.label);
379
+ options.redraw();
380
+ }
380
381
  };
381
382
  const light = new T.Vector3();
382
383
  const pole = new T.Vector3();
@@ -134,7 +134,7 @@ export interface PaintInfo {
134
134
  */
135
135
  export interface Painting {
136
136
  object: THREE.Object3D;
137
- /** True to have the caller turn the object to face the camera (the Sun, which carries a glow). */
137
+ /** True to have the caller turn the whole object to face the camera. No body asks for it now: the Sun is a globe that turns with its own spin and the view, and its glow turns itself to the camera in `update` (from `PaintInfo.view`). */
138
138
  billboard?: boolean;
139
139
  /** Call at each draw, after the object has been placed and scaled. */
140
140
  update(info: PaintInfo): void;
@@ -218,7 +218,8 @@ function paint(T, id, context, bases) {
218
218
  m.uniforms.uRingR.value.set(ringInner, ringOuter);
219
219
  }
220
220
  }
221
- // the glow of a star: a plane through its centre that the caller turns to the camera
221
+ // the glow of a star: a plane through its centre that `update` turns to the camera, so the globe inside it keeps its own orientation
222
+ let glowMesh;
222
223
  if (look.emissive === true) {
223
224
  const glowGeometry = acquire(T, "glow", () => new T.PlaneGeometry(6, 6));
224
225
  releases.push(glowGeometry.release);
@@ -228,6 +229,7 @@ function paint(T, id, context, bases) {
228
229
  glow.renderOrder = 4;
229
230
  glow.frustumCulled = false;
230
231
  group.add(glow);
232
+ glowMesh = glow;
231
233
  }
232
234
  // the painted map: the smallest width at once, a sharper one when the body is big on the screen, back to the small one when it is not
233
235
  const widths = (look.painted?.widths ?? []).filter((w, i) => i === 0 || w <= maxWidth);
@@ -342,6 +344,8 @@ function paint(T, id, context, bases) {
342
344
  let label;
343
345
  let labelText = "";
344
346
  let labelShown = false;
347
+ // what `label` reports: one object, written at each draw (it is read for every body at every frame)
348
+ const labelReport = { shown: false, text: "", turn: 0 };
345
349
  const setLabel = (next) => {
346
350
  if (next === null || next === undefined || gone) {
347
351
  if (label !== undefined) {
@@ -349,26 +353,29 @@ function paint(T, id, context, bases) {
349
353
  label.dispose();
350
354
  label = undefined;
351
355
  labelShown = false;
356
+ labelReport.shown = false;
352
357
  }
353
358
  return;
354
359
  }
355
360
  const { lang, text, ...options } = next;
356
361
  labelText = text ?? nameLabelText(facts.name, lang ?? "en");
362
+ labelReport.text = labelText;
357
363
  if (label === undefined) {
358
364
  label = createNameLabel(T, labelText, options, look.emissive === true, redraw);
359
365
  mesh.add(label.object);
360
366
  }
361
- else
367
+ else {
362
368
  label.set(labelText, options);
369
+ redraw();
370
+ }
363
371
  };
364
372
  if (context.label)
365
373
  setLabel(context.label);
366
374
  return {
367
375
  object: group,
368
- ...(look.emissive === true ? { billboard: true } : {}),
369
376
  setLabel,
370
377
  get label() {
371
- return label === undefined ? null : { shown: labelShown, text: labelText, turn: label.object.children[0] !== undefined ? label.object.children[0].rotation.y : 0 };
378
+ return label === undefined ? null : labelReport;
372
379
  },
373
380
  get tiles() {
374
381
  return detail?.stats;
@@ -376,10 +383,15 @@ function paint(T, id, context, bases) {
376
383
  update(info) {
377
384
  light.set(info.toSun[0], info.toSun[1], info.toSun[2]);
378
385
  const scale = group.scale.x || 1;
379
- if (look.emissive !== true) {
386
+ // a star's glow faces the camera, when `update` is given the camera (`info.view`): without it the glow keeps its last turn, so a caller that used to turn the Sun's object itself passes `view` now. The group is
387
+ // never turned, so `camera.quaternion` (the camera's local turn, which is its world turn for a camera with no parent, as the views here have) is the glow's own; the globe inside it has the body's own
388
+ // pole and prime meridian like every other body
389
+ if (glowMesh !== undefined && info.view !== undefined)
390
+ glowMesh.quaternion.copy(info.view.camera.quaternion);
391
+ {
380
392
  const { pole, meridian } = info.pose ?? orientation(id, info.ms);
381
393
  const east = cross(pole, meridian);
382
- if (detail !== undefined) {
394
+ if (look.emissive !== true && detail !== undefined) {
383
395
  // a body big enough in the view, seen by a camera we were told of, is worked out for a window of finer map; any other keeps the pictures it has
384
396
  if (info.view === undefined || mesh.material !== paintedMaterial || info.radiusPx * ratio < TILES_FROM_PX)
385
397
  detail.rest();
@@ -410,7 +422,11 @@ function paint(T, id, context, bases) {
410
422
  keepSized(info.radiusPx);
411
423
  if (label !== undefined) {
412
424
  label.update(info.view?.camera, info.radiusPx, info.toSun);
413
- labelShown = label.object.children[0] !== undefined && label.object.children[0].visible;
425
+ const inner = label.object.children[0];
426
+ labelShown = inner !== undefined && inner.visible;
427
+ labelReport.shown = labelShown;
428
+ labelReport.text = labelText;
429
+ labelReport.turn = inner?.rotation.y ?? 0;
414
430
  }
415
431
  },
416
432
  dispose() {
@@ -11,7 +11,7 @@ import { type BodyMapSource } from "../door/map.ts";
11
11
  * console.log(TEXTURE_BASE);
12
12
  * ```
13
13
  */
14
- export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.34.0/dist/textures/";
14
+ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.35.0/dist/textures/";
15
15
  /**
16
16
  * Where the sharpest surface pictures are: the files of this exact version in the repository, on jsDelivr's GitHub address. The npm package holds only the two smaller widths, so a page that
17
17
  * never zooms in never fetches them. Set `texture-far-base` on an element to serve them yourself.
@@ -23,7 +23,7 @@ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdot
23
23
  * console.log(TEXTURE_FAR_BASE);
24
24
  * ```
25
25
  */
26
- export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.34.0/textures/";
26
+ export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.35.0/textures/";
27
27
  /**
28
28
  * Where the finer map tiles are by default: the demo site's `tiles/` folder (GitHub Pages sends `access-control-allow-origin: *`). The tiles are made by `scripts/make-body-tiles.py` and are in no package and no repository:
29
29
  * a page that serves its own gives the folder in the `tiles` attribute, and `tiles="off"` turns them off. A page that sets `texture-base` (it serves its own pictures) has none unless it says where they are.