@johnmorrisdotca/chikyu-earth 0.62.0 → 0.63.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/README.md +2 -2
- package/dist/space/element-base.d.ts +4 -3
- package/dist/space/element-base.js +7 -6
- package/dist/space/scene.js +40 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.63.0 - 2026-11-19
|
|
6
|
+
|
|
7
|
+
- **The view above a satellite has no facings, and a ride's camera never goes under the ground** (MODULES-1685).
|
|
8
|
+
- **Above.** `face()` in a ride with `view: "above"` returns `false` and leaves the camera as it was, and a `face` in `ride`'s options is left out there (`riding.face` is `null`). A facing there used to put the camera beside the satellite looking along the ground with the top of the picture (`aboveAxes`) along the line of sight, so three.js's `lookAt` had no way to turn the camera and took one from rounding, a different one each draw: the picture turned by up to 176 degrees between two reads and never settled. `up` put the camera under the satellite, inside the Earth (2,575 km under the ground for the ISS at the default 3,000 km).
|
|
9
|
+
- **Following a satellite** (`view: "follow"`) keeps its facings, and they now settle: along the ground (ahead, behind, left, right) the top of the picture is the sky, square to the line of sight.
|
|
10
|
+
- **Never under the ground.** In every view, facing, drag and glide the camera is held at least 1 km above the ground, and the near plane comes in when it is. A camera that looks at a satellite comes in towards it along its line of sight, so the satellite stays in its place in the picture; any other moves out along its line from the Earth's centre. The cases: a satellite that has come down, a camera following one from the far side of the Earth (it was 90 km under the ground in the test), a facing that would put it under the satellite, the straight line of a glide.
|
|
11
|
+
- **Tests.** `e2e/ride-steady.gl.ts`: above, each facing is refused and the camera holds its look; for every view and facing the camera stays above the ground; from the satellite and following it, every facing turns the camera and it holds still to under half a degree a second. They fail on 0.62.0. The ride guide in English and Japanese, `docs/ride-along.md` and the README.
|
|
12
|
+
|
|
3
13
|
## 0.62.0 - 2026-11-19
|
|
4
14
|
|
|
5
15
|
- **A fly-to on the space view, and moves that bend instead of stopping** (MODULES-1582).
|
package/README.md
CHANGED
|
@@ -359,7 +359,7 @@ Passes are only as good as the orbit data are new: each pass says how old its el
|
|
|
359
359
|
<p align="center"><img alt="Riding along with the ISS, tipped towards the horizon: the Earth's curve and atmosphere, and the orbits of the other stations in the sky" src="docs/images/space-ride-horizon.png" width="420"></p>
|
|
360
360
|
|
|
361
361
|
`space.ride({ group: "stations", index: 0 }, { look: "horizon" })` puts the camera on the ISS (or a Starlink satellite, the Moon, a planet) at its real place for the moment shown and looks at the Earth, which goes by beneath
|
|
362
|
-
as the body moves along its orbit; switch to another body and the camera glides there. Straight down or toward the horizon, from the body or following it at a distance, time faster or slower. A ridden satellite is in the picture by default (the camera a little behind and above it, a small drawing of it where the page has no model, not to scale); `ride-viewpoint="inside"` (property `rideViewpoint`, option `viewpoint`) puts the camera at the satellite instead. A drag turns the view where the camera is, like turning your head (the satellite leaves the picture as you look away); `ride-drag="orbit"` (property `rideDrag`, option `drag`) takes the camera round the satellite as before. Seen from above, the model shrinks as the ride rises and hands over to the ordinary mark by 2,000 km; `ride-model-size="fixed"` (property `rideModelSize`, option `modelSize`) keeps one size at every height. `ride-up="north"` (property `rideUp`, option `up`) puts north at the top of the view above a satellite, so it is seen to go the way it really goes; a small compass on a ride shows north and the heading (`compass="off"` hides it), `rideTrack` and `chikyu-ride-track` give the heading, ground point and whether the Sun lights it, and the chosen orbit is amber in sunlight and blue in the Earth's shadow (`path-light="off"` for one colour). `ride-model-share`, `ride-model-seat` and `ride-zoom` frame and zoom the ridden satellite (properties `rideModelShare`, `rideModelSeat`, `rideZoom`). It animates continuously, so it keeps to the
|
|
362
|
+
as the body moves along its orbit; switch to another body and the camera glides there. Straight down or toward the horizon, from the body or following it at a distance, time faster or slower. A ridden satellite is in the picture by default (the camera a little behind and above it, a small drawing of it where the page has no model, not to scale); `ride-viewpoint="inside"` (property `rideViewpoint`, option `viewpoint`) puts the camera at the satellite instead. A drag turns the view where the camera is, like turning your head (the satellite leaves the picture as you look away); `ride-drag="orbit"` (property `rideDrag`, option `drag`) takes the camera round the satellite as before. Seen from above, the model shrinks as the ride rises and hands over to the ordinary mark by 2,000 km; `ride-model-size="fixed"` (property `rideModelSize`, option `modelSize`) keeps one size at every height. `ride-up="north"` (property `rideUp`, option `up`) puts north at the top of the view above a satellite, so it is seen to go the way it really goes; a small compass on a ride shows north and the heading (`compass="off"` hides it), `rideTrack` and `chikyu-ride-track` give the heading, ground point and whether the Sun lights it, and the chosen orbit is amber in sunlight and blue in the Earth's shadow (`path-light="off"` for one colour). `ride-model-share`, `ride-model-seat` and `ride-zoom` frame and zoom the ridden satellite (properties `rideModelShare`, `rideModelSeat`, `rideZoom`). `face("ahead")` (behind, left, right, down, up; the keys W, S, A, D, F, R) turns a ride from the satellite or following it that way; the view above a satellite looks down on it and has no facings, so there `face()` returns `false` and the camera stays as it was. In every view the camera is never under the ground: it is held at least 1 km above it. It animates continuously, so it keeps to the
|
|
363
363
|
same budget: at most 30 frames a second (one a second for reduced motion), nothing drawn while paused, out of sight or hidden. [Ride along guide](docs/guides/ride-along.md), [docs/ride-along.md](docs/ride-along.md).
|
|
364
364
|
|
|
365
365
|
## Printable sheets
|
|
@@ -615,7 +615,7 @@ console.log(countryList().filter((country) => country.alpha2 === null).map((coun
|
|
|
615
615
|
|
|
616
616
|
## How to cite
|
|
617
617
|
|
|
618
|
-
> Morris, J. (2026). *Chikyu Earth* (version 0.
|
|
618
|
+
> Morris, J. (2026). *Chikyu Earth* (version 0.63.0) [Computer software]. https://github.com/johnmorrisdotca/chikyu-earth
|
|
619
619
|
|
|
620
620
|
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.
|
|
621
621
|
|
|
@@ -118,7 +118,7 @@ export type SpacePreset = "earth" | "moon" | "sun" | "inner" | "solar-system" |
|
|
|
118
118
|
export interface RideOptions {
|
|
119
119
|
view?: "from" | "follow" | "above";
|
|
120
120
|
look?: RideLook;
|
|
121
|
-
/** Face this way as the ride opens (`face`). */
|
|
121
|
+
/** Face this way as the ride opens (`face`). Left out of a ride above a satellite and of a body followed, which have no ways to face. */
|
|
122
122
|
face?: RideFace;
|
|
123
123
|
/** The radius of the ridden satellite's model as a share of the picture's height (0.02 to 1.2), for this ride: the element's `ride-model-share` when not given. Along the way it goes the default is 0.22, above the satellite 0.17 (its size at the lowest height). */
|
|
124
124
|
modelShare?: number;
|
|
@@ -677,6 +677,7 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
677
677
|
* Earth turns and slides beneath as it moves along its orbit (an ISS view goes round about every 90 minutes). A drag looks about from there (a drag right turns the camera to its left and a drag up tips it towards the bottom of its picture, so the ground follows the pointer), the shared controls' zoom narrows the view.
|
|
678
678
|
* A satellite is `{ group, index }` of a group set with `setSatellites`; it is placed exactly, one SGP4 call a frame, at any speed. Another call switches smoothly; `null` stops. The draw rate follows how
|
|
679
679
|
* fast the picture moves, never more than 30 a second (one a second for a reader who asked for reduced motion), and nothing is drawn out of sight.
|
|
680
|
+
* Whatever the view, facing, drag or glide, the camera is never under the ground: one that would be lower than 1 km above it is held there. A camera that looks at a satellite comes in towards it along its line of sight, so the satellite stays where it is in the picture; any other moves out along its line from the Earth's centre.
|
|
680
681
|
*
|
|
681
682
|
* @param target - A body name (`"Moon"`, `"Mars"`, ...) or a satellite `{ group, index }`, or `null` to stop.
|
|
682
683
|
* @param options - `view`, `look`, `distanceKm`, `smooth` (see `RideOptions`).
|
|
@@ -684,11 +685,11 @@ export declare class ChikyuSpace extends HTMLElement {
|
|
|
684
685
|
ride(target: RideTarget | null, options?: RideOptions): void;
|
|
685
686
|
/**
|
|
686
687
|
* Face one way while riding: `ahead` along the way it goes, `behind`, `left` or `right` (as seen facing ahead), `down` straight at the Earth, `up` straight away from it.
|
|
687
|
-
*
|
|
688
|
+
* The camera glides there in half a second (at once for a reader who asked for reduced motion) and keeps the zoom.
|
|
688
689
|
* The facing stays pressed until the view is turned or tipped. `chikyu-ride-face` is sent with `{ face }` (`null` when it is let go). Keys, while the element is focused: W ahead, S behind, A left, D right, R up, F down. The arrow keys stay with the view controls.
|
|
689
690
|
*
|
|
690
691
|
* @param face - The way to face.
|
|
691
|
-
* Following a body (a planet, the Moon) there is no way to face: it returns `false
|
|
692
|
+
* Following a body (a planet, the Moon) there is no way to face, and none in the view above a satellite (`view: "above"`, which looks down on it): it returns `false` and the camera stays as it was. Held keys do not repeat, and keys typed in a field or in editable text are left to it.
|
|
692
693
|
*
|
|
693
694
|
* @returns Whether the camera faces that way now (`true` too when it already did, and nothing moves).
|
|
694
695
|
*/
|
|
@@ -1766,6 +1766,7 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
1766
1766
|
* Earth turns and slides beneath as it moves along its orbit (an ISS view goes round about every 90 minutes). A drag looks about from there (a drag right turns the camera to its left and a drag up tips it towards the bottom of its picture, so the ground follows the pointer), the shared controls' zoom narrows the view.
|
|
1767
1767
|
* A satellite is `{ group, index }` of a group set with `setSatellites`; it is placed exactly, one SGP4 call a frame, at any speed. Another call switches smoothly; `null` stops. The draw rate follows how
|
|
1768
1768
|
* fast the picture moves, never more than 30 a second (one a second for a reader who asked for reduced motion), and nothing is drawn out of sight.
|
|
1769
|
+
* Whatever the view, facing, drag or glide, the camera is never under the ground: one that would be lower than 1 km above it is held there. A camera that looks at a satellite comes in towards it along its line of sight, so the satellite stays where it is in the picture; any other moves out along its line from the Earth's centre.
|
|
1769
1770
|
*
|
|
1770
1771
|
* @param target - A body name (`"Moon"`, `"Mars"`, ...) or a satellite `{ group, index }`, or `null` to stop.
|
|
1771
1772
|
* @param options - `view`, `look`, `distanceKm`, `smooth` (see `RideOptions`).
|
|
@@ -1795,8 +1796,8 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
1795
1796
|
const asked = options.view ?? "from";
|
|
1796
1797
|
// above a body is meant for a satellite: a body is followed
|
|
1797
1798
|
const view = typeof target === "string" && (target === "Earth" || asked === "above") ? "follow" : asked;
|
|
1798
|
-
// a body followed (a planet, the Moon, the Earth) is looked at from round it as the view turns
|
|
1799
|
-
const faceable = !(view === "follow" && typeof target === "string");
|
|
1799
|
+
// a body followed (a planet, the Moon, the Earth) is looked at from round it as the view turns, and the view above a satellite looks down on it: neither has ways to face
|
|
1800
|
+
const faceable = !(view === "follow" && typeof target === "string") && view !== "above";
|
|
1800
1801
|
const face = faceable && options.face && RIDE_FACES.includes(options.face) ? options.face : null;
|
|
1801
1802
|
model.ride = { target: typeof target === "string" ? target : { group: target.group, index: target.index }, view, look: face && view === "from" ? "horizon" : (options.look ?? "down"), face, distanceKm: Math.max(100, options.distanceKm ?? 3000), viewpoint: options.viewpoint === "inside" || options.viewpoint === "outside" ? options.viewpoint : this.rideViewpoint, outsideKm: readOutsideKm(options.outsideKm) ?? this.rideOutsideKm ?? OUTSIDE_KM, modelSize: options.modelSize === "fixed" || options.modelSize === "distance" ? options.modelSize : this.rideModelSize, drag: options.drag === "head" || options.drag === "orbit" ? options.drag : this.rideDrag, up: options.up === "north" || options.up === "travel" ? options.up : this.rideUp };
|
|
1802
1803
|
if (face) {
|
|
@@ -1822,11 +1823,11 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
1822
1823
|
}
|
|
1823
1824
|
/**
|
|
1824
1825
|
* Face one way while riding: `ahead` along the way it goes, `behind`, `left` or `right` (as seen facing ahead), `down` straight at the Earth, `up` straight away from it.
|
|
1825
|
-
*
|
|
1826
|
+
* The camera glides there in half a second (at once for a reader who asked for reduced motion) and keeps the zoom.
|
|
1826
1827
|
* The facing stays pressed until the view is turned or tipped. `chikyu-ride-face` is sent with `{ face }` (`null` when it is let go). Keys, while the element is focused: W ahead, S behind, A left, D right, R up, F down. The arrow keys stay with the view controls.
|
|
1827
1828
|
*
|
|
1828
1829
|
* @param face - The way to face.
|
|
1829
|
-
* Following a body (a planet, the Moon) there is no way to face: it returns `false
|
|
1830
|
+
* Following a body (a planet, the Moon) there is no way to face, and none in the view above a satellite (`view: "above"`, which looks down on it): it returns `false` and the camera stays as it was. Held keys do not repeat, and keys typed in a field or in editable text are left to it.
|
|
1830
1831
|
*
|
|
1831
1832
|
* @returns Whether the camera faces that way now (`true` too when it already did, and nothing moves).
|
|
1832
1833
|
*/
|
|
@@ -1835,8 +1836,8 @@ export class ChikyuSpace extends HTMLElement {
|
|
|
1835
1836
|
const ride = model.ride;
|
|
1836
1837
|
if (!ride || !RIDE_FACES.includes(face))
|
|
1837
1838
|
return false;
|
|
1838
|
-
// following a body there is no way to face: only from a body or a satellite, following a satellite
|
|
1839
|
-
if (ride.view === "follow" && typeof ride.target === "string")
|
|
1839
|
+
// following a body there is no way to face, nor above a satellite (the view looks down on it): only from a body or a satellite, or following a satellite
|
|
1840
|
+
if ((ride.view === "follow" && typeof ride.target === "string") || ride.view === "above")
|
|
1840
1841
|
return false;
|
|
1841
1842
|
// already facing that way: nothing to turn, and no glide started again
|
|
1842
1843
|
if (this.facing === face)
|
package/dist/space/scene.js
CHANGED
|
@@ -32,6 +32,8 @@ import { subsolarPoint, unitVector } from "../realistic/sun.js";
|
|
|
32
32
|
const MAX_MARKED = 80;
|
|
33
33
|
const RAD = Math.PI / 180;
|
|
34
34
|
const FOV = 35;
|
|
35
|
+
/** The nearest a camera comes to the Earth's centre, in Earth radii: 1 km above the ground. A ride (or a glide into or out of one) that would put the camera lower, or under the ground, puts it here instead (`clearGround`). */
|
|
36
|
+
const GROUND_CLEAR = 1 + 1 / 6371;
|
|
35
37
|
const newEase = () => ({ cur: Number.NaN, from: Number.NaN, to: Number.NaN, start: 0 });
|
|
36
38
|
/** Moves an ease towards `to`: at once when it is new or `ms` is 0 (reduced motion), else over `ms` milliseconds with a smooth step. True while it is still on its way. */
|
|
37
39
|
function stepEase(e, to, now, ms, fresh) {
|
|
@@ -163,6 +165,32 @@ const unit = (v) => {
|
|
|
163
165
|
const l = Math.hypot(v[0], v[1], v[2]) || 1;
|
|
164
166
|
return [v[0] / l, v[1] / l, v[2] / l];
|
|
165
167
|
};
|
|
168
|
+
/**
|
|
169
|
+
* Keep a camera at least `GROUND_CLEAR` from the Earth's centre. One looking at a point above the ground (`at`) is brought towards it along its line of sight, to where that line comes out of the ground, so the point stays where it is in the
|
|
170
|
+
* picture; any other is moved out along its line from the centre. Changes `camera` in place, and brings the near plane in to half its height when it moves it.
|
|
171
|
+
*/
|
|
172
|
+
function clearGround(camera, at) {
|
|
173
|
+
const p = camera.position;
|
|
174
|
+
const from = p.length();
|
|
175
|
+
if (from >= GROUND_CLEAR)
|
|
176
|
+
return;
|
|
177
|
+
const atFrom = at ? Math.hypot(at[0], at[1], at[2]) : 0;
|
|
178
|
+
if (at && atFrom > GROUND_CLEAR) {
|
|
179
|
+
// the first point from `at` towards the camera where the line is GROUND_CLEAR from the centre
|
|
180
|
+
const d = [p.x - at[0], p.y - at[1], p.z - at[2]];
|
|
181
|
+
const a = d[0] * d[0] + d[1] * d[1] + d[2] * d[2];
|
|
182
|
+
const b = 2 * (at[0] * d[0] + at[1] * d[1] + at[2] * d[2]);
|
|
183
|
+
const c = atFrom * atFrom - GROUND_CLEAR * GROUND_CLEAR;
|
|
184
|
+
const t = (-b - Math.sqrt(Math.max(0, b * b - 4 * a * c))) / (2 * a);
|
|
185
|
+
p.set(at[0] + d[0] * t, at[1] + d[1] * t, at[2] + d[2] * t);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
if (from < 1e-9)
|
|
189
|
+
p.set(0, 0, 1);
|
|
190
|
+
p.multiplyScalar(GROUND_CLEAR / p.length());
|
|
191
|
+
}
|
|
192
|
+
camera.near = Math.min(camera.near, (GROUND_CLEAR - 1) * 0.5);
|
|
193
|
+
}
|
|
166
194
|
/** A square facing +z, 2 x 2, with uvs 0 to 1. */
|
|
167
195
|
function quad(three) {
|
|
168
196
|
const g = new three.BufferGeometry();
|
|
@@ -710,11 +738,17 @@ export function createSpaceItem(model, deps) {
|
|
|
710
738
|
// north up (the view above a satellite only): the picture is turned so north is at the top, less near a pole; a drag turns it from there
|
|
711
739
|
const north = ride.view === "above" && ride.up === "north" ? northUpYaw(followed.place, followed.velocity) : null;
|
|
712
740
|
const up = aboveAxes(followed.place, followed.velocity, base.yaw + (north ? north.yaw * north.weight : 0) + model.view.yaw * RAD, base.tilt + Math.max(-80, Math.min(80, model.view.tilt)) * RAD);
|
|
741
|
+
// a facing along the ground (ahead, behind, left, right) looks along the top `aboveAxes` gives, so that top would be the line of sight itself and the camera's turn would come from rounding, a different one each draw:
|
|
742
|
+
// the top of the picture is the sky there (straight away from the Earth, square to the line of sight)
|
|
743
|
+
const sky = unit(followed.place);
|
|
744
|
+
const skyward = sky[0] * up.offset[0] + sky[1] * up.offset[1] + sky[2] * up.offset[2];
|
|
745
|
+
const top = Math.abs(Math.sin(base.tilt)) > 0.5 ? unit([sky[0] - skyward * up.offset[0], sky[1] - skyward * up.offset[1], sky[2] - skyward * up.offset[2]]) : up.up;
|
|
713
746
|
target.set(focusPos[0], focusPos[1], focusPos[2]);
|
|
714
747
|
camera.position.set(target.x + up.offset[0] * distance, target.y + up.offset[1] * distance, target.z + up.offset[2] * distance);
|
|
715
|
-
camera.up.set(up.up[0], up.up[1], up.up[2]);
|
|
716
|
-
camera.lookAt(target);
|
|
717
748
|
camera.near = Math.max(1e-4, distance * 0.02);
|
|
749
|
+
clearGround(camera, focusPos);
|
|
750
|
+
camera.up.set(top[0], top[1], top[2]);
|
|
751
|
+
camera.lookAt(target);
|
|
718
752
|
camera.far = Math.max(2000, distance * 4 + (mode === "true" ? 40 * 23_481 : 400));
|
|
719
753
|
}
|
|
720
754
|
else {
|
|
@@ -724,9 +758,10 @@ export function createSpaceItem(model, deps) {
|
|
|
724
758
|
target.set(focusPos[0], focusPos[1], focusPos[2]);
|
|
725
759
|
camera.position.set(target.x + aim[0] * distance, target.y + aim[1] * distance, target.z + aim[2] * distance);
|
|
726
760
|
camera.up.set(0, 1, 0);
|
|
727
|
-
camera.lookAt(target);
|
|
728
761
|
// within about 130 km of the ground (a fly-to's descent) the near plane comes in to half the height, or it would cut the ground away
|
|
729
762
|
camera.near = Math.min(Math.max(0.0005, distance * 0.02 - focusRadius * 0.5, focusRadius * 0.01), Math.max(1e-6, (distance - focusRadius) * 0.5));
|
|
763
|
+
clearGround(camera, focusPos);
|
|
764
|
+
camera.lookAt(target);
|
|
730
765
|
camera.far = Math.max(2000, distance * 4 + (mode === "true" ? 40 * 23_481 : 400));
|
|
731
766
|
}
|
|
732
767
|
if (ride && (ride.view === "follow" || ride.view === "above") && typeof ride.target !== "string") {
|
|
@@ -753,6 +788,8 @@ export function createSpaceItem(model, deps) {
|
|
|
753
788
|
if (k >= 1)
|
|
754
789
|
model.transition = null;
|
|
755
790
|
}
|
|
791
|
+
// never under the ground: a ride from a satellite that has come down, or a glide whose straight line runs through the Earth, is held 1 km above it, on its line from the centre
|
|
792
|
+
clearGround(camera, null);
|
|
756
793
|
camera.fov = fovNow;
|
|
757
794
|
camera.aspect = size.width / Math.max(1, size.height);
|
|
758
795
|
// the ground the picture spans straight below a ridden satellite, in kilometres: the height above the ground over the vertical field of view (flat-ground, to compare with a tile level's size)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/chikyu-earth",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.63.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",
|