@johnmorrisdotca/chikyu-earth 0.48.0 → 0.49.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 +4 -0
- package/README.md +1 -1
- package/dist/realistic/element-base.d.ts +20 -0
- package/dist/realistic/element-base.js +44 -3
- package/dist/satellites/source.js +1 -1
- package/dist/satellites/track.d.ts +5 -0
- package/dist/satellites/track.js +66 -5
- package/dist/satellites/types.d.ts +14 -0
- package/dist/space/element-base.d.ts +20 -0
- package/dist/space/element-base.js +46 -5
- package/dist/space/satellite-layer.d.ts +3 -0
- package/dist/space/satellite-layer.js +15 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.49.0 - 2026-11-13
|
|
4
|
+
|
|
5
|
+
- **Satellites far from today, as an estimate** (MODULES-1296). `estimate-far` (the property `estimateFar`, or `createSatellites(sets, { estimateFar: true })`; off by default) keeps placing a satellite beyond 30 days from its elements: the same elements carried forward or back by the same SGP4 code, drawn lighter than a dimmed one, with `estimated: true` and `estimatedDays` (how far the moment is from the elements', in days) in `placeSatellite`, `satelliteInfo` and the details of `chikyu-satellite-click` and `chikyu-satellite-visibility`, and `stats.satellites.estimated`. The docs say what an estimate is (where it would be had its orbit not changed) and where it is worst (low orbits, months away). Never before an element set's `LAUNCH_DATE` (else the year of its `OBJECT_ID`) or after its `DECAY_DATE`, both new optional fields that `parseElements` keeps; a satellite SGP4 cannot carry that far, or brings below about 120 km, is left out and not counted as placed.
|
|
6
|
+
|
|
3
7
|
## 0.48.0 - 2026-11-13
|
|
4
8
|
|
|
5
9
|
- **Paths of a page's own, a quiet chosen orbit, and a hit test for a path line** (MODULES-1289). `selected-path="off"` (the property `selectedPath`) stops the package drawing the chosen satellite's own orbit; ring, name and ride stay. `setPaths(list)` (the property `paths`) draws up to 16 orbits at once, each `{ id, style }` (`id` a NORAD number or `group:index`, the last 16 kept), and `setPathStyles(table)` (the property `pathStyles`) changes the named looks `selected`, `hovered`, `favourite` and `path`, each a colour, a width of 0.5 to 8 px, an opacity and a dash: they differ by width and dash as well as colour. All the paths and the chosen orbit are one draw call, with a real width and dashes, and nothing is drawn at rest. `path-hit` (the property `pathHit`, 8 px, 0 to 40, off at 0; a touch has twice the reach, at least 16) makes `chikyu-path-hover` (a mouse) and `chikyu-path-click` (a press or a tap) say which path is under the pointer, `{ id, ref, style, x, y, distancePx, pointer }` with the same `ref` as `chikyu-satellite-click`; `pathAt(x, y, radiusPx?)` asks the same for any point. One press means one thing: a dot, then a path, then the sky. In a ride, the ridden satellite's own orbit is drawn in the `selected` look, and the hit test is off there unless `path-hit` is set. `stats.paths`. On both `<chikyu-space>` and `<chikyu-earth-realistic>`. The chosen satellite's orbit is now 2 px wide (the `selected` look; it was 1 px).
|
package/README.md
CHANGED
|
@@ -612,7 +612,7 @@ console.log(countryList().filter((country) => country.alpha2 === null).map((coun
|
|
|
612
612
|
|
|
613
613
|
## How to cite
|
|
614
614
|
|
|
615
|
-
> Morris, J. (2026). *Chikyu Earth* (version 0.
|
|
615
|
+
> Morris, J. (2026). *Chikyu Earth* (version 0.49.0) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
|
|
616
616
|
|
|
617
617
|
GitHub's "Cite this repository" button reads [CITATION.cff](CITATION.cff) and gives BibTeX and APA. Cite the version you used (`npm ls @johnmorrisdotca/chikyu-earth`), and credit the sources behind the numbers and pictures: [NOTICE.md](NOTICE.md) says who made each one and under what terms.
|
|
618
618
|
|
|
@@ -61,6 +61,7 @@ type SatelliteStats = {
|
|
|
61
61
|
hoverPath: boolean;
|
|
62
62
|
hoverOpacity: number;
|
|
63
63
|
selectedOpacity: number;
|
|
64
|
+
estimated: number;
|
|
64
65
|
};
|
|
65
66
|
/**
|
|
66
67
|
* A `speed` attribute: how many seconds pass for each real second.
|
|
@@ -564,6 +565,25 @@ export declare class ChikyuEarthRealistic extends HTMLElement {
|
|
|
564
565
|
visible: boolean;
|
|
565
566
|
heightKm: number;
|
|
566
567
|
} | null;
|
|
568
|
+
/**
|
|
569
|
+
* Keep placing satellites that are far from their element sets, as an estimate (the attribute `estimate-far`, off unless set; `estimate-far="off"` is off). A satellite is left out when the moment shown is more than `maxAgeDays` (30) from its elements; on, it is carried forward or back by the same SGP4 code
|
|
570
|
+
* instead, and drawn lighter than a dimmed one. **An estimate is where the satellite would be if its orbit had not changed since the elements were taken.** It is worst for low orbits (drag changes them within days, and a manoeuvre moves the satellite along its path, so after weeks the estimate can be far along the orbit from the truth, and a satellite that has re-entered is not there at all) and for a long time away; a high orbit changes slowly and is close for months. Never before a satellite's launch or after its decay when its elements carry `LAUNCH_DATE` and `DECAY_DATE` (else the year of its `OBJECT_ID` is the earliest);
|
|
571
|
+
* one SGP4 cannot carry that far, or brings down below about 120 km, is left out and is not counted as placed. Each estimated satellite is `estimated: true`, with `estimatedDays`, in `placeSatellite`, `satelliteInfo`, `chikyu-satellite-visibility` and `chikyu-satellite-click`, and `stats.satellites.estimated` counts them.
|
|
572
|
+
* It applies to every group, those the page made with `createSatellites(sets, { estimateFar: true })` too.
|
|
573
|
+
*
|
|
574
|
+
* @example
|
|
575
|
+
* ```ts
|
|
576
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
|
|
577
|
+
*
|
|
578
|
+
* const farFromToday = (space: ChikyuSpace): void => {
|
|
579
|
+
* space.estimateFar = true;
|
|
580
|
+
* space.addEventListener("chikyu-satellite-click", (event) => console.log((event as CustomEvent).detail.estimated, (event as CustomEvent).detail.estimatedDays));
|
|
581
|
+
* };
|
|
582
|
+
* console.log(typeof farFromToday);
|
|
583
|
+
* ```
|
|
584
|
+
*/
|
|
585
|
+
get estimateFar(): boolean;
|
|
586
|
+
set estimateFar(value: boolean);
|
|
567
587
|
/** The satellite marked by `selectSatellite` or by a press on it, if any. */
|
|
568
588
|
get selectedSatellite(): SatelliteRef | null;
|
|
569
589
|
/**
|
|
@@ -165,7 +165,7 @@ export const readTime = (value) => {
|
|
|
165
165
|
* ```
|
|
166
166
|
*/
|
|
167
167
|
export class ChikyuEarthRealistic extends HTMLElement {
|
|
168
|
-
static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "tiles-finer-timeout", "data", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "satellite-tint", "satellite-streak-max", "hover-path", "names-on-hover", "selected-path", "path-hit"];
|
|
168
|
+
static observedAttributes = ["cloud-drift", "center", "time", "speed", "clouds", "lights", "light", "live-seconds", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "tiles-finer-timeout", "data", "camera", "immersive", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "satellite-tint", "satellite-streak-max", "hover-path", "names-on-hover", "selected-path", "path-hit", "estimate-far"];
|
|
169
169
|
#model = newModel();
|
|
170
170
|
#paint = createPaintState();
|
|
171
171
|
#mode = "now";
|
|
@@ -558,6 +558,8 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
558
558
|
this.#hover?.sync();
|
|
559
559
|
else if (name === "selected-path")
|
|
560
560
|
this.#pathControls?.sync();
|
|
561
|
+
else if (name === "estimate-far")
|
|
562
|
+
this.#applyEstimate();
|
|
561
563
|
else if (name === "path-hit") { /* read at each press and move */ }
|
|
562
564
|
else if (name === "satellite-streak-max") {
|
|
563
565
|
this.#model.satellites.streakMax = readStreakMax(value);
|
|
@@ -1341,6 +1343,8 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1341
1343
|
orbits: (style.orbits ?? was?.orbits ?? false) && satellites.count <= MAX_ORBIT_GROUP,
|
|
1342
1344
|
visible: was?.visible ?? true,
|
|
1343
1345
|
});
|
|
1346
|
+
if (typeof this.hasAttribute === "function" && this.hasAttribute("estimate-far"))
|
|
1347
|
+
satellites.estimateFar = this.estimateFar;
|
|
1344
1348
|
}
|
|
1345
1349
|
this.#last = performance.now();
|
|
1346
1350
|
this.#startTick();
|
|
@@ -1451,6 +1455,43 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1451
1455
|
placeSatellite(ref) {
|
|
1452
1456
|
return this.#model.placeSatellite?.(ref) ?? null;
|
|
1453
1457
|
}
|
|
1458
|
+
/**
|
|
1459
|
+
* Keep placing satellites that are far from their element sets, as an estimate (the attribute `estimate-far`, off unless set; `estimate-far="off"` is off). A satellite is left out when the moment shown is more than `maxAgeDays` (30) from its elements; on, it is carried forward or back by the same SGP4 code
|
|
1460
|
+
* instead, and drawn lighter than a dimmed one. **An estimate is where the satellite would be if its orbit had not changed since the elements were taken.** It is worst for low orbits (drag changes them within days, and a manoeuvre moves the satellite along its path, so after weeks the estimate can be far along the orbit from the truth, and a satellite that has re-entered is not there at all) and for a long time away; a high orbit changes slowly and is close for months. Never before a satellite's launch or after its decay when its elements carry `LAUNCH_DATE` and `DECAY_DATE` (else the year of its `OBJECT_ID` is the earliest);
|
|
1461
|
+
* one SGP4 cannot carry that far, or brings down below about 120 km, is left out and is not counted as placed. Each estimated satellite is `estimated: true`, with `estimatedDays`, in `placeSatellite`, `satelliteInfo`, `chikyu-satellite-visibility` and `chikyu-satellite-click`, and `stats.satellites.estimated` counts them.
|
|
1462
|
+
* It applies to every group, those the page made with `createSatellites(sets, { estimateFar: true })` too.
|
|
1463
|
+
*
|
|
1464
|
+
* @example
|
|
1465
|
+
* ```ts
|
|
1466
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
|
|
1467
|
+
*
|
|
1468
|
+
* const farFromToday = (space: ChikyuSpace): void => {
|
|
1469
|
+
* space.estimateFar = true;
|
|
1470
|
+
* space.addEventListener("chikyu-satellite-click", (event) => console.log((event as CustomEvent).detail.estimated, (event as CustomEvent).detail.estimatedDays));
|
|
1471
|
+
* };
|
|
1472
|
+
* console.log(typeof farFromToday);
|
|
1473
|
+
* ```
|
|
1474
|
+
*/
|
|
1475
|
+
get estimateFar() {
|
|
1476
|
+
return this.hasAttribute("estimate-far") && this.getAttribute("estimate-far") !== "off";
|
|
1477
|
+
}
|
|
1478
|
+
set estimateFar(value) {
|
|
1479
|
+
if (value)
|
|
1480
|
+
this.setAttribute("estimate-far", "");
|
|
1481
|
+
else
|
|
1482
|
+
this.removeAttribute("estimate-far");
|
|
1483
|
+
}
|
|
1484
|
+
/** What an event says of a satellite's place: whether it is an estimate, and how far the moment shown is from its elements' own, in days. */
|
|
1485
|
+
#estimateOf(ref) {
|
|
1486
|
+
const info = this.#model.satellites.groups.get(ref.group)?.satellites.info(ref.index, this.#model.time);
|
|
1487
|
+
return { estimated: info?.estimated ?? false, estimatedDays: info?.estimatedDays ?? 0 };
|
|
1488
|
+
}
|
|
1489
|
+
#applyEstimate() {
|
|
1490
|
+
const on = this.estimateFar;
|
|
1491
|
+
for (const group of this.#model.satellites.groups.values())
|
|
1492
|
+
group.satellites.estimateFar = on;
|
|
1493
|
+
this.#gate?.soon();
|
|
1494
|
+
}
|
|
1454
1495
|
/** The satellite marked by `selectSatellite` or by a press on it, if any. */
|
|
1455
1496
|
get selectedSatellite() {
|
|
1456
1497
|
const chosen = this.#model.satellites.selected;
|
|
@@ -1569,7 +1610,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1569
1610
|
let epochMs = 0;
|
|
1570
1611
|
for (const group of this.#model.satellites.groups.values())
|
|
1571
1612
|
epochMs = Math.max(epochMs, group.satellites.newestEpochMs);
|
|
1572
|
-
return { groups: this.#model.satellites.groups.size, placed: drawn.placed, segments: drawn.segments, tooFast: drawn.tooFast, dotScale: drawn.dotScale, longestStreakPx: drawn.longestStreakPx, streakCapPx: drawn.streakCapPx, weight: drawn.weight, fade: drawn.fade, earthPx: drawn.earthPx, epochMs, propagations, lastBatchMs, maxBatchMs, updateMs: drawn.updateMs, maxUpdateMs: drawn.maxUpdateMs, averageUpdateMs: drawn.updates ? drawn.totalMs / drawn.updates : 0, updates: drawn.updates, selectedRing: drawn.selectedRing, hoverPath: drawn.hoverPath, hoverOpacity: drawn.hoverOpacity, selectedOpacity: drawn.selectedOpacity };
|
|
1613
|
+
return { groups: this.#model.satellites.groups.size, placed: drawn.placed, segments: drawn.segments, tooFast: drawn.tooFast, dotScale: drawn.dotScale, longestStreakPx: drawn.longestStreakPx, streakCapPx: drawn.streakCapPx, weight: drawn.weight, fade: drawn.fade, earthPx: drawn.earthPx, epochMs, propagations, lastBatchMs, maxBatchMs, updateMs: drawn.updateMs, maxUpdateMs: drawn.maxUpdateMs, averageUpdateMs: drawn.updates ? drawn.totalMs / drawn.updates : 0, updates: drawn.updates, selectedRing: drawn.selectedRing, hoverPath: drawn.hoverPath, hoverOpacity: drawn.hoverOpacity, selectedOpacity: drawn.selectedOpacity, estimated: drawn.estimated };
|
|
1573
1614
|
}
|
|
1574
1615
|
// A press that does not turn the view (under 6 pixels) on a satellite tells the page, which chooses it with `selectSatellite` if it likes.
|
|
1575
1616
|
#downX = 0;
|
|
@@ -1588,7 +1629,7 @@ export class ChikyuEarthRealistic extends HTMLElement {
|
|
|
1588
1629
|
const satellite = this.#model.pick?.(event.clientX - rect.left, event.clientY - rect.top, 12);
|
|
1589
1630
|
if (satellite) {
|
|
1590
1631
|
claimPress(event);
|
|
1591
|
-
this.dispatchEvent(new CustomEvent("chikyu-satellite-click", { detail: { ...satellite, info: this.satelliteInfo(satellite) }, bubbles: true, composed: true }));
|
|
1632
|
+
this.dispatchEvent(new CustomEvent("chikyu-satellite-click", { detail: { ...satellite, info: this.satelliteInfo(satellite), ...this.#estimateOf(satellite) }, bubbles: true, composed: true }));
|
|
1592
1633
|
return;
|
|
1593
1634
|
}
|
|
1594
1635
|
if (this.#pathControls?.press(event.clientX - rect.left, event.clientY - rect.top, pointerOf(event)))
|
|
@@ -9,7 +9,7 @@ export function toElementSet(record) {
|
|
|
9
9
|
out["OBJECT_ID"] = record["OBJECT_ID"];
|
|
10
10
|
if (typeof record["CLASSIFICATION_TYPE"] === "string" && record["CLASSIFICATION_TYPE"])
|
|
11
11
|
out["CLASSIFICATION_TYPE"] = record["CLASSIFICATION_TYPE"];
|
|
12
|
-
for (const key of ["COUNTRY_CODE", "OWNER"])
|
|
12
|
+
for (const key of ["COUNTRY_CODE", "OWNER", "LAUNCH_DATE", "DECAY_DATE"])
|
|
13
13
|
if (typeof record[key] === "string" && record[key].trim())
|
|
14
14
|
out[key] = record[key].trim();
|
|
15
15
|
const epoch = record["EPOCH"];
|
|
@@ -20,6 +20,11 @@ export interface SatellitesOptions {
|
|
|
20
20
|
maxAgeDays?: number;
|
|
21
21
|
/** The age, in days, past which a satellite is drawn dimmer because its place is less exact (14 by default). */
|
|
22
22
|
dimAfterDays?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Keep placing a satellite beyond `maxAgeDays` from its element set, as an estimate (off by default): the same elements carried forward or back by the same SGP4 code, where the satellite would be had its orbit not changed.
|
|
25
|
+
* Never before its launch date or after its decay date when the elements carry them (`LAUNCH_DATE`, `DECAY_DATE`; else the launch year in `OBJECT_ID` marks the earliest), and a satellite that SGP4 cannot carry that far, or brings down below about 120 km, is left out.
|
|
26
|
+
*/
|
|
27
|
+
estimateFar?: boolean;
|
|
23
28
|
}
|
|
24
29
|
/**
|
|
25
30
|
* Make a group of satellites from their element sets. Each starts SGP4 once here; one that does not (bad numbers, decayed at its own epoch) is listed in `refused` and left out.
|
package/dist/satellites/track.js
CHANGED
|
@@ -15,6 +15,18 @@ const MAX_STEP_MS = 60_000;
|
|
|
15
15
|
* (a Molniya orbit is 10 times quicker at its lowest point than its mean): its place and its streak are SGP4 itself, two calls a frame, for the few that are this eccentric.
|
|
16
16
|
*/
|
|
17
17
|
export const ECCENTRIC_FROM = 0.02;
|
|
18
|
+
/** A date from the catalogue (`2026-11-02`, or with a time), in milliseconds, or NaN. A bare date is taken as the start of that day UTC. */
|
|
19
|
+
const dateOf = (text) => {
|
|
20
|
+
const t = typeof text === "string" ? text.trim() : "";
|
|
21
|
+
if (t === "")
|
|
22
|
+
return Number.NaN;
|
|
23
|
+
if (t.length <= 10)
|
|
24
|
+
return Date.parse(`${t}T00:00:00Z`);
|
|
25
|
+
const iso = t.replace(" ", "T");
|
|
26
|
+
return Date.parse(/[zZ]|[+-]\d\d:?\d\d$/.test(iso) ? iso : `${iso}Z`);
|
|
27
|
+
};
|
|
28
|
+
/** The height, in kilometres above the mean Earth radius, below which a satellite carried far from its elements is taken to have come down: SGP4 has nothing true to say there, and it is never drawn inside the Earth. */
|
|
29
|
+
const LOWEST_ESTIMATE_KM = 120;
|
|
18
30
|
const epochOf = (text) => Date.parse(/[zZ]|[+-]\d\d:?\d\d$/.test(text) ? text : `${text}Z`);
|
|
19
31
|
/**
|
|
20
32
|
* Make a group of satellites from their element sets. Each starts SGP4 once here; one that does not (bad numbers, decayed at its own epoch) is listed in `refused` and left out.
|
|
@@ -57,6 +69,8 @@ export function createSatellites(sets, options = {}) {
|
|
|
57
69
|
const recs = [];
|
|
58
70
|
const usable = [];
|
|
59
71
|
const epochs = [];
|
|
72
|
+
const launchOf = [];
|
|
73
|
+
const decayOf = [];
|
|
60
74
|
const refused = [];
|
|
61
75
|
for (const set of sets) {
|
|
62
76
|
const epoch = epochOf(set.EPOCH);
|
|
@@ -75,6 +89,12 @@ export function createSatellites(sets, options = {}) {
|
|
|
75
89
|
recs.push(rec);
|
|
76
90
|
usable.push(set);
|
|
77
91
|
epochs.push(epoch);
|
|
92
|
+
// the earliest moment it can have been in orbit: its launch date, else the start of the year in its international designator; the latest: the end of its decay day
|
|
93
|
+
const launch = dateOf(set.LAUNCH_DATE);
|
|
94
|
+
const year = /^(\d{4})-\d{3}/.exec(set.OBJECT_ID ?? "");
|
|
95
|
+
launchOf.push(Number.isFinite(launch) ? launch : year ? Date.UTC(Number(year[1]), 0, 1) : Number.NEGATIVE_INFINITY);
|
|
96
|
+
const decay = dateOf(set.DECAY_DATE);
|
|
97
|
+
decayOf.push(Number.isFinite(decay) ? decay + ((set.DECAY_DATE ?? "").trim().length <= 10 ? DAY_MS - 1 : 0) : Number.POSITIVE_INFINITY);
|
|
78
98
|
}
|
|
79
99
|
catch (error) {
|
|
80
100
|
refuse(error instanceof Error ? error.message : "SGP4 could not start from these elements");
|
|
@@ -121,6 +141,17 @@ export function createSatellites(sets, options = {}) {
|
|
|
121
141
|
let propagations = 0;
|
|
122
142
|
let placed = 0;
|
|
123
143
|
const timing = { lastBatchMs: 0, maxBatchMs: 0 };
|
|
144
|
+
let estimate = options.estimateFar === true;
|
|
145
|
+
let estimatedCount = 0;
|
|
146
|
+
/** Whether a satellite is placed at a moment: within `maxAgeDays` of its elements, or, when far moments are estimated, inside the time it was in orbit. */
|
|
147
|
+
const usableAt = (i, ms) => {
|
|
148
|
+
if (estimate)
|
|
149
|
+
return ms >= launchOf[i] && ms <= decayOf[i];
|
|
150
|
+
return Math.abs(ms - epochs[i]) <= maxAgeMs;
|
|
151
|
+
};
|
|
152
|
+
const isFar = (i, ms) => estimate && Math.abs(ms - epochs[i]) > maxAgeMs;
|
|
153
|
+
/** A carried-far position that is down in the air or inside the Earth is no estimate (Earth radii). */
|
|
154
|
+
const tooLow = (x, y, z) => Math.hypot(x, y, z) < 1 + LOWEST_ESTIMATE_KM / EARTH_RADIUS_KM;
|
|
124
155
|
const pinned = new Float32Array(n * 3);
|
|
125
156
|
const pinOk = new Uint8Array(n);
|
|
126
157
|
// when each satellite was last pinned (NaN: never), so a group can be pinned a slice at a time and `arc` turns each from its own pin
|
|
@@ -148,14 +179,14 @@ export function createSatellites(sets, options = {}) {
|
|
|
148
179
|
if (skipEccentric && isEccentric[i] === 1)
|
|
149
180
|
continue;
|
|
150
181
|
const epoch = epochs[i];
|
|
151
|
-
if (
|
|
182
|
+
if (!usableAt(i, ms)) {
|
|
152
183
|
ok[i] = 0;
|
|
153
184
|
continue;
|
|
154
185
|
}
|
|
155
186
|
propagations += 1;
|
|
156
187
|
const result = sgp4(recs[i], (ms - epoch) / 60_000);
|
|
157
188
|
const p = result && result.position;
|
|
158
|
-
if (!p || !Number.isFinite(p.x)) {
|
|
189
|
+
if (!p || !Number.isFinite(p.x) || (isFar(i, ms) && tooLow(p.x / EARTH_RADIUS_KM, p.y / EARTH_RADIUS_KM, p.z / EARTH_RADIUS_KM))) {
|
|
159
190
|
ok[i] = 0;
|
|
160
191
|
continue;
|
|
161
192
|
}
|
|
@@ -170,12 +201,14 @@ export function createSatellites(sets, options = {}) {
|
|
|
170
201
|
};
|
|
171
202
|
const exactAt = (index, ms, out) => {
|
|
172
203
|
const epoch = epochs[index];
|
|
173
|
-
if (epoch === undefined ||
|
|
204
|
+
if (epoch === undefined || !usableAt(index, ms))
|
|
174
205
|
return false;
|
|
175
206
|
propagations += 1;
|
|
176
207
|
const result = sgp4(recs[index], (ms - epoch) / 60_000);
|
|
177
208
|
if (!result || !result.position || !result.velocity || !Number.isFinite(result.position.x))
|
|
178
209
|
return false;
|
|
210
|
+
if (isFar(index, ms) && tooLow(result.position.x / EARTH_RADIUS_KM, result.position.y / EARTH_RADIUS_KM, result.position.z / EARTH_RADIUS_KM))
|
|
211
|
+
return false;
|
|
179
212
|
out[0] = result.position.x / EARTH_RADIUS_KM;
|
|
180
213
|
out[1] = result.position.z / EARTH_RADIUS_KM;
|
|
181
214
|
out[2] = -result.position.y / EARTH_RADIUS_KM;
|
|
@@ -203,6 +236,24 @@ export function createSatellites(sets, options = {}) {
|
|
|
203
236
|
get placed() {
|
|
204
237
|
return placed;
|
|
205
238
|
},
|
|
239
|
+
get estimateFar() {
|
|
240
|
+
return estimate;
|
|
241
|
+
},
|
|
242
|
+
set estimateFar(value) {
|
|
243
|
+
if (value === estimate)
|
|
244
|
+
return;
|
|
245
|
+
estimate = value;
|
|
246
|
+
// what was placed was placed under the other rule: place everything again, and draw each satellite's look again
|
|
247
|
+
ready = false;
|
|
248
|
+
pinnedCount = 0;
|
|
249
|
+
pinMsOf.fill(Number.NaN);
|
|
250
|
+
dimmed.fill(0);
|
|
251
|
+
dimVersion += 1;
|
|
252
|
+
},
|
|
253
|
+
get estimatedCount() {
|
|
254
|
+
return estimatedCount;
|
|
255
|
+
},
|
|
256
|
+
estimated: (index) => dimmed[index] === 2 && shown[index] === 1,
|
|
206
257
|
pin(ms, first = 0, count = n) {
|
|
207
258
|
if (n === 0)
|
|
208
259
|
return;
|
|
@@ -232,7 +283,7 @@ export function createSatellites(sets, options = {}) {
|
|
|
232
283
|
let count = 0;
|
|
233
284
|
for (let i = 0; i < n; i += 1) {
|
|
234
285
|
const k = i * 3;
|
|
235
|
-
const dim = Math.abs(ms - epochs[i]) > dimAfterMs ? 1 : 0;
|
|
286
|
+
const dim = isFar(i, ms) ? 2 : Math.abs(ms - epochs[i]) > dimAfterMs ? 1 : 0;
|
|
236
287
|
if (dim !== dimmed[i]) {
|
|
237
288
|
dimmed[i] = dim;
|
|
238
289
|
dimVersion += 1;
|
|
@@ -298,6 +349,10 @@ export function createSatellites(sets, options = {}) {
|
|
|
298
349
|
count += 1;
|
|
299
350
|
}
|
|
300
351
|
placed = count;
|
|
352
|
+
estimatedCount = 0;
|
|
353
|
+
for (let i = 0; i < n; i += 1)
|
|
354
|
+
if (dimmed[i] === 2 && shown[i] === 1)
|
|
355
|
+
estimatedCount += 1;
|
|
301
356
|
return count;
|
|
302
357
|
},
|
|
303
358
|
setStep(ms) {
|
|
@@ -337,7 +392,7 @@ export function createSatellites(sets, options = {}) {
|
|
|
337
392
|
let count = 0;
|
|
338
393
|
for (let i = 0; i < n; i += 1) {
|
|
339
394
|
const k = i * 3;
|
|
340
|
-
const dim = Math.abs(ms - epochs[i]) > dimAfterMs ? 1 : 0;
|
|
395
|
+
const dim = isFar(i, ms) ? 2 : Math.abs(ms - epochs[i]) > dimAfterMs ? 1 : 0;
|
|
341
396
|
if (dim !== dimmed[i]) {
|
|
342
397
|
dimmed[i] = dim;
|
|
343
398
|
dimVersion += 1;
|
|
@@ -357,6 +412,10 @@ export function createSatellites(sets, options = {}) {
|
|
|
357
412
|
}
|
|
358
413
|
}
|
|
359
414
|
placed = count;
|
|
415
|
+
estimatedCount = 0;
|
|
416
|
+
for (let i = 0; i < n; i += 1)
|
|
417
|
+
if (dimmed[i] === 2 && shown[i] === 1)
|
|
418
|
+
estimatedCount += 1;
|
|
360
419
|
},
|
|
361
420
|
visible: (index) => shown[index] === 1,
|
|
362
421
|
exact: exactAt,
|
|
@@ -385,6 +444,8 @@ export function createSatellites(sets, options = {}) {
|
|
|
385
444
|
objectId: set.OBJECT_ID,
|
|
386
445
|
epochMs: epochs[index],
|
|
387
446
|
ageDays: (ms - epochs[index]) / DAY_MS,
|
|
447
|
+
estimated: isFar(index, ms),
|
|
448
|
+
estimatedDays: Math.abs(ms - epochs[index]) / DAY_MS,
|
|
388
449
|
altitudeKm: Math.hypot(one[0], one[1], one[2]) * EARTH_RADIUS_KM - EARTH_RADIUS_KM,
|
|
389
450
|
speedKmS: Math.hypot(one[3], one[4], one[5]),
|
|
390
451
|
periodMinutes: 1440 / set.MEAN_MOTION,
|
|
@@ -52,6 +52,10 @@ export interface ElementSet {
|
|
|
52
52
|
COUNTRY_CODE?: string;
|
|
53
53
|
/** The owner's code, as the other catalogue writes it (the same codes), when the source carries it. */
|
|
54
54
|
OWNER?: string;
|
|
55
|
+
/** The day it was launched (`2026-11-02`), as CelesTrak's satellite catalogue writes it, when the source carries it: with `estimateFar` a satellite is never placed before it. */
|
|
56
|
+
LAUNCH_DATE?: string;
|
|
57
|
+
/** The day it decayed or re-entered, when it has: with `estimateFar` a satellite is never placed after it. */
|
|
58
|
+
DECAY_DATE?: string;
|
|
55
59
|
}
|
|
56
60
|
/**
|
|
57
61
|
* What a page can tell a reader about one satellite at a moment: its name, its number, how old its elements are, how high and how fast it is.
|
|
@@ -76,6 +80,10 @@ export interface SatelliteInfo {
|
|
|
76
80
|
epochMs: number;
|
|
77
81
|
/** Days between the elements' moment and the moment asked about (negative before it). */
|
|
78
82
|
ageDays: number;
|
|
83
|
+
/** The moment asked about is beyond `maxAgeDays` from the elements, so the place is an estimate (`estimateFar`): where it would be had its orbit not changed. */
|
|
84
|
+
estimated: boolean;
|
|
85
|
+
/** How far the moment asked about is from the elements' own, in days, whichever way (0 or more): for a card that says "estimated, 36 days from its last tracking". */
|
|
86
|
+
estimatedDays: number;
|
|
79
87
|
/** Height above the mean Earth radius (6371 km) at that moment. */
|
|
80
88
|
altitudeKm: number;
|
|
81
89
|
/** Speed against the stars, kilometres a second. */
|
|
@@ -162,6 +170,12 @@ export interface Satellites {
|
|
|
162
170
|
visible(index: number): boolean;
|
|
163
171
|
/** How many of them the last `at` or `arc` placed. */
|
|
164
172
|
readonly placed: number;
|
|
173
|
+
/** Place satellites beyond `maxAgeDays` from their elements as an estimate (`estimateFar`, off by default). Setting it places everything again at the next draw. */
|
|
174
|
+
estimateFar: boolean;
|
|
175
|
+
/** How many satellites the last `at` or `arc` placed as an estimate. */
|
|
176
|
+
readonly estimatedCount: number;
|
|
177
|
+
/** True if satellite `index` was placed by the last `at` or `arc` as an estimate: its moment is beyond `maxAgeDays` from its elements. */
|
|
178
|
+
estimated(index: number): boolean;
|
|
165
179
|
/** The newest element epoch in the group, in milliseconds since the Unix epoch, or 0 when it is empty. The date of the data. */
|
|
166
180
|
readonly newestEpochMs: number;
|
|
167
181
|
/** Red, green and blue, from 0 to 1, of each satellite's orbit class, 3 numbers a satellite. It does not change. */
|
|
@@ -173,6 +173,7 @@ type SatelliteStats = {
|
|
|
173
173
|
hoverPath: boolean;
|
|
174
174
|
hoverOpacity: number;
|
|
175
175
|
selectedOpacity: number;
|
|
176
|
+
estimated: number;
|
|
176
177
|
};
|
|
177
178
|
/**
|
|
178
179
|
* The `<chikyu-space>` custom element: the Earth, the Moon, the Sun and the planets where they are at a date and time, drawn with three.js through the shared renderer. It takes `center`, `time` (`now` or an ISO date), `speed` (1 is real time, 0 holds, 86400 is a day a second, negative runs backwards), `scale` (`compressed` or `true`), `labels` and `orbits` (`off` hides them); positions are computed in the browser by astronomy-engine, an optional peer dependency. It draws only when something changes, and nothing while it is out of sight.
|
|
@@ -712,6 +713,25 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
712
713
|
set namesOnHover(value: boolean);
|
|
713
714
|
/** Mark one satellite: a larger ring round it, its orbit drawn, and its name beside it. `null` lets it go. */
|
|
714
715
|
selectSatellite(ref: SatelliteRef | null): void;
|
|
716
|
+
/**
|
|
717
|
+
* Keep placing satellites that are far from their element sets, as an estimate (the attribute `estimate-far`, off unless set; `estimate-far="off"` is off). A satellite is left out when the moment shown is more than `maxAgeDays` (30) from its elements; on, it is carried forward or back by the same SGP4 code
|
|
718
|
+
* instead, and drawn lighter than a dimmed one. **An estimate is where the satellite would be if its orbit had not changed since the elements were taken.** It is worst for low orbits (drag changes them within days, and a manoeuvre moves the satellite along its path, so after weeks the estimate can be far along the orbit from the truth, and a satellite that has re-entered is not there at all) and for a long time away; a high orbit changes slowly and is close for months. Never before a satellite's launch or after its decay when its elements carry `LAUNCH_DATE` and `DECAY_DATE` (else the year of its `OBJECT_ID` is the earliest);
|
|
719
|
+
* one SGP4 cannot carry that far, or brings down below about 120 km, is left out and is not counted as placed. Each estimated satellite is `estimated: true`, with `estimatedDays`, in `placeSatellite`, `satelliteInfo`, `chikyu-satellite-visibility` and `chikyu-satellite-click`, and `stats.satellites.estimated` counts them.
|
|
720
|
+
* It applies to every group, those the page made with `createSatellites(sets, { estimateFar: true })` too.
|
|
721
|
+
*
|
|
722
|
+
* @example
|
|
723
|
+
* ```ts
|
|
724
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
|
|
725
|
+
*
|
|
726
|
+
* const farFromToday = (space: ChikyuSpace): void => {
|
|
727
|
+
* space.estimateFar = true;
|
|
728
|
+
* space.addEventListener("chikyu-satellite-click", (event) => console.log((event as CustomEvent).detail.estimated, (event as CustomEvent).detail.estimatedDays));
|
|
729
|
+
* };
|
|
730
|
+
* console.log(typeof farFromToday);
|
|
731
|
+
* ```
|
|
732
|
+
*/
|
|
733
|
+
get estimateFar(): boolean;
|
|
734
|
+
set estimateFar(value: boolean);
|
|
715
735
|
/** The satellite marked by `selectSatellite` or by a press on it, if any. */
|
|
716
736
|
get selectedSatellite(): SatelliteRef | null;
|
|
717
737
|
/**
|
|
@@ -177,7 +177,7 @@ const STYLE = `:host{display:block;aspect-ratio:1/1;position:relative;overflow:h
|
|
|
177
177
|
* ```
|
|
178
178
|
*/
|
|
179
179
|
export class ChikyuSpace extends HTMLElement {
|
|
180
|
-
static observedAttributes = ["cloud-drift", "camera", "earth-size", "earth-x", "earth-y", "center", "time", "speed", "scale", "labels", "orbits", "bodies", "light", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...BEAM_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "bodies-credit", "satellite-tint", "satellite-streak-max", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "tiles-finer-timeout", "ride-viewpoint", "ride-model-size", "hover-path", "names-on-hover", "selected-path", "path-hit", "follow", "follow-ease", "dim-occluded", "ride-model-share", "ride-model-seat", "ride-zoom"];
|
|
180
|
+
static observedAttributes = ["cloud-drift", "camera", "earth-size", "earth-x", "earth-y", "center", "time", "speed", "scale", "labels", "orbits", "bodies", "light", "meteors", "meteors-label", "meteors-strength", ...BODY_LABEL_ATTRIBUTES, ...SKY_ATTRIBUTES, ...CITY_NAMES_ATTRIBUTES, ...BORDER_ATTRIBUTES, ...GRID_ATTRIBUTES, ...BEAM_ATTRIBUTES, ...COUNTRY_NAMES_ATTRIBUTES, ...SEA_NAMES_ATTRIBUTES, "air-thickness", "air-label", "lang", "places", "places-look", "place-groups", "here-city", "route", "bodies-credit", "satellite-tint", "satellite-streak-max", "tiles", "tiles-finer", "tiles-finer-layer", "tiles-finer-date", "tiles-finer-timeout", "ride-viewpoint", "ride-model-size", "hover-path", "names-on-hover", "selected-path", "path-hit", "estimate-far", "follow", "follow-ease", "dim-occluded", "ride-model-share", "ride-model-seat", "ride-zoom"];
|
|
181
181
|
#model = newSpaceModel();
|
|
182
182
|
/** The finer imagery (NASA's tile service), one source while the attributes stay the same. Off unless `tiles-finer="gibs"`. */
|
|
183
183
|
#finerHold = createFinerHolder(() => new Date(this.#model.time), () => this.#gate?.request());
|
|
@@ -580,6 +580,8 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
580
580
|
this.#hover?.sync();
|
|
581
581
|
else if (name === "selected-path")
|
|
582
582
|
this.#pathControls?.sync();
|
|
583
|
+
else if (name === "estimate-far")
|
|
584
|
+
this.#applyEstimate();
|
|
583
585
|
else if (name === "path-hit") {
|
|
584
586
|
/* read at each press and move */
|
|
585
587
|
}
|
|
@@ -1899,6 +1901,8 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
1899
1901
|
orbits: (style.orbits ?? was?.orbits ?? false) && satellites.count <= MAX_ORBIT_GROUP,
|
|
1900
1902
|
visible: was?.visible ?? true,
|
|
1901
1903
|
});
|
|
1904
|
+
if (typeof this.hasAttribute === "function" && this.hasAttribute("estimate-far"))
|
|
1905
|
+
satellites.estimateFar = this.estimateFar;
|
|
1902
1906
|
}
|
|
1903
1907
|
// a group's index may now be a different satellite, so a cached name for that ref is no longer its name
|
|
1904
1908
|
this.#satLabelCache.clear();
|
|
@@ -2008,6 +2012,43 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
2008
2012
|
this.#chosenLabel.hidden = true;
|
|
2009
2013
|
this.#gate?.request();
|
|
2010
2014
|
}
|
|
2015
|
+
/**
|
|
2016
|
+
* Keep placing satellites that are far from their element sets, as an estimate (the attribute `estimate-far`, off unless set; `estimate-far="off"` is off). A satellite is left out when the moment shown is more than `maxAgeDays` (30) from its elements; on, it is carried forward or back by the same SGP4 code
|
|
2017
|
+
* instead, and drawn lighter than a dimmed one. **An estimate is where the satellite would be if its orbit had not changed since the elements were taken.** It is worst for low orbits (drag changes them within days, and a manoeuvre moves the satellite along its path, so after weeks the estimate can be far along the orbit from the truth, and a satellite that has re-entered is not there at all) and for a long time away; a high orbit changes slowly and is close for months. Never before a satellite's launch or after its decay when its elements carry `LAUNCH_DATE` and `DECAY_DATE` (else the year of its `OBJECT_ID` is the earliest);
|
|
2018
|
+
* one SGP4 cannot carry that far, or brings down below about 120 km, is left out and is not counted as placed. Each estimated satellite is `estimated: true`, with `estimatedDays`, in `placeSatellite`, `satelliteInfo`, `chikyu-satellite-visibility` and `chikyu-satellite-click`, and `stats.satellites.estimated` counts them.
|
|
2019
|
+
* It applies to every group, those the page made with `createSatellites(sets, { estimateFar: true })` too.
|
|
2020
|
+
*
|
|
2021
|
+
* @example
|
|
2022
|
+
* ```ts
|
|
2023
|
+
* import type { ChikyuSpace } from "@johnmorrisdotca/chikyu-earth/space";
|
|
2024
|
+
*
|
|
2025
|
+
* const farFromToday = (space: ChikyuSpace): void => {
|
|
2026
|
+
* space.estimateFar = true;
|
|
2027
|
+
* space.addEventListener("chikyu-satellite-click", (event) => console.log((event as CustomEvent).detail.estimated, (event as CustomEvent).detail.estimatedDays));
|
|
2028
|
+
* };
|
|
2029
|
+
* console.log(typeof farFromToday);
|
|
2030
|
+
* ```
|
|
2031
|
+
*/
|
|
2032
|
+
get estimateFar() {
|
|
2033
|
+
return this.hasAttribute("estimate-far") && this.getAttribute("estimate-far") !== "off";
|
|
2034
|
+
}
|
|
2035
|
+
set estimateFar(value) {
|
|
2036
|
+
if (value)
|
|
2037
|
+
this.setAttribute("estimate-far", "");
|
|
2038
|
+
else
|
|
2039
|
+
this.removeAttribute("estimate-far");
|
|
2040
|
+
}
|
|
2041
|
+
/** What an event says of a satellite's place: whether it is an estimate, and how far the moment shown is from its elements' own, in days. */
|
|
2042
|
+
#estimateOf(ref) {
|
|
2043
|
+
const info = this.#model.satellites.groups.get(ref.group)?.satellites.info(ref.index, this.#model.time);
|
|
2044
|
+
return { estimated: info?.estimated ?? false, estimatedDays: info?.estimatedDays ?? 0 };
|
|
2045
|
+
}
|
|
2046
|
+
#applyEstimate() {
|
|
2047
|
+
const on = this.estimateFar;
|
|
2048
|
+
for (const group of this.#model.satellites.groups.values())
|
|
2049
|
+
group.satellites.estimateFar = on;
|
|
2050
|
+
this.#gate?.request();
|
|
2051
|
+
}
|
|
2011
2052
|
/** The satellite marked by `selectSatellite` or by a press on it, if any. */
|
|
2012
2053
|
get selectedSatellite() {
|
|
2013
2054
|
const chosen = this.#model.satellites.selected;
|
|
@@ -2196,12 +2237,12 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
2196
2237
|
const key = `${m.ref.group}:${m.ref.index}`;
|
|
2197
2238
|
now.set(key, m.visible);
|
|
2198
2239
|
if (this.#markSeen.get(key) !== m.visible && (this.#markSeen.has(key) || m.visible))
|
|
2199
|
-
this.dispatchEvent(new CustomEvent("chikyu-satellite-visibility", { detail: { ref: m.ref, visible: m.visible }, bubbles: true, composed: true }));
|
|
2240
|
+
this.dispatchEvent(new CustomEvent("chikyu-satellite-visibility", { detail: { ref: m.ref, visible: m.visible, ...this.#estimateOf(m.ref) }, bubbles: true, composed: true }));
|
|
2200
2241
|
}
|
|
2201
2242
|
for (const [key, was] of this.#markSeen) {
|
|
2202
2243
|
if (!now.has(key) && was) {
|
|
2203
2244
|
const [group, index] = key.split(":");
|
|
2204
|
-
this.dispatchEvent(new CustomEvent("chikyu-satellite-visibility", { detail: { ref: { group: group, index: Number(index) }, visible: false }, bubbles: true, composed: true }));
|
|
2245
|
+
this.dispatchEvent(new CustomEvent("chikyu-satellite-visibility", { detail: { ref: { group: group, index: Number(index) }, visible: false, ...this.#estimateOf({ group: group, index: Number(index) }) }, bubbles: true, composed: true }));
|
|
2205
2246
|
}
|
|
2206
2247
|
}
|
|
2207
2248
|
this.#markSeen = now;
|
|
@@ -2303,7 +2344,7 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
2303
2344
|
let epochMs = 0;
|
|
2304
2345
|
for (const group of this.#model.satellites.groups.values())
|
|
2305
2346
|
epochMs = Math.max(epochMs, group.satellites.newestEpochMs);
|
|
2306
|
-
return { groups: this.#model.satellites.groups.size, placed: drawn.placed, segments: drawn.segments, tooFast: drawn.tooFast, dotScale: drawn.dotScale, longestStreakPx: drawn.longestStreakPx, streakCapPx: drawn.streakCapPx, weight: drawn.weight, fade: drawn.fade, earthPx: drawn.earthPx, epochMs, propagations, lastBatchMs, maxBatchMs, updateMs: drawn.updateMs, maxUpdateMs: drawn.maxUpdateMs, averageUpdateMs: drawn.updates ? drawn.totalMs / drawn.updates : 0, updates: drawn.updates, selectedRing: drawn.selectedRing, hoverPath: drawn.hoverPath, hoverOpacity: drawn.hoverOpacity, selectedOpacity: drawn.selectedOpacity };
|
|
2347
|
+
return { groups: this.#model.satellites.groups.size, placed: drawn.placed, segments: drawn.segments, tooFast: drawn.tooFast, dotScale: drawn.dotScale, longestStreakPx: drawn.longestStreakPx, streakCapPx: drawn.streakCapPx, weight: drawn.weight, fade: drawn.fade, earthPx: drawn.earthPx, epochMs, propagations, lastBatchMs, maxBatchMs, updateMs: drawn.updateMs, maxUpdateMs: drawn.maxUpdateMs, averageUpdateMs: drawn.updates ? drawn.totalMs / drawn.updates : 0, updates: drawn.updates, selectedRing: drawn.selectedRing, hoverPath: drawn.hoverPath, hoverOpacity: drawn.hoverOpacity, selectedOpacity: drawn.selectedOpacity, estimated: drawn.estimated };
|
|
2307
2348
|
}
|
|
2308
2349
|
// --- the game clock ----------------------------------------------------------------------------------------------------------------------------
|
|
2309
2350
|
#readSpeed() {
|
|
@@ -2433,7 +2474,7 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
2433
2474
|
const satellite = this.#model.pick?.(x, y, 12);
|
|
2434
2475
|
if (satellite) {
|
|
2435
2476
|
claimPress(event);
|
|
2436
|
-
this.dispatchEvent(new CustomEvent("chikyu-satellite-click", { detail: { ...satellite, info: this.satelliteInfo(satellite) }, bubbles: true, composed: true }));
|
|
2477
|
+
this.dispatchEvent(new CustomEvent("chikyu-satellite-click", { detail: { ...satellite, info: this.satelliteInfo(satellite), ...this.#estimateOf(satellite) }, bubbles: true, composed: true }));
|
|
2437
2478
|
return;
|
|
2438
2479
|
}
|
|
2439
2480
|
if (this.#pathControls?.press(x, y, pointerOf(event))) {
|
|
@@ -82,6 +82,7 @@ export interface SatelliteState {
|
|
|
82
82
|
selectedOpacity: number;
|
|
83
83
|
pathsDrawn: number;
|
|
84
84
|
pathDraws: number;
|
|
85
|
+
estimated: number;
|
|
85
86
|
};
|
|
86
87
|
}
|
|
87
88
|
/**
|
|
@@ -221,6 +222,8 @@ export interface SatelliteScreen {
|
|
|
221
222
|
behind: boolean;
|
|
222
223
|
/** The Earth hides the satellite: the line from the camera meets the globe before the satellite. False at the limb, in front, and when the satellite is only behind the camera. */
|
|
223
224
|
occluded: boolean;
|
|
225
|
+
/** Its place is an estimate (`estimate-far`): the moment shown is beyond `maxAgeDays` from its elements. */
|
|
226
|
+
estimated: boolean;
|
|
224
227
|
}
|
|
225
228
|
export interface SatelliteLayer {
|
|
226
229
|
/** Where one satellite of a shown group is on the screen as of the last update, or `null` when its group is not shown or it is not placed (its elements are too old). A satellite outside the picture or behind the camera is still returned, with `visible` false. */
|
|
@@ -56,7 +56,7 @@ export function longestStreak(segments, count, earthPx) {
|
|
|
56
56
|
}
|
|
57
57
|
return longest * earthPx;
|
|
58
58
|
}
|
|
59
|
-
export const newSatelliteState = () => ({ groups: new Map(), selected: null, marked: new Set(), pinned: [], orbitTint: false, focus: null, modelOver: null, hover: { ref: null, fade: 0, enabled: true, color: "#ffffff", opacity: HOVER_PATH_OPACITY }, paths: { requests: [], overrides: {}, selectedOn: true, version: 0, info: [], dropped: 0, unresolved: 0 }, ridden: null, streakMax: DEFAULT_STREAK_MAX, drawn: { placed: 0, segments: 0, tooFast: false, dotScale: 1, longestStreakPx: 0, streakCapPx: 0, weight: 1, fade: 1, earthPx: 0, updateMs: 0, maxUpdateMs: 0, updates: 0, totalMs: 0, selectedRing: false, hoverPath: false, hoverOpacity: 0, selectedOpacity: 0, pathsDrawn: 0, pathDraws: 0 } });
|
|
59
|
+
export const newSatelliteState = () => ({ groups: new Map(), selected: null, marked: new Set(), pinned: [], orbitTint: false, focus: null, modelOver: null, hover: { ref: null, fade: 0, enabled: true, color: "#ffffff", opacity: HOVER_PATH_OPACITY }, paths: { requests: [], overrides: {}, selectedOn: true, version: 0, info: [], dropped: 0, unresolved: 0 }, ridden: null, streakMax: DEFAULT_STREAK_MAX, drawn: { placed: 0, segments: 0, tooFast: false, dotScale: 1, longestStreakPx: 0, streakCapPx: 0, weight: 1, fade: 1, earthPx: 0, updateMs: 0, maxUpdateMs: 0, updates: 0, totalMs: 0, selectedRing: false, hoverPath: false, hoverOpacity: 0, selectedOpacity: 0, pathsDrawn: 0, pathDraws: 0, estimated: 0 } });
|
|
60
60
|
/** The most orbits a group may draw all at once, one line each. */
|
|
61
61
|
export const MAX_ORBIT_GROUP = 40;
|
|
62
62
|
const ORBIT_POINTS = 120;
|
|
@@ -101,14 +101,19 @@ void main() {
|
|
|
101
101
|
float d = length(gl_PointCoord - vec2(0.5));
|
|
102
102
|
if (d > 0.5) discard;
|
|
103
103
|
vec3 ink = byClass > 0.5 ? vCls : tint;
|
|
104
|
+
// a dim of 1 is an old element set; above 1 is an estimate (estimate-far): lighter, and fainter than an old one, so the two are told apart
|
|
105
|
+
float estimated = step(1.5, vDim);
|
|
106
|
+
float old = min(vDim, 1.0);
|
|
107
|
+
ink = mix(ink, vec3(1.0), 0.5 * estimated);
|
|
108
|
+
float weak = (1.0 - 0.7 * old) * (1.0 - 0.45 * estimated);
|
|
104
109
|
if (ring > 0.5) {
|
|
105
110
|
float a = smoothstep(0.30, 0.38, d) * (1.0 - smoothstep(0.44, 0.5, d));
|
|
106
|
-
gl_FragColor = vec4(ink, a *
|
|
111
|
+
gl_FragColor = vec4(ink, a * weak);
|
|
107
112
|
} else {
|
|
108
113
|
float rimEdge = smoothstep(0.28, 0.42, d);
|
|
109
|
-
vec3 colour = mix(ink, vec3(0.04, 0.05, 0.08), rimEdge * rim);
|
|
114
|
+
vec3 colour = mix(ink, vec3(0.04, 0.05, 0.08), rimEdge * rim * (1.0 - 0.6 * estimated));
|
|
110
115
|
float a = smoothstep(0.50, 0.40, d);
|
|
111
|
-
gl_FragColor = vec4(colour, a *
|
|
116
|
+
gl_FragColor = vec4(colour, a * weak * fade);
|
|
112
117
|
}
|
|
113
118
|
}`;
|
|
114
119
|
/** How long, in milliseconds of wall time, a satellite's place is kept before SGP4 places it again when the clock is too fast to interpolate: about once a second. */
|
|
@@ -610,6 +615,11 @@ export function createSatelliteLayer(three, scene, state, ratio) {
|
|
|
610
615
|
state.drawn.hoverPath = hoverLoop.visible;
|
|
611
616
|
state.drawn.hoverOpacity = hoverLoop.visible ? hoverLine.material.opacity : 0;
|
|
612
617
|
state.drawn.placed = placed;
|
|
618
|
+
let estimated = 0;
|
|
619
|
+
for (const group of state.groups.values())
|
|
620
|
+
if (group.visible)
|
|
621
|
+
estimated += group.satellites.estimatedCount;
|
|
622
|
+
state.drawn.estimated = estimated;
|
|
613
623
|
state.drawn.segments = segments;
|
|
614
624
|
state.drawn.longestStreakPx = longest;
|
|
615
625
|
state.drawn.streakCapPx = capLength * radius;
|
|
@@ -716,7 +726,7 @@ export function createSatelliteLayer(three, scene, state, ratio) {
|
|
|
716
726
|
else
|
|
717
727
|
hidden = earthHides(c, world);
|
|
718
728
|
}
|
|
719
|
-
return { x, y, visible: !behind && !hidden && edge === null, heightKm, edge, behind, occluded: hidden };
|
|
729
|
+
return { x, y, visible: !behind && !hidden && edge === null, heightKm, edge, behind, occluded: hidden, estimated: find(ref)?.estimated(ref.index) ?? false };
|
|
720
730
|
},
|
|
721
731
|
pathAt(x, y, camera, size, radius) {
|
|
722
732
|
if (!(radius > 0))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/chikyu-earth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.49.0",
|
|
4
4
|
"description": "Chikyu Earth 地球 — A line-drawn globe for the web: country outlines that turn at the Earth's own rate, centred on the place you give it, with an optional realistic Earth from space (three.js), the Sun, Moon and planets, satellites on their orbits, and markers for any place. A web component and an SVG string.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"earth",
|