@johnmorrisdotca/chikyu-earth 0.24.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 +10 -0
- package/NOTICE.md +7 -1
- package/README.md +51 -10
- package/dist/data/meteor-showers.d.ts +53 -0
- package/dist/data/meteor-showers.js +57 -0
- package/dist/meteors/index.d.ts +3 -0
- package/dist/meteors/index.js +6 -0
- package/dist/meteors/layer.d.ts +108 -0
- package/dist/meteors/layer.js +337 -0
- package/dist/meteors/note.d.ts +11 -0
- package/dist/meteors/note.js +19 -0
- package/dist/meteors/rate.d.ts +206 -0
- package/dist/meteors/rate.js +252 -0
- package/dist/realistic/earth.d.ts +51 -2
- package/dist/realistic/earth.js +87 -9
- package/dist/realistic/element.d.ts +72 -1
- package/dist/realistic/element.js +218 -8
- package/dist/realistic/index.d.ts +2 -2
- package/dist/realistic/index.js +2 -2
- package/dist/realistic/shaders.d.ts +1 -1
- package/dist/realistic/shaders.js +61 -13
- package/dist/realistic/sun.d.ts +14 -0
- package/dist/realistic/sun.js +19 -1
- package/dist/realistic/tile-set.d.ts +2 -0
- package/dist/realistic/tile-set.js +1 -0
- package/dist/space/element.d.ts +35 -2
- package/dist/space/element.js +109 -6
- package/dist/space/index.d.ts +1 -1
- package/dist/space/index.js +1 -1
- package/dist/space/satellite-layer.d.ts +3 -3
- package/dist/space/satellite-layer.js +26 -13
- package/dist/space/scene.d.ts +48 -3
- package/dist/space/scene.js +81 -9
- package/package.json +6 -1
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { METEOR_SHOWERS } from "../data/meteor-showers.js";
|
|
2
|
+
const RAD = Math.PI / 180;
|
|
3
|
+
const DAY_MS = 86_400_000;
|
|
4
|
+
const wrap360 = (degrees) => ((degrees % 360) + 360) % 360;
|
|
5
|
+
const wrap180 = (degrees) => ((((degrees + 180) % 360) + 360) % 360) - 180;
|
|
6
|
+
/**
|
|
7
|
+
* The heights between which most meteors shine, in kilometres above the ground: they light up near the top and have burnt out by the bottom.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { METEOR_HEIGHT_KM } from "@johnmorrisdotca/chikyu-earth/meteors";
|
|
12
|
+
*
|
|
13
|
+
* console.log(METEOR_HEIGHT_KM.top, METEOR_HEIGHT_KM.bottom); // 120 80
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export const METEOR_HEIGHT_KM = { top: 120, bottom: 80 };
|
|
17
|
+
/**
|
|
18
|
+
* The hourly rate taken for the meteors that belong to no shower (the sporadic background), for an ideal watcher under a perfect sky.
|
|
19
|
+
* It is an assumed round figure, not one from the shower list: the real count runs from a few an hour in the evening to over ten before dawn.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* import { SPORADIC_HOURLY_RATE } from "@johnmorrisdotca/chikyu-earth/meteors";
|
|
24
|
+
*
|
|
25
|
+
* console.log(SPORADIC_HOURLY_RATE); // 8
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export const SPORADIC_HOURLY_RATE = 8;
|
|
29
|
+
/**
|
|
30
|
+
* The Sun's longitude along the ecliptic for the equinox of 2000.0, in degrees: the measure the shower list times its maxima by.
|
|
31
|
+
* Low precision (Meeus, Astronomical Algorithms, ch. 25, with the precession since 2000 taken off), good to about 0.01 degree from 1900 to 2100.
|
|
32
|
+
*
|
|
33
|
+
* @param ms - The moment, in milliseconds since the epoch.
|
|
34
|
+
* @returns The longitude, 0 up to 360.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* import { solarLongitude } from "@johnmorrisdotca/chikyu-earth/meteors";
|
|
39
|
+
*
|
|
40
|
+
* // The Perseids' maximum is at 140.0 degrees.
|
|
41
|
+
* console.log(solarLongitude(Date.UTC(2026, 7, 13, 2)).toFixed(1));
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export function solarLongitude(ms) {
|
|
45
|
+
const t = (ms / DAY_MS + 2_440_587.5 - 2_451_545) / 36_525;
|
|
46
|
+
const meanLongitude = 280.46646 + t * (36_000.76983 + t * 0.0003032);
|
|
47
|
+
const meanAnomaly = (357.52911 + t * (35_999.05029 - t * 0.0001537)) * RAD;
|
|
48
|
+
const centre = (1.914602 - t * (0.004817 + 0.000014 * t)) * Math.sin(meanAnomaly) + (0.019993 - 0.000101 * t) * Math.sin(2 * meanAnomaly) + 0.000289 * Math.sin(3 * meanAnomaly);
|
|
49
|
+
// the longitude of the date, taken back to the equinox of 2000.0 (the equinox slides 1.397 degrees a century)
|
|
50
|
+
return wrap360(meanLongitude + centre - 1.397 * t);
|
|
51
|
+
}
|
|
52
|
+
/** Greenwich sidereal time, in degrees: how far the Earth has turned against the stars. */
|
|
53
|
+
function siderealGreenwich(ms) {
|
|
54
|
+
const days = ms / DAY_MS + 2_440_587.5 - 2_451_545;
|
|
55
|
+
const t = days / 36_525;
|
|
56
|
+
return wrap360(280.46061837 + 360.98564736629 * days + 0.000387933 * t * t);
|
|
57
|
+
}
|
|
58
|
+
/** How far the Sun's longitude is from a shower's maximum at the start of its first day and the end of its last, in degrees (both positive). The list's dates are right for 2026, so that year's Sun is read. */
|
|
59
|
+
const spans = new WeakMap();
|
|
60
|
+
function span(shower) {
|
|
61
|
+
let found = spans.get(shower);
|
|
62
|
+
if (!found) {
|
|
63
|
+
const first = solarLongitude(Date.UTC(2026, shower.start[0] - 1, shower.start[1]));
|
|
64
|
+
const last = solarLongitude(Date.UTC(2026, shower.end[0] - 1, shower.end[1] + 1));
|
|
65
|
+
found = { before: Math.max(0, -wrap180(first - shower.peakSolarLongitude)), after: Math.max(0, wrap180(last - shower.peakSolarLongitude)) };
|
|
66
|
+
spans.set(shower, found);
|
|
67
|
+
}
|
|
68
|
+
return found;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* How strong a shower is at a moment: its zenithal hourly rate then, 0 outside its dates.
|
|
72
|
+
* The list gives the rate at the maximum and the first and last days of activity; between them this draws the simplest curve that fits:
|
|
73
|
+
* the rate falls away from the maximum by the same factor for each degree the Earth moves on, down to half a meteor an hour at the start of the first day and the end of the last.
|
|
74
|
+
* A real shower's curve differs (the Quadrantids' maximum lasts hours, the Taurids' weeks). A shower the list calls variable gives 0.
|
|
75
|
+
*
|
|
76
|
+
* @param shower - A shower of `METEOR_SHOWERS`.
|
|
77
|
+
* @param ms - The moment, in milliseconds since the epoch.
|
|
78
|
+
* @returns The zenithal hourly rate, in meteors an hour.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* import { METEOR_SHOWERS, showerRate } from "@johnmorrisdotca/chikyu-earth/meteors";
|
|
83
|
+
*
|
|
84
|
+
* const geminids = METEOR_SHOWERS.find((shower) => shower.code === "GEM")!;
|
|
85
|
+
* console.log(showerRate(geminids, Date.UTC(2026, 11, 14, 8)).toFixed(0), showerRate(geminids, Date.UTC(2026, 5, 1))); // "150" 0
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export function showerRate(shower, ms) {
|
|
89
|
+
if (shower.zhr === null)
|
|
90
|
+
return 0;
|
|
91
|
+
const from = wrap180(solarLongitude(ms) - shower.peakSolarLongitude);
|
|
92
|
+
const { before, after } = span(shower);
|
|
93
|
+
const reach = from < 0 ? before : after;
|
|
94
|
+
if (Math.abs(from) > reach)
|
|
95
|
+
return 0;
|
|
96
|
+
if (reach === 0 || shower.zhr <= FLOOR)
|
|
97
|
+
return shower.zhr;
|
|
98
|
+
return shower.zhr * Math.pow(FLOOR / shower.zhr, Math.abs(from) / reach);
|
|
99
|
+
}
|
|
100
|
+
/** The rate a shower is taken to have on its first and last day, in meteors an hour. */
|
|
101
|
+
const FLOOR = 0.5;
|
|
102
|
+
/**
|
|
103
|
+
* The showers active at a moment, strongest first, each with its rate then.
|
|
104
|
+
*
|
|
105
|
+
* @param ms - The moment, in milliseconds since the epoch.
|
|
106
|
+
* @returns The active showers and their zenithal hourly rates (see `showerRate`).
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* import { activeShowers } from "@johnmorrisdotca/chikyu-earth/meteors";
|
|
111
|
+
*
|
|
112
|
+
* for (const { shower, zhr } of activeShowers(Date.UTC(2026, 7, 12))) console.log(shower.name, zhr.toFixed(1));
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export function activeShowers(ms) {
|
|
116
|
+
return METEOR_SHOWERS.map((shower) => ({ shower, zhr: showerRate(shower, ms) }))
|
|
117
|
+
.filter((entry) => entry.zhr > 0)
|
|
118
|
+
.sort((a, b) => b.zhr - a.zhr);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The place on the Earth where a point of the sky stands overhead at a moment: for a shower's radiant, the middle of the half
|
|
122
|
+
* of the Earth its meteors fall on.
|
|
123
|
+
*
|
|
124
|
+
* @param sky - Right ascension and declination, in degrees.
|
|
125
|
+
* @param ms - The moment, in milliseconds since the epoch.
|
|
126
|
+
* @returns The longitude and latitude of that place, in degrees.
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```ts
|
|
130
|
+
* import { METEOR_SHOWERS, pointBeneath } from "@johnmorrisdotca/chikyu-earth/meteors";
|
|
131
|
+
*
|
|
132
|
+
* const perseids = METEOR_SHOWERS.find((shower) => shower.code === "PER")!;
|
|
133
|
+
* const place = pointBeneath(perseids.radiant, Date.UTC(2026, 7, 13, 2));
|
|
134
|
+
* console.log(place.lat, place.lon.toFixed(0)); // 58 and the longitude then
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
export function pointBeneath(sky, ms) {
|
|
138
|
+
return { lon: wrap180(sky.ra - siderealGreenwich(ms)), lat: sky.dec };
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The place on the Earth that faces the way the Earth is travelling round the Sun (the apex of its way): it sits on the morning side,
|
|
142
|
+
* which sweeps up more meteors than the evening side.
|
|
143
|
+
*
|
|
144
|
+
* @param ms - The moment, in milliseconds since the epoch.
|
|
145
|
+
* @returns The longitude and latitude of that place, in degrees.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts
|
|
149
|
+
* import { apexPoint } from "@johnmorrisdotca/chikyu-earth/meteors";
|
|
150
|
+
*
|
|
151
|
+
* console.log(Math.abs(apexPoint(Date.UTC(2026, 2, 20, 12)).lat) < 24); // true: it stays within the tropics
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
export function apexPoint(ms) {
|
|
155
|
+
// the Earth moves towards the point of the ecliptic 90 degrees behind the Sun
|
|
156
|
+
const longitude = (solarLongitude(ms) - 90) * RAD;
|
|
157
|
+
const obliquity = 23.4393 * RAD;
|
|
158
|
+
const ra = Math.atan2(Math.cos(obliquity) * Math.sin(longitude), Math.cos(longitude)) / RAD;
|
|
159
|
+
const dec = Math.asin(Math.sin(obliquity) * Math.sin(longitude)) / RAD;
|
|
160
|
+
return pointBeneath({ ra: wrap360(ra), dec }, ms);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* A place as a unit vector: x to longitude 90 east on the equator, y to the north pole, z to longitude 0 on the equator (the realistic Earth's own axes).
|
|
164
|
+
*
|
|
165
|
+
* @param point - Longitude and latitude, in degrees.
|
|
166
|
+
* @returns The unit vector from the Earth's centre to that place.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* import { placeVector } from "@johnmorrisdotca/chikyu-earth/meteors";
|
|
171
|
+
*
|
|
172
|
+
* console.log(placeVector({ lon: 0, lat: 90 }).map((n) => Math.round(n))); // [0, 1, 0]
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
export const placeVector = (point) => {
|
|
176
|
+
const lon = point.lon * RAD;
|
|
177
|
+
const lat = point.lat * RAD;
|
|
178
|
+
return [Math.cos(lat) * Math.sin(lon), Math.sin(lat), Math.cos(lat) * Math.cos(lon)];
|
|
179
|
+
};
|
|
180
|
+
const dot = (a, b) => a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
181
|
+
/**
|
|
182
|
+
* The meteor sky of a moment (see `MeteorSky`).
|
|
183
|
+
*
|
|
184
|
+
* @param ms - The moment, in milliseconds since the epoch.
|
|
185
|
+
* @returns The active showers with their rates and radiant places, and the apex.
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```ts
|
|
189
|
+
* import { hourlyRateAt, meteorSky } from "@johnmorrisdotca/chikyu-earth/meteors";
|
|
190
|
+
*
|
|
191
|
+
* const sky = meteorSky(Date.UTC(2026, 7, 13, 2));
|
|
192
|
+
* console.log(hourlyRateAt(sky, { lon: 139.7, lat: 35.7 }).toFixed(1));
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
export function meteorSky(ms) {
|
|
196
|
+
return {
|
|
197
|
+
ms,
|
|
198
|
+
showers: activeShowers(ms).map(({ shower, zhr }) => ({ shower, zhr, overhead: placeVector(pointBeneath(shower.radiant, ms)) })),
|
|
199
|
+
apex: placeVector(apexPoint(ms)),
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* How many meteors an ideal watcher at a place would count in an hour under a perfect dark sky, whether or not it is dark there:
|
|
204
|
+
* the sporadic background, a little more on the side that faces the Earth's way and a little less on the other, plus each active
|
|
205
|
+
* shower's rate times the sine of its radiant's height (none where the radiant is below the horizon).
|
|
206
|
+
* The lean towards the morning side (from 0.4 to 1.6 times `SPORADIC_HOURLY_RATE`) is a simple stand-in for the real daily swing.
|
|
207
|
+
*
|
|
208
|
+
* @param sky - The meteor sky of the moment (`meteorSky`).
|
|
209
|
+
* @param place - The place, or its unit vector (`placeVector`).
|
|
210
|
+
* @returns Meteors an hour.
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```ts
|
|
214
|
+
* import { hourlyRateAt, meteorSky, pointBeneath } from "@johnmorrisdotca/chikyu-earth/meteors";
|
|
215
|
+
*
|
|
216
|
+
* const moment = Date.UTC(2026, 11, 14, 8);
|
|
217
|
+
* const sky = meteorSky(moment);
|
|
218
|
+
* // Under the Geminids' radiant the rate is the shower's whole rate and the background on top.
|
|
219
|
+
* console.log(hourlyRateAt(sky, pointBeneath(sky.showers[0]!.shower.radiant, moment)) > 150);
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
export function hourlyRateAt(sky, place) {
|
|
223
|
+
const p = Array.isArray(place) ? place : placeVector(place);
|
|
224
|
+
let rate = SPORADIC_HOURLY_RATE * (1 + 0.6 * dot(p, sky.apex));
|
|
225
|
+
for (const entry of sky.showers) {
|
|
226
|
+
const height = dot(p, entry.overhead);
|
|
227
|
+
if (height > 0)
|
|
228
|
+
rate += entry.zhr * height;
|
|
229
|
+
}
|
|
230
|
+
return rate;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* How dark the sky is at a place, from 0 (the Sun is up) to 1 (the Sun is 6 degrees or more below the horizon, the end of civil twilight),
|
|
234
|
+
* rising evenly between: meteors are counted as seen only where it is dark.
|
|
235
|
+
*
|
|
236
|
+
* @param place - The place's unit vector (`placeVector`).
|
|
237
|
+
* @param sun - The unit vector of the place the Sun is overhead.
|
|
238
|
+
* @returns 0 to 1.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```ts
|
|
242
|
+
* import { darkness, placeVector } from "@johnmorrisdotca/chikyu-earth/meteors";
|
|
243
|
+
*
|
|
244
|
+
* const sun = placeVector({ lon: 0, lat: 0 });
|
|
245
|
+
* console.log(darkness(placeVector({ lon: 0, lat: 0 }), sun), darkness(placeVector({ lon: 180, lat: 0 }), sun)); // 0 1
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
export function darkness(place, sun) {
|
|
249
|
+
const sine = dot(place, sun);
|
|
250
|
+
const edge = Math.sin(6 * RAD);
|
|
251
|
+
return sine >= 0 ? 0 : Math.min(1, -sine / edge);
|
|
252
|
+
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type * as THREE from "three";
|
|
2
2
|
import type { AssetCache, Item3D } from "@johnmorrisdotca/kazoku-ui/renderer";
|
|
3
3
|
import type { GeoPoint, GlobeView } from "../types.ts";
|
|
4
|
+
import type { SatelliteRef } from "../satellites/types.ts";
|
|
4
5
|
import { lookAt } from "../view.ts";
|
|
6
|
+
import { type SatelliteState } from "../space/satellite-layer.ts";
|
|
5
7
|
import type { Layer } from "./tiers.ts";
|
|
6
8
|
import { type ThreeParts } from "./textures.ts";
|
|
7
9
|
import { type TileSet } from "./tile-set.ts";
|
|
10
|
+
import { type MeteorState } from "../meteors/layer.ts";
|
|
8
11
|
export type { ThreeParts };
|
|
9
12
|
type Three = ThreeParts;
|
|
10
13
|
/**
|
|
@@ -32,6 +35,19 @@ export declare const ATMOSPHERE_OUTER = 1.08;
|
|
|
32
35
|
* ```
|
|
33
36
|
*/
|
|
34
37
|
export type LightMode = "sun" | "lit" | "boost";
|
|
38
|
+
/**
|
|
39
|
+
* How the camera is held: `ground` (the default) over a place on the ground, so the Earth keeps still and the clock moves the light across it; `space` held in the stars, so the Earth turns beneath it as the clock runs and the day and night line stays
|
|
40
|
+
* where the Sun really puts it; `sun` held on the Sun's side, so the day and night line keeps its place on the screen while the Earth turns beneath.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* import type { CameraMode } from "@johnmorrisdotca/chikyu-earth/realistic";
|
|
45
|
+
*
|
|
46
|
+
* const modes: CameraMode[] = ["ground", "space", "sun"];
|
|
47
|
+
* console.log(modes.join(", "));
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export type CameraMode = "ground" | "space" | "sun";
|
|
35
51
|
export interface EarthModel {
|
|
36
52
|
/** The home centre; the shared controls' yaw and tilt are added to it as in the flat globe. */
|
|
37
53
|
centre: GeoPoint;
|
|
@@ -42,6 +58,16 @@ export interface EarthModel {
|
|
|
42
58
|
lights: boolean;
|
|
43
59
|
/** How the Earth is lit (see `LightMode`). */
|
|
44
60
|
light: LightMode;
|
|
61
|
+
/** How the camera is held (see `CameraMode`). */
|
|
62
|
+
camera: CameraMode;
|
|
63
|
+
/** How fast the cloud picture is made to move eastward against the ground, degrees an hour: 0 (the default) keeps the clouds where the picture has them. The picture is one snapshot, not a forecast; a drift is only for life. */
|
|
64
|
+
cloudDrift: number;
|
|
65
|
+
/** For the `space` camera: the Earth's turn against the stars (degrees) when the camera was set; null until the next draw sets it. */
|
|
66
|
+
cameraSpin: number | null;
|
|
67
|
+
/** Game seconds a second (the clock's speed): the satellites are placed from it. */
|
|
68
|
+
speed: number;
|
|
69
|
+
/** The satellites shown, the one chosen, and what the last draw did with them. */
|
|
70
|
+
satellites: SatelliteState;
|
|
45
71
|
/** Where the camera looked at the last draw (the element decides from it whether a new draw is worth it). */
|
|
46
72
|
drawn: {
|
|
47
73
|
view: GlobeView;
|
|
@@ -51,8 +77,12 @@ export interface EarthModel {
|
|
|
51
77
|
} | null;
|
|
52
78
|
/** The map tiles laid over the pictures while the scene is built: what they are doing, for a page or a test. */
|
|
53
79
|
tiles: TileSet | null;
|
|
80
|
+
/** The satellite at a point of the view (CSS pixels), within a radius, once a draw has been made and one is there. */
|
|
81
|
+
pick: ((x: number, y: number, radius: number) => SatelliteRef | null) | null;
|
|
54
82
|
/** The pixel ratio the textures are chosen for. */
|
|
55
83
|
ratio(): number;
|
|
84
|
+
/** Meteors seen from space (src/meteors/layer.ts): off unless the element switches them on. */
|
|
85
|
+
meteors: MeteorState;
|
|
56
86
|
}
|
|
57
87
|
export interface EarthDeps {
|
|
58
88
|
assets: AssetCache;
|
|
@@ -64,11 +94,11 @@ export interface EarthDeps {
|
|
|
64
94
|
tiles?: () => string | undefined;
|
|
65
95
|
/** Told once when the tile set has been read: the width in pixels of the finest level of each of its layers. */
|
|
66
96
|
onTiles?: (layers: Record<string, number>) => void;
|
|
67
|
-
/** Clouds' eastward drift against the ground, degrees an hour. */
|
|
68
|
-
drift: number;
|
|
69
97
|
invalidate: () => void;
|
|
70
98
|
onError?: (error: unknown) => void;
|
|
71
99
|
onTier?: (layer: Layer, width: number) => void;
|
|
100
|
+
/** The satellites could not be drawn (the three.js parts handed over lack `Points`). */
|
|
101
|
+
onSatellitesError?: (error: unknown) => void;
|
|
72
102
|
/** Told at the start of every draw, before anything is read for it. */
|
|
73
103
|
onDraw?: () => void;
|
|
74
104
|
/** Told at every draw where the disc is, for what is laid over it (markers). */
|
|
@@ -100,6 +130,25 @@ export declare const newModel: () => EarthModel;
|
|
|
100
130
|
*/
|
|
101
131
|
export declare const discRadius: (width: number, height: number, zoom: number) => number;
|
|
102
132
|
export { lookAt };
|
|
133
|
+
/**
|
|
134
|
+
* The place the camera looks at for a moment: the home centre as it is (`ground`), the home centre as it was when the camera was set, carried west by the Earth's turn since (`space`), or the home centre read from the Sun's own place (`sun`: `0,0` is straight at noon).
|
|
135
|
+
* It sets `cameraSpin` when the `space` camera has none yet. Pure apart from that.
|
|
136
|
+
*
|
|
137
|
+
* @param model - The model: its centre, camera, camera spin and the moment shown.
|
|
138
|
+
* @returns The longitude and latitude the view is turned from (yaw and tilt are added to it by `lookAt`).
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```ts
|
|
142
|
+
* import { cameraCentre } from "@johnmorrisdotca/chikyu-earth/realistic";
|
|
143
|
+
*
|
|
144
|
+
* const start = Date.UTC(2026, 10, 2, 12);
|
|
145
|
+
* const model = { centre: { lon: 10, lat: 30 }, camera: "space" as const, cameraSpin: null, time: start };
|
|
146
|
+
* cameraCentre(model);
|
|
147
|
+
* model.time = start + 6 * 3_600_000;
|
|
148
|
+
* console.log(cameraCentre(model).lon.toFixed(1));
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
export declare function cameraCentre(model: Pick<EarthModel, "centre" | "camera" | "cameraSpin" | "time">): GeoPoint;
|
|
103
152
|
/** An equirectangular sphere: +z is longitude 0 on the equator, +x east, +y north; v is 0 at the north pole (the top row of the picture). */
|
|
104
153
|
export declare function sphere(three: Three, columns: number, rows: number): THREE.BufferGeometry;
|
|
105
154
|
export declare function createEarthItem(model: EarthModel, deps: EarthDeps): Item3D<Three>;
|
package/dist/realistic/earth.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { HOME_VIEW, lookAt } from "../view.js";
|
|
2
2
|
import { ATMOSPHERE_FRAG, ATMOSPHERE_VERT, CLOUD_FRAG, SURFACE_FRAG, SURFACE_VERT } from "./shaders.js";
|
|
3
|
-
import { subsolarPoint, unitVector } from "./sun.js";
|
|
3
|
+
import { greenwichSidereal, subsolarPoint, unitVector } from "./sun.js";
|
|
4
|
+
import { createSatelliteLayer, newSatelliteState } from "../space/satellite-layer.js";
|
|
4
5
|
import { createTextureSet } from "./textures.js";
|
|
5
6
|
import { createTileSet } from "./tile-set.js";
|
|
7
|
+
import { createMeteorLayer, newMeteorState } from "../meteors/layer.js";
|
|
6
8
|
const RAD = Math.PI / 180;
|
|
7
9
|
/**
|
|
8
10
|
* The glow reaches this many radii from the centre; the globe at 1x is drawn to fit inside it.
|
|
@@ -24,9 +26,16 @@ export const newModel = () => ({
|
|
|
24
26
|
clouds: true,
|
|
25
27
|
lights: true,
|
|
26
28
|
light: "sun",
|
|
29
|
+
camera: "space",
|
|
30
|
+
cloudDrift: 0,
|
|
31
|
+
cameraSpin: null,
|
|
32
|
+
speed: 1,
|
|
33
|
+
satellites: newSatelliteState(),
|
|
27
34
|
drawn: null,
|
|
28
35
|
tiles: null,
|
|
36
|
+
pick: null,
|
|
29
37
|
ratio: () => Math.min(globalThis.devicePixelRatio || 1, 2),
|
|
38
|
+
meteors: newMeteorState(),
|
|
30
39
|
});
|
|
31
40
|
/**
|
|
32
41
|
* The disc's radius in CSS pixels in a box of `width` x `height` at `zoom`: it fits the glow in the box at 1x.
|
|
@@ -45,6 +54,36 @@ export const newModel = () => ({
|
|
|
45
54
|
*/
|
|
46
55
|
export const discRadius = (width, height, zoom) => Math.max(1, (Math.min(width, height) / 2 / ATMOSPHERE_OUTER - 1) * zoom);
|
|
47
56
|
export { lookAt };
|
|
57
|
+
/**
|
|
58
|
+
* The place the camera looks at for a moment: the home centre as it is (`ground`), the home centre as it was when the camera was set, carried west by the Earth's turn since (`space`), or the home centre read from the Sun's own place (`sun`: `0,0` is straight at noon).
|
|
59
|
+
* It sets `cameraSpin` when the `space` camera has none yet. Pure apart from that.
|
|
60
|
+
*
|
|
61
|
+
* @param model - The model: its centre, camera, camera spin and the moment shown.
|
|
62
|
+
* @returns The longitude and latitude the view is turned from (yaw and tilt are added to it by `lookAt`).
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* import { cameraCentre } from "@johnmorrisdotca/chikyu-earth/realistic";
|
|
67
|
+
*
|
|
68
|
+
* const start = Date.UTC(2026, 10, 2, 12);
|
|
69
|
+
* const model = { centre: { lon: 10, lat: 30 }, camera: "space" as const, cameraSpin: null, time: start };
|
|
70
|
+
* cameraCentre(model);
|
|
71
|
+
* model.time = start + 6 * 3_600_000;
|
|
72
|
+
* console.log(cameraCentre(model).lon.toFixed(1));
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export function cameraCentre(model) {
|
|
76
|
+
if (model.camera === "space") {
|
|
77
|
+
const spin = greenwichSidereal(model.time);
|
|
78
|
+
model.cameraSpin ??= spin;
|
|
79
|
+
return { lon: model.centre.lon - (spin - model.cameraSpin), lat: model.centre.lat };
|
|
80
|
+
}
|
|
81
|
+
if (model.camera === "sun") {
|
|
82
|
+
const sun = subsolarPoint(model.time);
|
|
83
|
+
return { lon: sun.lon + model.centre.lon, lat: Math.max(-90, Math.min(90, sun.lat + model.centre.lat)) };
|
|
84
|
+
}
|
|
85
|
+
return model.centre;
|
|
86
|
+
}
|
|
48
87
|
/** An equirectangular sphere: +z is longitude 0 on the equator, +x east, +y north; v is 0 at the north pole (the top row of the picture). */
|
|
49
88
|
export function sphere(three, columns, rows) {
|
|
50
89
|
const positions = new Float32Array((columns + 1) * (rows + 1) * 3);
|
|
@@ -91,13 +130,15 @@ export function createEarthItem(model, deps) {
|
|
|
91
130
|
});
|
|
92
131
|
const uniform = textures.uniforms;
|
|
93
132
|
const sunDir = { value: new three.Vector3(1, 0, 0) };
|
|
133
|
+
/** The Sun in the Earth's own axes (before the view turns it), which the surface needs to find where a cloud's shadow falls. */
|
|
134
|
+
const sunLocal = { value: new three.Vector3(1, 0, 0) };
|
|
135
|
+
const cloudShift = { value: 0 };
|
|
94
136
|
const grid = sphere(three, 128, 64);
|
|
95
137
|
const surface = new three.ShaderMaterial({
|
|
96
138
|
vertexShader: SURFACE_VERT,
|
|
97
139
|
fragmentShader: SURFACE_FRAG,
|
|
98
|
-
uniforms: { dayMap: uniform.day, nightMap: uniform.night, waterMap: uniform.water, sunDir, lights: { value: 1 }, boost: { value: 0 }, ortho: { value: 1 } },
|
|
140
|
+
uniforms: { dayMap: uniform.day, nightMap: uniform.night, waterMap: uniform.water, cloudMap: uniform.clouds, sunDir, sunLocal, cloudShift, lights: { value: 1 }, boost: { value: 0 }, ortho: { value: 1 } },
|
|
99
141
|
});
|
|
100
|
-
const cloudShift = { value: 0 };
|
|
101
142
|
const cloudMaterial = new three.ShaderMaterial({
|
|
102
143
|
vertexShader: SURFACE_VERT,
|
|
103
144
|
fragmentShader: CLOUD_FRAG,
|
|
@@ -115,7 +156,7 @@ export function createEarthItem(model, deps) {
|
|
|
115
156
|
});
|
|
116
157
|
const turned = new three.Group();
|
|
117
158
|
const earth = new three.Mesh(grid, surface);
|
|
118
|
-
const tiles = createTileSet(three, turned, { sunDir, lights: surface.uniforms["lights"], boost: surface.uniforms["boost"], ortho: surface.uniforms["ortho"], water: uniform.water, night: uniform.night }, { assets: deps.assets, base: () => deps.tiles?.(), cap: deps.cap, invalidate: deps.invalidate, ...(deps.onTiles ? { onManifest: deps.onTiles } : {}) });
|
|
159
|
+
const tiles = createTileSet(three, turned, { sunDir, lights: surface.uniforms["lights"], boost: surface.uniforms["boost"], ortho: surface.uniforms["ortho"], water: uniform.water, night: uniform.night, extra: { cloudMap: uniform.clouds, sunLocal, cloudShift } }, { assets: deps.assets, base: () => deps.tiles?.(), cap: deps.cap, invalidate: deps.invalidate, ...(deps.onTiles ? { onManifest: deps.onTiles } : {}) });
|
|
119
160
|
model.tiles = tiles;
|
|
120
161
|
const clouds = new three.Mesh(grid, cloudMaterial);
|
|
121
162
|
clouds.scale.setScalar(CLOUD_RADIUS);
|
|
@@ -127,21 +168,36 @@ export function createEarthItem(model, deps) {
|
|
|
127
168
|
glow.frustumCulled = false;
|
|
128
169
|
const scene = new three.Scene();
|
|
129
170
|
scene.add(turned, glow);
|
|
130
|
-
|
|
131
|
-
|
|
171
|
+
// the satellites are placed in space's own axes (x to the vernal equinox, y north); this group turns them into the Earth's axes (by the Earth's turn against the stars) and then as the Earth is turned in the view
|
|
172
|
+
const inertial = new three.Group();
|
|
173
|
+
const spun = new three.Group();
|
|
174
|
+
inertial.add(spun);
|
|
175
|
+
scene.add(inertial);
|
|
176
|
+
let layer;
|
|
177
|
+
// far enough in front that a geostationary satellite (6.6 radii out) is never behind the camera: an orthographic picture is the same from anywhere on the line
|
|
178
|
+
const camera = new three.OrthographicCamera(-1, 1, 1, -1, 1, 120);
|
|
179
|
+
camera.position.set(0, 0, 50);
|
|
180
|
+
// the meteors: made the first time they are switched on, and asking for their own next draw while a streak is alive or one is due
|
|
181
|
+
let meteors = null;
|
|
182
|
+
let meteorTimer;
|
|
132
183
|
return {
|
|
133
184
|
scene,
|
|
134
185
|
camera,
|
|
135
186
|
update() {
|
|
136
187
|
deps.onDraw?.();
|
|
137
188
|
const view = model.view;
|
|
138
|
-
const
|
|
189
|
+
const centre = cameraCentre(model);
|
|
190
|
+
const look = lookAt(centre, view);
|
|
139
191
|
turned.rotation.set(look.lat * RAD, -look.lon * RAD, 0, "XYZ");
|
|
192
|
+
inertial.rotation.copy(turned.rotation);
|
|
193
|
+
const spin = greenwichSidereal(model.time);
|
|
194
|
+
spun.rotation.set(0, -(spin + 90) * RAD, 0);
|
|
140
195
|
const [sx, sy, sz] = unitVector(subsolarPoint(model.time));
|
|
196
|
+
sunLocal.value.set(sx, sy, sz);
|
|
141
197
|
sunDir.value.set(sx, sy, sz).applyEuler(turned.rotation);
|
|
142
198
|
if (model.light === "lit")
|
|
143
199
|
sunDir.value.set(0, 0, 1);
|
|
144
|
-
cloudShift.value = -(((model.time / 3_600_000) *
|
|
200
|
+
cloudShift.value = -(((model.time / 3_600_000) * model.cloudDrift) % 360) / 360;
|
|
145
201
|
clouds.visible = model.clouds;
|
|
146
202
|
surface.uniforms["lights"].value = model.lights && model.light !== "lit" ? 1 : 0;
|
|
147
203
|
surface.uniforms["boost"].value = model.light === "boost" ? 1 : 0;
|
|
@@ -151,16 +207,38 @@ export function createEarthItem(model, deps) {
|
|
|
151
207
|
camera.top = (size.height / 2 + view.panY) / radius;
|
|
152
208
|
camera.bottom = (-size.height / 2 + view.panY) / radius;
|
|
153
209
|
camera.updateProjectionMatrix();
|
|
154
|
-
|
|
210
|
+
if (!layer && model.satellites.groups.size > 0) {
|
|
211
|
+
try {
|
|
212
|
+
layer = createSatelliteLayer(three, spun, model.satellites, model.ratio);
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
model.satellites.groups.clear();
|
|
216
|
+
deps.onSatellitesError?.(error);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
layer?.update(model.time, model.speed);
|
|
220
|
+
model.pick = layer ? (x, y, radius) => layer.pick(x, y, camera, size, radius) : null;
|
|
221
|
+
model.drawn = { view: { ...view }, time: model.time, radius, centre: { ...centre } };
|
|
155
222
|
textures.sync(radius * model.ratio());
|
|
156
223
|
tiles.sync({ lon: look.lon, lat: look.lat, width: size.width, height: size.height, panX: view.panX, panY: view.panY, radius }, [sunDir.value.x, sunDir.value.y, sunDir.value.z], true, model.ratio());
|
|
157
224
|
deps.onPose?.({ lon: look.lon, lat: look.lat, radius, cx: size.width / 2 + view.panX, cy: size.height / 2 + view.panY, width: size.width, height: size.height });
|
|
225
|
+
if (model.meteors.on && !meteors)
|
|
226
|
+
meteors = createMeteorLayer(three, turned, model.meteors);
|
|
227
|
+
if (meteors) {
|
|
228
|
+
const wait = meteors.step({ now: performance.now(), time: model.time, facing: unitVector({ lon: look.lon, lat: look.lat }), sun: [sx, sy, sz], radius, width: size.width, height: size.height });
|
|
229
|
+
clearTimeout(meteorTimer);
|
|
230
|
+
meteorTimer = Number.isFinite(wait) ? setTimeout(deps.invalidate, wait) : undefined;
|
|
231
|
+
}
|
|
158
232
|
return false;
|
|
159
233
|
},
|
|
160
234
|
resize(next, nextHeight) {
|
|
161
235
|
size = { width: next, height: nextHeight };
|
|
162
236
|
},
|
|
163
237
|
dispose() {
|
|
238
|
+
layer?.dispose();
|
|
239
|
+
model.pick = null;
|
|
240
|
+
clearTimeout(meteorTimer);
|
|
241
|
+
meteors?.dispose();
|
|
164
242
|
model.tiles = null;
|
|
165
243
|
tiles.dispose();
|
|
166
244
|
textures.dispose();
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { type ViewController } from "@johnmorrisdotca/kazoku-ui/view-controls";
|
|
2
2
|
import type { GeoPoint, GlobeView } from "../types.ts";
|
|
3
|
-
import { type LightMode } from "./earth.ts";
|
|
3
|
+
import { type CameraMode, type LightMode } from "./earth.ts";
|
|
4
|
+
import type { SatelliteInfo, SatelliteRef, Satellites } from "../satellites/types.ts";
|
|
5
|
+
import { type SatelliteStyle } from "../space/satellite-layer.ts";
|
|
4
6
|
import { setSharedRenderer, setThreeLoader } from "./shared.ts";
|
|
5
7
|
export { setSharedRenderer, setThreeLoader };
|
|
8
|
+
export type { CameraMode };
|
|
6
9
|
import type { OverlayHost } from "../markers/layer.ts";
|
|
7
10
|
import { type Layer } from "./tiers.ts";
|
|
8
11
|
import type { TileStats } from "./tile-set.ts";
|
|
@@ -19,6 +22,18 @@ type EarthLayer = Extract<Layer, "day" | "night" | "clouds" | "water">;
|
|
|
19
22
|
* ```
|
|
20
23
|
*/
|
|
21
24
|
export type EarthState = "loading" | "live" | "unavailable" | "lost" | "idle";
|
|
25
|
+
type SatelliteStats = {
|
|
26
|
+
groups: number;
|
|
27
|
+
placed: number;
|
|
28
|
+
tooFast: boolean;
|
|
29
|
+
propagations: number;
|
|
30
|
+
lastBatchMs: number;
|
|
31
|
+
maxBatchMs: number;
|
|
32
|
+
updateMs: number;
|
|
33
|
+
maxUpdateMs: number;
|
|
34
|
+
averageUpdateMs: number;
|
|
35
|
+
updates: number;
|
|
36
|
+
};
|
|
22
37
|
/**
|
|
23
38
|
* A `speed` attribute: how many seconds pass for each real second.
|
|
24
39
|
*
|
|
@@ -58,6 +73,13 @@ export declare const readTime: (value: string | null) => number | "now";
|
|
|
58
73
|
* While time runs it sends `chikyu-timechange` with `detail: { time, running: true }` (the moment shown in milliseconds since 1970), at most four times a second however fast the picture is drawn and not from a hidden tab, and once with `running: false` when the clock holds
|
|
59
74
|
* (a date is set, or `speed` is set to 0): a page writes the date into its date box from it. It is not sent for a `time` the page sets itself.
|
|
60
75
|
*
|
|
76
|
+
* `meteors` (the attribute, with or without a value other than `off`; the property is a boolean) draws meteors as they look from space: short streaks 80 to 120 km up,
|
|
77
|
+
* only where it is dark or twilight, more of them where an active shower's radiant stands high and on the side that faces the Earth's way. Each streak's place and
|
|
78
|
+
* moment are drawn at random (and said so in a line under the picture, which `meteors-label="off"` takes away for a page that says it itself); how many there are,
|
|
79
|
+
* where they fall, their height and the showers' dates are real (`@johnmorrisdotca/chikyu-earth/meteors`). They run while the clock runs, at any speed, and not
|
|
80
|
+
* at all while it is held, out of sight, in a hidden tab, or for a reader who prefers reduced motion until the page sets a `speed` (a Play). `chikyu-meteors`
|
|
81
|
+
* is sent when the strongest active shower changes, with `detail: { shower, zhr }` (`shower` is `null` when none is active).
|
|
82
|
+
*
|
|
61
83
|
* @example
|
|
62
84
|
* ```ts no-run
|
|
63
85
|
* import type { ChikyuEarthRealistic } from "@johnmorrisdotca/chikyu-earth/realistic/element";
|
|
@@ -81,6 +103,11 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
|
81
103
|
connectedCallback(): void;
|
|
82
104
|
disconnectedCallback(): void;
|
|
83
105
|
attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
|
|
106
|
+
/**
|
|
107
|
+
* Meteors seen from space, on or off (the attribute `meteors`): see the class's description. Off by default, and nothing of theirs is made until they are first switched on.
|
|
108
|
+
*/
|
|
109
|
+
get meteors(): boolean;
|
|
110
|
+
set meteors(value: boolean);
|
|
84
111
|
/** The controller behind the element's own hands (`set`, `fit`, `state`), while it is in a page. */
|
|
85
112
|
get controller(): ViewController | undefined;
|
|
86
113
|
/** Where the finer map tiles are served from (a folder with `manifest.json`), or `null` for none; the attribute `tiles`. The Earth loads only the tiles in view, over its own pictures. */
|
|
@@ -91,6 +118,16 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
|
91
118
|
/** Where the view starts: longitude and latitude; the shared controls' yaw and tilt turn it from there. */
|
|
92
119
|
get centre(): GeoPoint;
|
|
93
120
|
set centre(value: GeoPoint);
|
|
121
|
+
/**
|
|
122
|
+
* How the camera is held (the `camera` attribute). `space` (the default): held in the stars, looking at the place `center` names as it is at the
|
|
123
|
+
* moment the camera is set (when the element opens, and again when `time` or `center` is set), so the Earth turns beneath it as the clock runs, with the day and night line where the Sun really is. `ground`: over the place `center` names on the ground, so the Earth keeps still and the clock moves the light across it. `sun`: held on the Sun's side, `center` being the longitude and
|
|
124
|
+
* latitude from the sub-solar point (`0,0` looks straight at the noon place and shows no night), so the day and night line keeps its place on the screen while the Earth turns beneath. A drag turns the view about the same body in any of them.
|
|
125
|
+
*/
|
|
126
|
+
get camera(): CameraMode;
|
|
127
|
+
set camera(value: CameraMode);
|
|
128
|
+
/** True for the full-screen mode (the `immersive` attribute): the element fills its box in any shape, a plain wheel zooms instead of scrolling the page, and a touch drag turns the view instead of scrolling. */
|
|
129
|
+
get immersive(): boolean;
|
|
130
|
+
set immersive(value: boolean);
|
|
94
131
|
/** The moment shown: milliseconds since the epoch, or "now" while it follows the real clock. The clock runs from it at `speed`, so a number read while time runs is the moment it has reached. */
|
|
95
132
|
get time(): number | "now";
|
|
96
133
|
set time(value: number | Date | "now");
|
|
@@ -112,6 +149,7 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
|
112
149
|
state: EarthState;
|
|
113
150
|
tiers: Record<EarthLayer, number>;
|
|
114
151
|
tiles: TileStats;
|
|
152
|
+
satellites: SatelliteStats;
|
|
115
153
|
draws: number;
|
|
116
154
|
contexts: number;
|
|
117
155
|
canvas: {
|
|
@@ -123,12 +161,45 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
|
123
161
|
entries: number;
|
|
124
162
|
refs: number;
|
|
125
163
|
};
|
|
164
|
+
/** The meteors: whether they are on, the streaks alive now and started so far, the streaks a second being drawn, and the strongest active shower's code and rate. */
|
|
165
|
+
meteors: {
|
|
166
|
+
on: boolean;
|
|
167
|
+
alive: number;
|
|
168
|
+
spawned: number;
|
|
169
|
+
perSecond: number;
|
|
170
|
+
shower: string | null;
|
|
171
|
+
zhr: number;
|
|
172
|
+
};
|
|
126
173
|
};
|
|
127
174
|
/**
|
|
128
175
|
* Apply a shared view controller's camera (yaw, tilt, zoom, pan). A change under half a pixel is not drawn, a settled change always is,
|
|
129
176
|
* and draws are at most 30 a second.
|
|
130
177
|
*/
|
|
131
178
|
setView(view: GlobeView, final?: boolean): void;
|
|
179
|
+
/**
|
|
180
|
+
* Show a group of satellites (made by `createSatellites`) under a name, or take the group away with `null`. A group is one draw call however many satellites it holds, so every group of the catalogue can be shown at once. Giving the name of a group
|
|
181
|
+
* that is already shown replaces it. `style`: `color` and `size` (CSS pixels) of the dots, and `orbits` to draw every orbit (only for a group of 40 or fewer, such as the stations). The groups are placed by SGP4 about once a second and interpolated
|
|
182
|
+
* between, are hidden while the clock runs faster than `MAX_SATELLITE_SPEED`, are hidden by the Earth when they are behind it, and draw at most 30 times a second and not at all while the clock holds.
|
|
183
|
+
*
|
|
184
|
+
* @param group - The group's name, for `showSatellites`, `selectSatellite` and the events.
|
|
185
|
+
* @param satellites - The group, or `null` to remove it.
|
|
186
|
+
* @param style - How to draw it.
|
|
187
|
+
*/
|
|
188
|
+
setSatellites(group: string, satellites: Satellites | null, style?: Partial<SatelliteStyle>): void;
|
|
189
|
+
/** Show or hide a group without losing it. */
|
|
190
|
+
showSatellites(group: string, on: boolean): void;
|
|
191
|
+
/** The groups now set, with how many satellites each holds and whether it is shown. */
|
|
192
|
+
get satelliteGroups(): {
|
|
193
|
+
name: string;
|
|
194
|
+
count: number;
|
|
195
|
+
visible: boolean;
|
|
196
|
+
}[];
|
|
197
|
+
/** Mark one satellite: a larger ring round it and its orbit drawn. `null` lets it go. */
|
|
198
|
+
selectSatellite(ref: SatelliteRef | null): void;
|
|
199
|
+
/** The satellite marked by `selectSatellite` or by a press on it, if any. */
|
|
200
|
+
get selectedSatellite(): SatelliteRef | null;
|
|
201
|
+
/** Facts about one satellite at the moment shown (name, number, element age, height, speed, period); undefined if it cannot be placed then. */
|
|
202
|
+
satelliteInfo(ref: SatelliteRef): SatelliteInfo | undefined;
|
|
132
203
|
/** The view as it is (for a page that wants to read it back). */
|
|
133
204
|
get view(): GlobeView;
|
|
134
205
|
}
|