@johnmorrisdotca/wakusei-planets 0.45.1 → 0.47.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 +12 -0
- package/NOTICE.md +12 -0
- package/README.md +4 -3
- package/dist/scene/body.d.ts +1 -1
- package/dist/scene/textures.d.ts +2 -2
- package/dist/space/element.d.ts +7 -0
- package/dist/space/element.js +12 -0
- package/dist/surface/detail.d.ts +186 -0
- package/dist/surface/detail.js +316 -0
- package/dist/surface/element.d.ts +103 -0
- package/dist/surface/element.js +685 -0
- package/dist/surface/glsl.d.ts +26 -0
- package/dist/surface/glsl.js +457 -0
- package/dist/surface/height.d.ts +257 -0
- package/dist/surface/height.js +232 -0
- package/dist/surface/index.d.ts +10 -0
- package/dist/surface/index.js +10 -0
- package/dist/surface/land.d.ts +111 -0
- package/dist/surface/land.js +261 -0
- package/dist/surface/load.d.ts +133 -0
- package/dist/surface/load.js +183 -0
- package/dist/surface/objects-apollo-17.d.ts +4 -0
- package/dist/surface/objects-apollo-17.js +19 -0
- package/dist/surface/objects.d.ts +127 -0
- package/dist/surface/objects.js +179 -0
- package/dist/surface/rocks.d.ts +45 -0
- package/dist/surface/rocks.js +166 -0
- package/dist/surface/scene.d.ts +72 -0
- package/dist/surface/scene.js +488 -0
- package/dist/surface/shapes.d.ts +62 -0
- package/dist/surface/shapes.js +247 -0
- package/dist/surface/site.d.ts +58 -0
- package/dist/surface/site.js +38 -0
- package/dist/surface/sky.d.ts +81 -0
- package/dist/surface/sky.js +60 -0
- package/dist/surface/view.d.ts +129 -0
- package/dist/surface/view.js +139 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +23 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.47.0] - 2026-11-13
|
|
6
|
+
|
|
7
|
+
- **Things at the Apollo 17 site, at their published places** (MODULES-1308). The descent stage of the lunar module, the flag, the ALSEP central station, the surface electrical properties transmitter and the rover stand at the coordinates of Haase et al. (2019, doi 10.1029/2018EA000408; two small files read by byte range from the PDS archive of its map, NOTICE.md), drawn by this package as plain shapes with flat colours (an octagonal gold body on four splayed legs with braces, pads and the ladder; a frame on four wheels with fenders, seats, console, dish and camera masts) and cast shadows, and the rover's nine traverses as a faint pair of tracks along the published line. Each has a small pressable button (`choose(id)`, `objects`, the `wakusei-surface-object` event, `objects="off"`) that goes to it and says it was placed by this package; the rover's place is the end of its last traverse line and its heading a reading of it, both labelled ours. The made craters and rocks keep away from them.
|
|
8
|
+
- **Half size while the view moves, and a walking stick for touch** (MODULES-1324). A machine that takes over 24 ms for a draw while the view moves draws the ground at half width and height into a smaller target stretched to the canvas, back at full size one draw after it stops (`scale`, `stats.scale`, `stats.scaled`). On a touch screen one finger looks, two pinch to zoom and an on-screen stick (`stick`) walks.
|
|
9
|
+
|
|
10
|
+
## [0.46.0] - 2026-11-13
|
|
11
|
+
|
|
12
|
+
- **Standing on the Moon** (MODULES-1308). `<wakusei-surface>` (`@johnmorrisdotca/wakusei-planets/surface/element`) puts the viewer on the Moon at the Apollo 17 landing site, Taurus-Littrow: the ground is drawn from the measured 5 m LROC/LOLA height model (public domain, credited in NOTICE.md) with the Sun and the Earth where they really are at the moment shown (`moonSky`), hard shadows (the measured ground's baked into horizon maps, only the made detail marched, in three `quality` tiers with `auto` stepping down on a slow card), a ground picture from the LROC mosaic with its shading divided out, and made detail marked as made (craters from half a metre by the lunar size-frequency law, mostly old and soft; rounded, part-buried rocks lit like the ground). One draw when something changes, nothing at rest; drag to look, W A S D to walk at 1.4 m/s over the ground, zoom is the field of view. The first view is 4.2 MB (12.9 MB for the whole site), fetched in rings: the coarse level whole, the middle of the finest, nearest first after that; tiles and horizon maps are lossless WebP. The tiles are made by `scripts/make-moon-terrain.py` (`pnpm terrain:fetch` downloads the three NASA files, SHA-256 checked, then `pnpm terrain`) and the Pages build makes and serves them beside the body tiles (cached on the script; nothing is downloaded when the cache hits), in no package. Pure parts (`moonSky`, the camera, the tile decoding and filling, the made craters and rocks, `loadPlan`) are exported from `/surface`.
|
|
13
|
+
- **Coming down from orbit** (MODULES-1308). `import "@johnmorrisdotca/wakusei-planets/surface/land"` adds `land(site)`, `leave()`, `landed` and `standing` to `<wakusei-space>`: the camera goes to the Moon, turns over the site and comes in while the ground loads, and the standing view fades in (`wakusei-landing`, `wakusei-landed`, `wakusei-left`). The page has one renderer, so the ground is fetched on standby while the camera comes in, the orbit view goes to black as the standing view takes the renderer and the ground fades up; `leave()` gives it back through the new `resume()` on `<wakusei-space>`. The ground shows the orbit view's own moment (`time: "landing"` for the landing's). The Moon page of the demo uses it.
|
|
14
|
+
- **Guides** `docs/guides/surface.md` and its Japanese twin.
|
|
15
|
+
- **A travel test names where the move is recorded** (MODULES-1321, test only): `e2e/space-travel.demo.ts` asks for the move where the page records it.
|
|
16
|
+
|
|
5
17
|
## [0.45.1] - 2026-11-13
|
|
6
18
|
|
|
7
19
|
- **Browser tests that pass on a busy machine** (test only). A sweep of the e2e specs for the races TEST-RULES lists: the draw count is taken in the same call as the change (`callCounted`, `setCounted`, `clickCounted`) in place of a read in one call and the change in the next; settles are the draws holding still with no picture pending (`quiet`, `quietElement`) in place of fixed sleeps; the soak warm-up goes to every body and step; the picker group buttons are the picker's own, not `.first()`; the body page's shaded looks are pinned to a date. `CPU_THROTTLE=4` (e2e/load.ts) runs any spec that imports it at a quarter of the speed.
|
package/NOTICE.md
CHANGED
|
@@ -261,6 +261,18 @@ The rows of `/moon-catalogue` (`src/data/moon-catalogue.ts`, made by `scripts/ma
|
|
|
261
261
|
- **Groups** are this package's own sorting of the mean orbits by a stated rule (the guide "Every known moon"); the group names are the usual ones, each named after its largest member.
|
|
262
262
|
- **Japanese names** are given only for the 29 moons the package draws in full, whose katakana was checked; the other moons keep their English names and designations.
|
|
263
263
|
|
|
264
|
+
## The Moon's ground (standing on the Moon)
|
|
265
|
+
|
|
266
|
+
The height tiles of `<wakusei-surface>` (`scripts/make-moon-terrain.py`; they are made by the Pages workflow and are in no package and no repository), read on 2026-11-13. Only files from the NASA Planetary Data System archive are used, from the hosts `pds.lroc.im-ldi.com` (the LROC data node) and `pds-geosciences.wustl.edu` (the Geosciences node); the originals are kept outside the checkout.
|
|
267
|
+
|
|
268
|
+
- **Heights near the Apollo 17 landing site**: `NAC_DTM_APOLLO17.TIF`, the Lunar Reconnaissance Orbiter Camera (LROC) narrow angle camera height model of Taurus-Littrow, 5 m a pixel (https://pds.lroc.im-ldi.com/data/LRO-L-LROC-5-RDR-V1.0/LROLRC_2001/DATA/SDP/NAC_DTM/APOLLO17/NAC_DTM_APOLLO17.TIF, 463,397,471 bytes, data set `LRO-L-LROC-5-RDR-V1.0`, product version 1.9), made by Arizona State University with the methods of Henriksen et al. (2017), "Extracting accurate and precise topography from LROC narrow angle camera stereo observations", Icarus 283, 122-137 (https://doi.org/10.1016/j.icarus.2016.05.012): registered to the laser altimeter's profiles, so absolute accuracy follows the altimeter's (about 1 m in height and 10 m in place) and relative precision is better than the 5 m pixel.
|
|
269
|
+
- **The ground picture**: the browse picture of `NAC_ROI_APOLLO17LOC_E205N0306_5M`, the Apollo 17 low-Sun controlled narrow angle camera mosaic, 5 m a pixel (https://pds.lroc.im-ldi.com/data/LRO-L-LROC-5-RDR-V1.0/LROLRC_2001/EXTRAS/BROWSE/NAC_ROI/APOLLO17LOC/NAC_ROI_APOLLO17LOC_E205N0306_5M.TIF, 108,949,491 bytes). The build fits the Sun the mosaic was lit by to the heights, divides that shading out and keeps the ground's own light and dark (the fit for Apollo 17: azimuth 264 degrees, elevation 7 degrees, correlation 0.76).
|
|
270
|
+
- **Heights beyond the model**: the Lunar Orbiter Laser Altimeter (LOLA) global height map at 64 pixels a degree (`ldem_64.img`, data set `LRO-L-LOLA-4-GDR-V1.0`, https://pds-geosciences.wustl.edu/lro/lro-l-lola-3-rdr-v1/lrolol_1xxx/data/lola_gdr/cylindrical/img/ldem_64.img, 23,040 x 11,520 samples of 16 bits, height = 0.5 m x value above a sphere of radius 1,737.4 km), of which only the window round the site is read, by HTTP byte ranges (about 25 MB of a 531 MB file).
|
|
271
|
+
- **Terms**: the PDS Geosciences Node's FAQ (https://pds-geosciences.wustl.edu/faq.html, read 2026-11-13): "Data sets archived in the PDS are in the public domain." The LROC terms of use (https://lroc.im-ldi.com/about/terms, read 2026-11-13) say the products of the LROC data node and the PDS archive are in the public domain, that images elsewhere on the LROC website (featured images and curated products) are copyrighted and are not used here, and ask for the credit "NASA/GSFC/Arizona State University". The credit lines the page shows are that, and "LOLA Team (NASA/GSFC)", with the Planetary Data System as the publisher of the data sets (the PDS asks that a data set be cited like published research; its DOI is in the PDS DOI portal).
|
|
272
|
+
- **Things at the Apollo 17 site** (`src/surface/objects-apollo-17.ts`, made by `scripts/make-apollo17-objects.py`, read on 2026-11-13): the positions of the lunar module's descent stage, the flag, the ALSEP central station and the surface electrical properties transmitter, and the rover's nine traverses, from the map of Haase, Wählisch, Gläser, Oberst and Robinson, "Coordinates and Maps of the Apollo 17 Landing Site", Earth and Space Science 6 (2019), https://doi.org/10.1029/2018EA000408, as archived by the PDS Cartography and Imaging Sciences Node and published by USGS Astrogeology (https://astrogeology.usgs.gov/search/map/moon_apollo_17_lroc_nac_landing_site_orthomosaic_50cm, whose use constraint reads "Please cite authors"). Two files are read out of its 1.7 GB zip by HTTP byte ranges (about 94 KB fetched; the zip is never downloaded): `APOLLO17_CONTROLPOINTS_2018.TAB` (body-fixed X, Y, Z in metres, the published positions) and `APOLLO17_TRAVERSE_2018.SHP` (the traverses, Transverse Mercator on a sphere of 1,737.4 km, central meridian 30.7 degrees). They are coordinates, which are facts; no picture, text or map of the paper is used. The rover's place and heading are this package's reading of the end of the last traverse line: the paper's own table of the rover's parking place was not available to this build (the publisher's page refused programs), so the rover's place is not that published position and the page says so. The shapes of all five things are plain drawings made here (boxes, cylinders and struts, from sizes of about 3.2 m for the descent stage's deck, 4.7 m from its middle to a footpad, and 3.1 m by 2.3 m for the rover); no flag, name or mark is drawn. uchusen-rockets has a lunar module (its descent and ascent stages, plain shapes) that this package does not use; no lunar rover model was found in it.
|
|
273
|
+
- **Left out**: the merged LOLA and Kaguya (SELENE) height grid. The JAXA part's terms could not be found, and an MIT-licensed package can pass on only what it knows to be free to pass on.
|
|
274
|
+
- **Made, not measured**: everything below the 5 m grid (small craters from 0.5 to 20 m, the roughness of the dust, rocks of 0.1 to 1.5 m) is made by this package from a seeded random grid, by the lunar size-frequency law, and is not a picture or a measurement of any place. The picture says so under the ground.
|
|
275
|
+
|
|
264
276
|
## Interior cutaway
|
|
265
277
|
|
|
266
278
|
The cutaway's figures were read on 2026-11-13. NASA content is not subject to copyright in the United States. Nothing was copied from the pages; the numbers and the materials they name are the pages' facts, and a figure the page gives as "about" stays marked about.
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Wakusei Planets runs in the browser of a phone, a tablet or a computer: nothing
|
|
|
19
19
|
|
|
20
20
|
<p align="center"><img alt="The demo on a desk: Saturn in the painted look, turning in the big view, with the page's links to the portrait builder, the colouring sheets, the space view, the star page and the size line-up above it, and the choice of body and its moons below" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/main/docs/images/home-desk.webp" width="620"> <img alt="The same page on a phone: the same links in rows, and Saturn in the painted look below them" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/main/docs/images/home-phone.webp" width="200"></p>
|
|
21
21
|
|
|
22
|
-
<p align="center"><img alt="Every body at one scale, the Earth among them: each small body has a magnified picture joined by a line, and the Sun shows only its edge" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.
|
|
22
|
+
<p align="center"><img alt="Every body at one scale, the Earth among them: each small body has a magnified picture joined by a line, and the Sun shows only its edge" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.47.0/docs/images/lineup-desk.png" width="640"></p>
|
|
23
23
|
|
|
24
24
|
## Who it is for
|
|
25
25
|
|
|
@@ -388,7 +388,7 @@ The tiles of every body share one 48 MB budget, six loads at a time for a source
|
|
|
388
388
|
|
|
389
389
|
## The portrait builder
|
|
390
390
|
|
|
391
|
-
<p align="center"><img alt="The Sun and the planets in an arc, painted, with their names, in the portrait builder" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.
|
|
391
|
+
<p align="center"><img alt="The Sun and the planets in an arc, painted, with their names, in the portrait builder" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.47.0/docs/images/portrait-family.png" width="640"></p>
|
|
392
392
|
|
|
393
393
|
[The portrait builder](https://johnmorrisdotca.github.io/wakusei-planets/portrait.html) puts any bodies in one picture: drag them, size them, turn them, order them front to back, arrange them in a row, an arc, a grid or at true orbit distance (true or readable sizes, a planet's moons round it in orbit order), light them from one direction, and take the code, a PNG or an SVG. The scene is kept in the address, and every body is drawn in one WebGL scene, so the page holds one WebGL context. [The portrait builder](docs/guides/portrait-builder.md) is its guide.
|
|
394
394
|
|
|
@@ -483,6 +483,7 @@ Each guide has a Japanese twin in [docs/guides/ja](docs/guides/ja/getting-starte
|
|
|
483
483
|
| [Close zoom and map tiles](docs/guides/close-zoom.md) | How far each body zooms and why, the finer map tiles for a close zoom (made from public-domain maps, served beside the demo, never in the package), the generic detail, what it costs |
|
|
484
484
|
| [Outside data, the data door](docs/guides/data-door.md) | Hand the package your own maps of a body or small bodies with their licence and credit, switch them off, and show whose data is on the screen |
|
|
485
485
|
| [Riding along](docs/guides/ride-along.md) | The camera on a moon, a planet or any moving point, looking at what it goes round |
|
|
486
|
+
| [Standing on the Moon](docs/guides/surface.md) | A person at the Apollo 17 landing site: the measured ground, the Sun and the Earth where they are, hard shadows, and detail that is made and says so |
|
|
486
487
|
| [Accuracy](docs/guides/accuracy.md) | How far each body is from JPL Horizons |
|
|
487
488
|
| [In your own three.js scene](docs/guides/in-your-own-scene.md) | `painter.make` |
|
|
488
489
|
| [Time](docs/guides/time.md) | Julian dates, calendars, time scales, sidereal time, Mars time |
|
|
@@ -534,7 +535,7 @@ BODIES.pluto.kind; // "dwarf-planet"
|
|
|
534
535
|
|
|
535
536
|
If this package helps a paper, a talk or a class, please cite it as software. GitHub's "Cite this repository" button reads [CITATION.cff](CITATION.cff) and gives BibTeX and APA; in plain text:
|
|
536
537
|
|
|
537
|
-
> Morris, J. (2026). *Wakusei Planets* (version 0.
|
|
538
|
+
> Morris, J. (2026). *Wakusei Planets* (version 0.47.0) [Computer software]. https://github.com/johnmorrisdotca/wakusei-planets
|
|
538
539
|
|
|
539
540
|
Cite the version you used (`npm ls @johnmorrisdotca/wakusei-planets`), and cite the sources of the numbers you use as well: [NOTICE.md](NOTICE.md) names each one, with the paper or the page it was read from (the IAU working group's report for sizes and poles, VSOP87B, ELP2000-82B, L1.2 and TASS1.7 for positions, and NASA's JPL Horizons for the fits and the spacecraft).
|
|
540
541
|
|
package/dist/scene/body.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { TileLevel } from "./tiles.ts";
|
|
|
10
10
|
import { type NameLabelOptions } from "./name-label.ts";
|
|
11
11
|
export { fallbackLook } from "./fallback.ts";
|
|
12
12
|
/** The parts of three.js the bodies use: a page may hand over a module with only these (see `setThreeLoader`). `CanvasTexture`, `SRGBColorSpace` and `NormalBlending` are needed only for a name written on a body (`body-label`). */
|
|
13
|
-
export type ThreeParts = Pick<typeof THREE, "AdditiveBlending" | "BufferAttribute" | "BufferGeometry" | "ClampToEdgeWrapping" | "DataTexture" | "DoubleSide" | "Group" | "Line" | "LineBasicMaterial" | "LineSegments" | "LinearFilter" | "Mesh" | "NoColorSpace" | "OrthographicCamera" | "PlaneGeometry" | "RepeatWrapping" | "RGBAFormat" | "RingGeometry" | "Scene" | "ShaderMaterial" | "SphereGeometry" | "TextureLoader" | "Vector2" | "Vector3" | "WebGLRenderer"> & Partial<Pick<typeof THREE, "CanvasTexture" | "SRGBColorSpace" | "NormalBlending">>;
|
|
13
|
+
export type ThreeParts = Pick<typeof THREE, "AdditiveBlending" | "BufferAttribute" | "BufferGeometry" | "ClampToEdgeWrapping" | "DataTexture" | "DoubleSide" | "Group" | "Line" | "LineBasicMaterial" | "LineSegments" | "LinearFilter" | "Mesh" | "NoColorSpace" | "OrthographicCamera" | "PlaneGeometry" | "RepeatWrapping" | "RGBAFormat" | "RingGeometry" | "Scene" | "ShaderMaterial" | "SphereGeometry" | "TextureLoader" | "Vector2" | "Vector3" | "WebGLRenderer"> & Partial<Pick<typeof THREE, "CanvasTexture" | "SRGBColorSpace" | "NormalBlending" | "WebGLRenderTarget">>;
|
|
14
14
|
/** One moon in a system view: its place in planet radii (viewer's frame) and the points of its orbit, if they changed. */
|
|
15
15
|
export interface MoonDraw {
|
|
16
16
|
id: BodyId;
|
package/dist/scene/textures.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { type BodyMapSource } from "../door/map.ts";
|
|
|
11
11
|
* console.log(TEXTURE_BASE);
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
|
-
export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.
|
|
14
|
+
export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.47.0/dist/textures/";
|
|
15
15
|
/**
|
|
16
16
|
* Where the sharpest surface pictures are: the files of this exact version in the repository, on jsDelivr's GitHub address. The npm package holds only the two smaller widths, so a page that
|
|
17
17
|
* never zooms in never fetches them. Set `texture-far-base` on an element to serve them yourself.
|
|
@@ -23,7 +23,7 @@ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdot
|
|
|
23
23
|
* console.log(TEXTURE_FAR_BASE);
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.
|
|
26
|
+
export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.47.0/textures/";
|
|
27
27
|
/**
|
|
28
28
|
* Where the finer map tiles are by default: the demo site's `tiles/` folder (GitHub Pages sends `access-control-allow-origin: *`). The tiles are made by `scripts/make-body-tiles.py` and are in no package and no repository:
|
|
29
29
|
* a page that serves its own gives the folder in the `tiles` attribute, and `tiles="off"` turns them off. A page that sets `texture-base` (it serves its own pictures) has none unless it says where they are.
|
package/dist/space/element.d.ts
CHANGED
|
@@ -366,6 +366,13 @@ export declare class WakuseiSpace extends HTMLElement {
|
|
|
366
366
|
set farOpacity(value: number);
|
|
367
367
|
/** The body under the pointer, a finger or the keyboard's focus now, or null: its system's names are drawn at full strength. */
|
|
368
368
|
get hovered(): BodyId | null;
|
|
369
|
+
/**
|
|
370
|
+
* Take the renderer back and draw: the page has one renderer and one view has it at a time, so after another view (the standing view that `land` of `/surface/land` puts over this one) has had it, this view is blank
|
|
371
|
+
* until it is given back. Resolves true when this view is live again.
|
|
372
|
+
*
|
|
373
|
+
* @returns Whether the view is live.
|
|
374
|
+
*/
|
|
375
|
+
resume(): Promise<boolean>;
|
|
369
376
|
/**
|
|
370
377
|
* Where each body is for the picture at the last draw: in view or not, and for one out of view the edge of the picture it lies beyond, the point on that edge, the way to it, and whether it is behind the camera. It
|
|
371
378
|
* covers the Sun, the planets, the dwarf planets and the minor bodies, the moons of the body looked at and any other moon drawn; not the body the camera rides on. `wakusei-sight` fires with the same list whenever a
|
package/dist/space/element.js
CHANGED
|
@@ -1006,6 +1006,18 @@ export class WakuseiSpace extends HTMLElement {
|
|
|
1006
1006
|
get hovered() {
|
|
1007
1007
|
return this.#hovered;
|
|
1008
1008
|
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Take the renderer back and draw: the page has one renderer and one view has it at a time, so after another view (the standing view that `land` of `/surface/land` puts over this one) has had it, this view is blank
|
|
1011
|
+
* until it is given back. Resolves true when this view is live again.
|
|
1012
|
+
*
|
|
1013
|
+
* @returns Whether the view is live.
|
|
1014
|
+
*/
|
|
1015
|
+
async resume() {
|
|
1016
|
+
const live = (await this.#view?.focus()) ?? false;
|
|
1017
|
+
if (live)
|
|
1018
|
+
this.#gate?.request();
|
|
1019
|
+
return live;
|
|
1020
|
+
}
|
|
1009
1021
|
/**
|
|
1010
1022
|
* Where each body is for the picture at the last draw: in view or not, and for one out of view the edge of the picture it lies beyond, the point on that edge, the way to it, and whether it is behind the camera. It
|
|
1011
1023
|
* covers the Sun, the planets, the dwarf planets and the minor bodies, the moons of the body looked at and any other moon drawn; not the body the camera rides on. `wakusei-sight` fires with the same list whenever a
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { type SiteObject } from "./objects.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Say which objects the made craters and rocks keep away from (the ones `objectsOf` gives for the site), or none. The shader holds the same list.
|
|
4
|
+
*
|
|
5
|
+
* @param objects - The objects.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { madeGround, objectsOf, setKeepOut } from "@johnmorrisdotca/wakusei-planets/surface";
|
|
10
|
+
*
|
|
11
|
+
* const [lander] = objectsOf("apollo-17");
|
|
12
|
+
* setKeepOut(objectsOf("apollo-17"));
|
|
13
|
+
* console.log(madeGround(lander!.east, lander!.north, 0.35).h);
|
|
14
|
+
* setKeepOut([]);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function setKeepOut(objects: readonly SiteObject[]): void;
|
|
18
|
+
/** The smallest crater's nominal diameter in metres: each octave doubles it, up to `OCTAVES` octaves (0.5, 1, 2, 4, 8, 16). A crater in an octave is between 1 and 2 times its nominal diameter. */
|
|
19
|
+
export declare const D0 = 0.5;
|
|
20
|
+
export declare const OCTAVES = 6;
|
|
21
|
+
/** A cell is this many nominal diameters across, with at most one crater in it. */
|
|
22
|
+
export declare const CELL = 3;
|
|
23
|
+
/** The share of a cell, from its edge, within which the craters of the cell over the edge are looked for. */
|
|
24
|
+
export declare const NEAR_EDGE = 0.2;
|
|
25
|
+
/** The PCG hash of two 32 bit integers, as the shader does it. */
|
|
26
|
+
export declare function pcg2d(x: number, y: number): [number, number];
|
|
27
|
+
/** A hash cut to a number from 0 up to but not including 1, exact in 24 bits. */
|
|
28
|
+
export declare const unit24: (h: number) => number;
|
|
29
|
+
/**
|
|
30
|
+
* One crater: where its middle is (metres in the site's plane), its radius, how deep and how high its rim, how wide its rim, and how old (0 fresh, 1 worn flat).
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* import { craterProfile, type Crater } from "@johnmorrisdotca/wakusei-planets/surface";
|
|
35
|
+
*
|
|
36
|
+
* const crater: Crater = { x: 0, y: 0, radius: 4, depth: 0.8, rim: 0.2, rimWidth: 0.3, age: 0.2 };
|
|
37
|
+
* console.log(`${craterProfile(crater, 0, 0).h.toFixed(2)} m at the middle`);
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export interface Crater {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
radius: number;
|
|
44
|
+
depth: number;
|
|
45
|
+
rim: number;
|
|
46
|
+
rimWidth: number;
|
|
47
|
+
age: number;
|
|
48
|
+
}
|
|
49
|
+
/** The share of cells that hold a crater in an octave: many small, few large. */
|
|
50
|
+
export declare const occupancy: (octave: number) => number;
|
|
51
|
+
/**
|
|
52
|
+
* The crater in a cell of an octave, or `undefined` for an empty cell.
|
|
53
|
+
*
|
|
54
|
+
* @param cx - The cell's column.
|
|
55
|
+
* @param cy - The cell's row.
|
|
56
|
+
* @param octave - 0 for the smallest (0.5 m) up.
|
|
57
|
+
* @returns The crater, or `undefined` when the cell holds none (most cells do not: see `occupancy`).
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* import { craterIn } from "@johnmorrisdotca/wakusei-planets/surface";
|
|
62
|
+
*
|
|
63
|
+
* console.log(craterIn(4, -2, 3)?.radius.toFixed(2), craterIn(0, 0, 3));
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export declare function craterIn(cx: number, cy: number, octave: number): Crater | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* A crater's height at a point: the bowl, the soft rim. Also the slope along x and y.
|
|
69
|
+
*
|
|
70
|
+
* @param c - The crater.
|
|
71
|
+
* @param px - Metres east of the site.
|
|
72
|
+
* @param py - Metres north of the site.
|
|
73
|
+
* @returns The height in metres (negative in the bowl, positive on the rim) and the slope along east (`gx`) and north (`gy`).
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* import { craterProfile, type Crater } from "@johnmorrisdotca/wakusei-planets/surface";
|
|
78
|
+
*
|
|
79
|
+
* const crater: Crater = { x: 0, y: 0, radius: 4, depth: 0.8, rim: 0.2, rimWidth: 0.3, age: 0.2 };
|
|
80
|
+
* console.log(craterProfile(crater, 0, 0).h.toFixed(2), craterProfile(crater, 4, 0).h.toFixed(2));
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare function craterProfile(c: Crater, px: number, py: number): {
|
|
84
|
+
h: number;
|
|
85
|
+
gx: number;
|
|
86
|
+
gy: number;
|
|
87
|
+
};
|
|
88
|
+
/** How far a crater's reach goes in multiples of its radius, beyond which the apron is too faint to count. */
|
|
89
|
+
export declare const REACH = 4;
|
|
90
|
+
/**
|
|
91
|
+
* The made ground's height at a point, and its slope, from every crater of every octave not smaller than `fromDiameter` (a crater is faded in over a factor of two above it, so none
|
|
92
|
+
* pops). The cell the point is in is looked at in each octave, and a neighbouring cell when the point is within a fifth of the edge between them: a crater is kept to the middle of its cell, so its rim and the strong part of its apron reach no further.
|
|
93
|
+
*
|
|
94
|
+
* @param x - Metres east of the site.
|
|
95
|
+
* @param y - Metres north of the site.
|
|
96
|
+
* @param fromDiameter - The smallest nominal diameter to count, in metres: a distance's worth of pixels (craters smaller than a few pixels only shimmer).
|
|
97
|
+
* @returns The height in metres and the slope along east and north.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* import { madeGround } from "@johnmorrisdotca/wakusei-planets/surface";
|
|
102
|
+
*
|
|
103
|
+
* console.log(madeGround(12.5, -8, 0.5).h.toFixed(2));
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export declare function madeGround(x: number, y: number, fromDiameter: number): {
|
|
107
|
+
h: number;
|
|
108
|
+
gx: number;
|
|
109
|
+
gy: number;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* One rock: where it lies, how big (its longest side in metres), which of the three shapes, how it is turned, how bright it is, and how flat.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* import { rocksAround, type Rock } from "@johnmorrisdotca/wakusei-planets/surface";
|
|
117
|
+
*
|
|
118
|
+
* const rock: Rock | undefined = rocksAround(0, 0, 20, 0.0024)[0];
|
|
119
|
+
* console.log(rock?.size.toFixed(2), rock?.shape);
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
export interface Rock {
|
|
123
|
+
x: number;
|
|
124
|
+
y: number;
|
|
125
|
+
size: number;
|
|
126
|
+
shape: number;
|
|
127
|
+
turn: number;
|
|
128
|
+
tone: number;
|
|
129
|
+
flat: number;
|
|
130
|
+
}
|
|
131
|
+
/** The rocks of a class are `ROCK_MIN * 2 ** class` metres: 0.05, 0.1, 0.2, 0.4, 0.8, 1.6; a rock of a class is between 1 and 1.4 times that. */
|
|
132
|
+
export declare const ROCK_MIN = 0.05;
|
|
133
|
+
export declare const ROCK_CLASSES = 6;
|
|
134
|
+
/**
|
|
135
|
+
* How much denser the rocks are at a point for fresh crater rims near it: 1 away from any, up to 5 on a young crater's rim.
|
|
136
|
+
*
|
|
137
|
+
* @param x - Metres east of the site.
|
|
138
|
+
* @param y - Metres north of the site.
|
|
139
|
+
* @returns A factor from 1 (no young rim near) up to 5 (on one).
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```ts
|
|
143
|
+
* import { rimBoost } from "@johnmorrisdotca/wakusei-planets/surface";
|
|
144
|
+
*
|
|
145
|
+
* console.log(rimBoost(0, 0), rimBoost(51, -19) >= 1);
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
export declare function rimBoost(x: number, y: number): number;
|
|
149
|
+
/**
|
|
150
|
+
* The rocks round a point, within `radius` metres: seeded and fixed to the place. Many small, few large (about a third as many of each class up), denser by fresh rims; a rock too small for a few pixels at its
|
|
151
|
+
* distance is left out, so nothing shimmers. They are made, not measured.
|
|
152
|
+
*
|
|
153
|
+
* @param cx - Metres east of the site.
|
|
154
|
+
* @param cy - Metres north of the site.
|
|
155
|
+
* @param radius - How far round to look, in metres.
|
|
156
|
+
* @param pixel - The angle one pixel takes in radians (a rock smaller than three pixels at its distance is left out).
|
|
157
|
+
* @returns The rocks, nearest first.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* import { rocksAround } from "@johnmorrisdotca/wakusei-planets/surface";
|
|
162
|
+
*
|
|
163
|
+
* console.log(rocksAround(0, 0, 20, 0.0024).length > 100);
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
export declare function rocksAround(cx: number, cy: number, radius: number, pixel: number): Rock[];
|
|
167
|
+
/**
|
|
168
|
+
* The nearest place to a point where a person can stand without being in a made crater or on a made rim: the made ground there is level over two metres round. The landing point itself is
|
|
169
|
+
* the first tried, so most of the time a person stands where the lunar module stood.
|
|
170
|
+
*
|
|
171
|
+
* @param x - Metres east of the site.
|
|
172
|
+
* @param y - Metres north of the site.
|
|
173
|
+
* @returns A place within thirty metres of the point.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```ts
|
|
177
|
+
* import { standingPlace } from "@johnmorrisdotca/wakusei-planets/surface";
|
|
178
|
+
*
|
|
179
|
+
* const place = standingPlace(0, 0);
|
|
180
|
+
* console.log(Math.hypot(place.x, place.y) < 30);
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
export declare function standingPlace(x?: number, y?: number): {
|
|
184
|
+
x: number;
|
|
185
|
+
y: number;
|
|
186
|
+
};
|