@johnmorrisdotca/wakusei-planets 0.62.0 → 0.64.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 +39 -1
- package/README.md +4 -3
- package/dist/asteroids.d.ts +15 -1
- package/dist/asteroids.js +28 -0
- package/dist/door/made.d.ts +4 -0
- package/dist/door/made.js +10 -0
- package/dist/door/own.d.ts +1 -4
- package/dist/door/own.js +1 -9
- package/dist/element.js +19 -22
- package/dist/fact-sheets.d.ts +103 -0
- package/dist/fact-sheets.js +135 -0
- package/dist/flat/index.d.ts +1 -0
- package/dist/flat/index.js +1 -0
- package/dist/flat/projections.d.ts +300 -0
- package/dist/flat/projections.js +414 -0
- package/dist/scene/tumble.d.ts +13 -0
- package/dist/scene/tumble.js +34 -0
- package/dist/sky/events.d.ts +2 -0
- package/dist/sky/events.js +3 -2
- package/dist/sky.d.ts +561 -0
- package/dist/sky.js +522 -0
- package/dist/space/asteroid-ids.d.ts +8 -0
- package/dist/space/asteroid-ids.js +19 -0
- package/dist/space/element.d.ts +63 -6
- package/dist/space/element.js +208 -26
- package/dist/space/scene.d.ts +32 -0
- package/dist/space/scene.js +36 -2
- package/dist/suncalc-legacy.d.ts +21 -0
- package/dist/suncalc-legacy.js +13 -0
- package/dist/suncalc.d.ts +21 -0
- package/dist/suncalc.js +23 -8
- package/dist/surface/element.d.ts +1 -1
- package/dist/surface/element.js +4 -2
- package/package.json +15 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,12 +2,50 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.64.0] - 2026-11-17
|
|
6
|
+
|
|
7
|
+
- **`/sky`: sky events through astronomy-engine, experimental: `seasons`, Moon phases, eclipses, planet rise/set/transit, libration, lunar apsides and nodes, greatest elongation** (MODULES-534; John Morris, 2026-11-17). A new entry, `@johnmorrisdotca/wakusei-planets/sky`, over astronomy-engine as an **optional peer dependency** (`>=2.1.19 <3`; the lockfile is unchanged, the devDependency stays at 2.1.19). `seasons(year)` gives the March equinox, June solstice, September equinox and December solstice as `Date`s (UTC); 16 events in 1900, 2000, 2026 and 2050 are within 60 seconds of the US Naval Observatory's table (the table is to the minute). Only `src/sky.ts` imports the peer, and a test holds that no other entry point's import graph reaches it. `/sky` is 30.6 kB gzipped with the peer's bytes counted (the budget line is added for `./sky` only; the Moon and eclipse searches pull in most of astronomy-engine's series). New guide, "Sky events" (空の出来事), in both languages. Every choice below is a **default, for John to confirm**: the `./sky` entry with the optional peer; a missing peer is the runtime's own error from a static import (the plan preferred a top-level `await import()` with a worded error, but the size measure targets ES2020, which refuses top-level await, so the plan's fallback is used); new types without the `Deg` suffix; events marked `@experimental`; Jupiter's moons and constellations not wrapped.
|
|
8
|
+
- **`/sky`, part 2: calendar-day rise and set, alignments, peak magnitude, local solar eclipses, lunar eclipse magnitude** (MODULES-534, part 2; John Morris, 2026-11-17). Five more experimental functions in `/sky`, each held to a published reference with the worst error printed by its test:
|
|
9
|
+
- **`riseSetTimes(body, date, { observer, timeZone })`**: rise, transit and set over one calendar day of an IANA time zone (23, 24 or 25 hours on a clock-change day), with `horizon: "crosses" | "above" | "below"` for the poles. `timeZone` is required: a missing, empty or unknown one is a `RangeError` that names it. Against the USNO's one-day service (New York on 1 November and 8 March 2026, Sydney on 4 October, Tromso on the midnight-sun and polar-night days): 22 events, the worst 28.9 s (the table is to the minute); an event the USNO puts outside the zone's day is `null`; the Sun up all day, down all day and the Moon up all day are `"above"`, `"below"`, `"above"`.
|
|
10
|
+
- **`nextAlignment(body, from, { kind: "conjunction" | "opposition" | "quadrature", within })`**: by apparent ecliptic longitude, the name saying so, not `/nearest`'s closest approach. Returns `{ time, kind, side, inferior }`. Against JPL Horizons' ecliptic longitudes (five events: Jupiter and Mars oppositions, Venus's superior and inferior conjunctions, Saturn's western quadrature): the worst 4.7 minutes. Mercury and Venus have conjunctions only (asking for more throws).
|
|
11
|
+
- **`nextPeakMagnitude("venus", from)`**: Venus only, because astronomy-engine finds a peak for no other body (the error says where to look instead: `nextAlignment` opposition for the outer planets, `nextMoonPhase` full for the Moon). Against JPL Horizons' magnitudes: 1.9 days and 0.029 magnitudes from the vertex of a curve that is flat to 0.003 over 4 days.
|
|
12
|
+
- **`localSolarEclipse(from, { observer, within })`**: contacts C1, C2, maximum, C3, C4 as `{ time, altitude }` with the obscuration. Against NASA GSFC's central-line table for 12 August 2026 (eclipse.gsfc.nasa.gov, `SEpath/SEpath2001/SE2026Aug12Tpath.html`), six points over the Atlantic and Spain at NASA's own positions: total at each, the peak within 7.1 s of NASA's UT minute (the engine runs about 6.5 s early at all six; NASA's delta-T is 71.4 s and it leaves out the limb profile), the central duration within 2.2 s and the Sun's altitude within 0.52 degree. No city positions are used. Annular eclipses have no reference checked.
|
|
13
|
+
- **Lunar eclipse magnitude**: `findEclipses` now gives each lunar eclipse its umbral `magnitude` (negative for a penumbral one), worked out from the engine's own shadow geometry, against NASA's column for all 22 eclipses of 2021 to 2030: the worst 0.006.
|
|
14
|
+
- The alignment search walks a day at a time and settles to 0.1 s, so an event within a quarter of a second before `from` counts as at it. No new dependency. The `./sky` size baseline goes from 30,624 to 33,317 bytes gzipped (this Mac's zlib; the new functions and the day arithmetic), on purpose; no other baseline is changed.
|
|
15
|
+
- **Greatest elongation** (`nextGreatestElongation`, Mercury and Venus), against the vertex of a parabola through JPL Horizons' Sun-observer-target angles: Mercury (19 February 2026) 3.7 minutes and 0.0005 degrees, Venus (15 August 2026) 7.4 minutes and 0.0008 degrees.
|
|
16
|
+
- **Lunar apsides and nodes** (`lunarApsides`, `lunarNodes`), against JPL Horizons for November 2026: the ascending node 22 s from where the Moon's ecliptic latitude is zero; the perigee and apogee 6.2 and 6.7 minutes from where the range rate is zero (a measured limit of astronomy-engine, not a doubt about the test: the distance at the extreme is within 0.6 km and 42 km). The search settles to about 0.1 s, so an interval's ends are exact only to that.
|
|
17
|
+
- **Libration** (`moonLibration`), against JPL Horizons for 14 days of November 2026: 0.007 degrees in longitude, 0.024 in latitude (the physical libration of up to 0.04 is not added), and up to 51 km in the Moon's distance, which the engine runs short by smoothly.
|
|
18
|
+
- **Planet rise, set and transit** (`nextRise`, `nextSet`, `nextTransit` for the Sun, the Moon and the planets), against JPL Horizons rise/transit/set for the seven planets at Tokyo on 8 and 9 November 2026: all 42 events fall in the minute before Horizons' stamp (-59.4 to -0.7 s from it); the Sun's rise and set agree with `/suncalc` within 10 s. The search settles to about 0.1 s, so "the start is included" holds to a quarter of a second. Calendar-day `riseSetTimes` with a time zone is not here yet.
|
|
19
|
+
- **Eclipses** (`findEclipses`), against NASA's predictions for 2021 to 2030 (Fred Espenak, NASA GSFC): all 22 solar and 22 lunar eclipses found, none more, of NASA's type (a hybrid is reported by its kind at the greatest moment); greatest eclipse within 9 s (solar) and 13 s (lunar) of NASA's TD less 69 s of delta-T. An annular eclipse's obscuration is within 0.03 of NASA's magnitude squared. Lunar magnitudes and local circumstances are not wrapped yet.
|
|
20
|
+
- **Moon phases** (`moonPhases`, `nextMoonPhase`), against the USNO table of 2026: all 50 phases in order, the engine 11 to 80 seconds after the table's minute stamp (the table drops the seconds); this package's own Moon puts each found phase at 0, 0.25, 0.5 or 0.75 of its cycle to within 0.016 (the Moon's latitude).
|
|
21
|
+
|
|
22
|
+
- **`goTo(id)` and `ride(id)` take the id of an asteroid of `/asteroids`** (MODULES-1354). With the option `asteroids` on, `space.goTo("eros")` brings the camera to a few times the asteroid's size from it (200 km at least) looking at it and keeps it there as the clock runs, and `space.ride("apophis")` puts the camera at the asteroid looking at the Sun (`view: "follow"` and `distanceKm` keep a distance instead). Both are at the true scale: the view is set to it, and going back to `compressed`, turning the option off, a `goTo` of a body or `ride(null)` ends the move. `riding.target.id` says which asteroid (`RidePoint` has an optional `id`), `wakusei-ride` is sent and `wakusei-hop` is not. `europa` and `dione` stay moons; `asteroid:europa` (the prefix works for every id) means the asteroid. With the option off an asteroid's id throws a `RangeError` that says to turn it on; with it on a name that is no body and no asteroid throws one that says so; a name that is neither, with the option off, returns `false` as before. A call made before the records are in is made when they are, unless another move is asked for first. `ride` takes any string in its type now (`RideTarget | string`), and `goTo` an option `distanceKm`. The ids are a list of their own in the view (`src/space/asteroid-ids.ts`, 1 kB, held to the table by a test), so the table is still not loaded until the option is on. Test: `e2e/space-asteroid-goto.demo.ts`, five repeats under throttle 4.
|
|
23
|
+
|
|
24
|
+
- **The asteroids of `/asteroids` can be placed in the space view, named and pressed** (MODULES-1353). The attribute and property `asteroids` (off by default) puts the 104 bodies in the view: each a point on its orbit with the belts' points in the one instanced draw, the nearest few (at most 12, within about an astronomical unit in the true scale) named in the page's language, each an entry of `sight()` with the new kind `small-body`, and a press on a name sends `wakusei-body-click` (`{ id, name, kind: "small-body" }`) and `wakusei-asteroid-click` (`{ id, name }`) and goes nowhere (going to an asteroid is `goTo` and `ride`, MODULES-1354). `asteroidsSource()` in `/asteroids` is the same bodies as a data-door source. Nothing is loaded, worked out or drawn for them with the option off (the table is a chunk the space view reaches only by a dynamic import, and the table's test now says so); on, a draw gives the graphics card one more call (14 to 15) and holds six more GPU objects (105 to 111), and turned off again it is back to 14 and 105 frame for frame; a frame took a median of 66 ms and 89 ms at the 95th percentile off, 74 and 106 ms on, and at a quarter of the CPU 81 and 100 ms off, 77 and 119 ms on; placing the 104 bodies took a median of 0.1 ms and at most 0.9 ms a draw (Chromium in software, 24 draws each, 2026-11-17). Two asteroids, `europa` and `dione`, have the id of a moon of the package: the view keeps them apart, the moon is still the moon, and events and `sight()` say `kind: "small-body"` for the asteroid. `stats.asteroids` says how many were placed and named. Test: `e2e/space-asteroids.demo.ts`, five repeats under throttle 4.
|
|
25
|
+
|
|
26
|
+
- **A tumbling view no longer jumps where the controller's angles fold** (MODULES-545). While the shared controller tumbles the view about all three axes (turn axis `all`), `<wakusei-body>` drew the pose from the controller's `yaw`, `tilt` and `roll`, which fold at a pole (`(yaw, tilt, roll)` and `(yaw + 180, 180 - tilt, roll + 180)` are the same orientation), and the element's own composition (yaw about the body's pole, then tilt, then roll with the roll's sign reversed) is not a smooth function of the controller's orientation: the pole or the meridian jumped by 20 degrees or more in one frame of a smooth tumble. During a tumble yaw now turns the whole picture about the picture's vertical and the roll keeps the controller's sign, which makes the pose follow the orientation (the biggest step of a simulated tumble is 1.2 degrees, its own); the moons and their orbit lines follow. Every other view is as it was: yaw about the pole for a drag, a key or Auto-turn on one axis. The one visible change is at the moment the turn axis is set to `all` or taken off it, when a body whose pole is tipped in the picture takes its new pose at once. Tests: `test/tumble.test.ts` (kazoku-ui's own orientation tumbled past the pole; the old pose's jump is asserted too; an upright pole gives the same pose both ways). The public API is unchanged (`test/api-snapshot.txt` moves only for the class's private members).
|
|
27
|
+
|
|
28
|
+
- **A press on a drawn name picks its body** (MODULES-1510; found on spaceprogramx.com by John Morris, 2026-11-18: pressing Oberon and Umbriel at Uranus did nothing). The space view's hover found a body within 14 pixels of its place or, failing that, inside a drawn name's box, but a press looked at the 14 pixels only, so a press on a name, 30 to 50 pixels from its dot, was taken for one on the empty sky (the names are for the eye and the keyboard: `pointer-events` is off on them). A press now asks the hover's own hit test, so what lights up under the pointer is what a press picks, by mouse and by touch. A press on a disc still works with `labels="off"`. A name the view draws on the body itself (`data-carried`) has no box of its own and is still pressed on the body. `e2e/space-press-names.demo.ts`. The API snapshot is renewed: it lists the private `#bodyAt`, which takes a third argument now; no public name or signature changed.
|
|
29
|
+
|
|
30
|
+
- **`<wakusei-surface>` `position.up` follows the view while driving** (MODULES-1487). The getter always returned the standing eye height (1.7 m). While the rover is driven (`drive="on"`) or the landing watched it now returns the height the view is drawn from over the ground under it: the commander's seat in the seat view, the chase camera in the chase view. Standing is unchanged.
|
|
31
|
+
|
|
32
|
+
## [0.63.0] - 2026-11-17
|
|
33
|
+
|
|
34
|
+
- **A drop-in for suncalc 2.1 and 1.9: both flags, default exports, a guide** (MODULES-535). `getTimes` and `getMoonTimes` in `/suncalc` now give `alwaysUp` and `alwaysDown` both, one `true` and one `false`, on a day without a sunrise or without a Moon rise and set, as suncalc 2 does (before, only the true one was there). `/suncalc` and `/suncalc/legacy` each have a default export holding the same functions and the same `times` array, for code written `import SunCalc from "suncalc"`. A new guide, "Replacing suncalc" (English and Japanese), has the one-line import change, every function side by side, the three conventions people trip on, the differences kept on purpose, the measured limits, and suncalc3's extras listed and not built. `test/suncalc-grid.test.ts` runs every function against suncalc 2.1.2 and suncalc 1.9.0 (dev-only) on fourteen places (both hemispheres, both polar circles, 78 degrees north and south) by eleven days from 1900 to 2100 by three times of day; `test/docs-replacing-suncalc.test.ts` runs the guide's examples. The API snapshot was updated for the two default exports.
|
|
35
|
+
|
|
36
|
+
- **The ephemeris package survey, as a record** (MODULES-531). `docs/design/ephemeris-survey.md` lists each surveyed package with its licence line read on its own GitHub page on 2026-11-17 (MIT, Apache-2.0, AGPL-3.0, GPL), what it holds and how accurate it claims to be, and what is still open. Two facts of the first survey were corrected (vsop87 is about 2.3 MB, not 7; the ephemeris package says GPL v2 on its repo).
|
|
37
|
+
|
|
38
|
+
- **"Coming from suncalc 1.x or suncalc2" in the `/suncalc` guide, EN and JA** (MODULES-537). The one-line import change, radians to degrees and south to north azimuth side by side with a run that shows both, the day rule of the legacy `getTimes` and `getMoonTimes`, and a plain list of what suncalc3 adds (suncalc-ts adds nothing). The licence and fork findings are in `docs/design/suncalc-forks.md`. No code changed.
|
|
39
|
+
|
|
40
|
+
- **Fact sheets: `/fact-sheets`** (MODULES-529, first slice). `factSheet("mars")` gives, for the Sun, the eight planets and Pluto, the radius and mean distance in km and miles (and au), the sidereal year in Earth days, the rotation in hours and whether it is retrograde, the number of known moons and the date it was read (the `/moon-catalogue` count), NASA's own page, and a short description in our own words in English and Japanese. New guide, English and Japanese, with tested examples. A new entry point, so the API snapshot and the size baseline have a new line. Not in this slice: the definitions of planet, dwarf planet, moon, asteroid, comet, meteoroid, meteor and meteorite (held back until the IAU texts are checked against the originals), meteor showers (the IMO table's reuse terms must be read first) and a demo page.
|
|
41
|
+
|
|
42
|
+
- **Map projections for the painted maps** (MODULES-546, the pure side and the demo; no new dependency). `@johnmorrisdotca/wakusei-planets/flat` gains `PROJECTIONS` (`equirectangular`, `mercator`, `sinusoidal`, `mollweide`, `azimuthal`), `projectMap` and `unprojectMap` (radii from the middle of the map; `null` outside the leaf, the ellipse or the disc), `graticule` (lines of longitude and latitude cut where they would cross the map, none at a pole on Mercator, which stops at 85.05 degrees), `mapOutline`, `fitMap`, `mapPixels`, `mapSun` (the sub-solar point on the map, for any body with a pole and spin) and `resampleMap` (a body's equirectangular painted map redrawn in a projection: smooth between pixels, wrapping at the seam, holding at the poles, transparent outside the shape), with `isProjection`, `MERCATOR_LIMIT` and the types. The flat page of the demo has a panel, "Any body, in a projection": the 25 bodies with a painted map, the five projections, the grid (off, 30 or 15 degrees), the middle longitude and, on the disc, latitude, and a ring where the Sun is overhead; it draws only when something changes. English and Japanese in "Flat maps of the Moon and Mars" and the demo. Tests: `test/flat-projections.test.ts` (round trips about three centres, the poles, the shapes' areas, the grid's cuts, the seam), `e2e/flat-projections.demo.ts` and `examples/flat/projections.mjs`. Not done: `<wakusei-flat projection="...">` itself (its pans, picks and ground tracks read the plain map).
|
|
43
|
+
|
|
5
44
|
## [0.62.0] - 2026-11-17
|
|
6
45
|
|
|
7
46
|
- **Standing on Mars, and at six more sites: Perseverance, Curiosity, Apollo 15, Apollo 16, Chang'e 3 and Chang'e 4** (MODULES-1482, part 2; John Morris, 2026-11-17). `SURFACE_SITES` now has seven sites and `SurfaceSite.body` is `"moon" | "mars"`; the new `ground` is `"measured"` (Apollo 17, as before) or `"flat"`, and `gravity` is the body's surface gravity (`MOON_GRAVITY` 1.62, `MARS_GRAVITY` 3.71 m/s2). `<wakusei-surface site="perseverance">` and `land(space, "perseverance")` (also `curiosity`, `apollo-15`, `apollo-16`, `chang-e-3`, `chang-e-4`) work; the seven records in `LANDING_SITES` carry `stand`, and a test pins each to the standing view's point, place and landing moment. **The ground at the six new sites is a flat stand-in until a height model is added** ("ground: flat stand-in until a DTM is added", in the page's line and in `manifest.accuracy`): flat at the site's datum, made in memory by `flatTerrain` and `flatManifest` with nothing fetched, and with no relief, no made craters and no made rocks (`detail` is ignored there), so no relief is faked. The height data would be a download (HiRISE or CTX models for Mars, LROC or LOLA for the Moon) and is not here. **Real for the place and time**: the Sun's direction and size from the package's own ephemeris (`standSky`, `localFrame` takes a body; on Mars the Sun is about a third of a degree across), the gravity (the driven rover's slope and free fall, `driveStep`'s new last argument, and the thrown dust, `DustField.step`'s), and the Moon's black sky with its Earth. **Chosen, not measured**: Mars's sky, a butterscotch day sky with a pale blue glow round a low Sun, black at night after a long twilight (`marsAir`, drawn by a new sky pass in the shader; NASA's page says the sky is hazy and reddish from suspended dust), and the ground's reddish tone; the Earth is not drawn from Mars. New exports of `/surface`: `standSky`, `marsAir`, `flatTerrain`, `flatManifest`, `MOON_GRAVITY`, `MARS_GRAVITY` and the types `StandSky`, `SkyAir` and `Rgb`; `TerrainManifest.body` is `"moon" | "mars"`. Tests: `test/surface-sites.test.ts` and `e2e/surface-sites.demo.ts` (no tiles asked for, the flat line, a butterscotch sky over a reddish ground on Mars and a black sky over a grey ground on the Moon, nothing drawn at rest). Guide: "Standing on the Moon and Mars", in both languages. **Not here yet**: the measured ground of any of them, and the rover models at the new sites (`drive-model` takes the GLB as before).
|
|
8
47
|
|
|
9
48
|
- **Belt filters and size tiers** (MODULES-558, part). `filterBeltBodies(bodies, { belts, hMax, hMin, status, part })`, `beltStatus(name)` (provisional, numbered or named), `beltPart(body, jd, jupiterLongitude)` (the main belt's inner, middle and outer parts, the Trojans' L4 and L5 camps, plutinos and detached bodies), `BELT_TIERS` and `beltTiers(bodies)` (how many bodies of each size tier are carried, against how many the database knows). All from the rows already carried: no new data. Still open on the ticket: discovery facts and pictures (need files fetched), the embed and the builder.
|
|
10
|
-
|
|
11
49
|
## [0.61.0] - 2026-11-17
|
|
12
50
|
|
|
13
51
|
- **IM-2's three rovers stand on Athena, east of the prime meridian** (MODULES-1402; John Morris, 2026-11-17). GCAT's lander catalogue has the whole IM-2 landing at 84.7906 S, 29.1957 W; NASA's table, which the places take, puts Athena at 29.1957 E, but GRACE, MAPP and Yaoki, which NASA's table does not list, kept the catalogue's point on the far side of the prime meridian. `scripts/make-places-data.py` now moves a rover the catalogue puts at its lander's own point with the lander whenever a better source moves the lander more than 0.05 degree and has no position of its own for the rover; the rovers keep the catalogue's figure in `gcatPosition`. No other rover on the Moon or Mars disagrees with its lander, and a test pins both.
|
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.64.0/docs/images/lineup-desk.png" width="640"></p>
|
|
23
23
|
|
|
24
24
|
## Who it is for
|
|
25
25
|
|
|
@@ -412,7 +412,7 @@ The tiles of every body share one 48 MB budget, six loads at a time for a source
|
|
|
412
412
|
|
|
413
413
|
## The portrait builder
|
|
414
414
|
|
|
415
|
-
<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.
|
|
415
|
+
<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.64.0/docs/images/portrait-family.png" width="640"></p>
|
|
416
416
|
|
|
417
417
|
[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.
|
|
418
418
|
|
|
@@ -529,6 +529,7 @@ Each guide has a Japanese twin in [docs/guides/ja](docs/guides/ja/getting-starte
|
|
|
529
529
|
| [Serve it yourself](docs/guides/serve-it-yourself.md) | A small Node server over the package, that you host |
|
|
530
530
|
| [The Sun and Moon from a place](docs/guides/suncalc.md) | Position, sunrise and sunset, Moon rise, set and phase; a drop-in for suncalc |
|
|
531
531
|
| [Where the planets are in the sky](docs/guides/sky-bodies.md) | The Sun, the Moon and the planets for a moment and a place: right ascension and declination of date and J2000, magnitude, size, phase, elongation, azimuth and altitude, as plain data |
|
|
532
|
+
| [Sky events (experimental)](docs/guides/sky-events.md) | When the seasons begin, through astronomy-engine as an optional peer; more events to come |
|
|
532
533
|
| [Coordinate conversions](docs/guides/coordinates.md) | Pure spherical, ecliptic, equatorial and horizontal coordinate conversions |
|
|
533
534
|
| [TypeScript and Node](docs/guides/typescript-and-node.md) | Types and the pure side |
|
|
534
535
|
| [How it works](docs/guides/how-it-works.md) | Where the numbers come from |
|
|
@@ -567,7 +568,7 @@ BODIES.pluto.kind; // "dwarf-planet"
|
|
|
567
568
|
|
|
568
569
|
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:
|
|
569
570
|
|
|
570
|
-
> Morris, J. (2026). *Wakusei Planets* (version 0.
|
|
571
|
+
> Morris, J. (2026). *Wakusei Planets* (version 0.64.0) [Computer software]. https://github.com/johnmorrisdotca/wakusei-planets
|
|
571
572
|
|
|
572
573
|
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).
|
|
573
574
|
|
package/dist/asteroids.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SmallBody } from "./door/small-bodies.ts";
|
|
1
|
+
import type { SmallBody, SmallBodySource } from "./door/small-bodies.ts";
|
|
2
2
|
import { type Vec3 } from "./vec.ts";
|
|
3
3
|
import { type When } from "./when.ts";
|
|
4
4
|
export type { When } from "./when.ts";
|
|
@@ -395,3 +395,17 @@ export declare const ASTEROID_ACCURACY: {
|
|
|
395
395
|
/** In words, what the numbers leave out. */
|
|
396
396
|
readonly note: "Two-body motion: the planets' pull is not included, so a body that passes close to the Earth or Jupiter, and every body far from its epoch, drifts further. Positions of near-Earth asteroids a year or more from the epoch are a guide, not an ephemeris.";
|
|
397
397
|
};
|
|
398
|
+
/**
|
|
399
|
+
* The bodies as a record source of the data door, the way the view draws them as points beside the belts: every body of the set as a `SmallBody`, in the order of `asteroidList()`. `<wakusei-space>` adds it for
|
|
400
|
+
* its attribute `asteroids`; a page can hand it to a view's `sources` too.
|
|
401
|
+
*
|
|
402
|
+
* @returns The source.
|
|
403
|
+
*
|
|
404
|
+
* @example
|
|
405
|
+
* ```ts
|
|
406
|
+
* import { asteroidsSource } from "@johnmorrisdotca/wakusei-planets/asteroids";
|
|
407
|
+
*
|
|
408
|
+
* console.log(asteroidsSource().info.id, asteroidsSource().info.licence.name);
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
411
|
+
export declare function asteroidsSource(): SmallBodySource;
|
package/dist/asteroids.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// (`asteroidPosition`) or astronomical units (`asteroidPositionAu`, the unit `heliocentric` gives the planets in). The Kepler solver is the package's own. Pure: no DOM, no clock reads, no three.js.
|
|
4
4
|
import { ASTEROID_FETCHED, ASTEROID_TABLE } from "./data/asteroids.js";
|
|
5
5
|
import { toTerrestrialTime } from "./clock.js";
|
|
6
|
+
import { madeHere } from "./door/made.js";
|
|
6
7
|
import { heliocentric, kepler } from "./ephemeris.js";
|
|
7
8
|
import { length, RAD, sub } from "./vec.js";
|
|
8
9
|
import { moment } from "./when.js";
|
|
@@ -336,3 +337,30 @@ export const ASTEROID_ACCURACY = {
|
|
|
336
337
|
/** In words, what the numbers leave out. */
|
|
337
338
|
note: "Two-body motion: the planets' pull is not included, so a body that passes close to the Earth or Jupiter, and every body far from its epoch, drifts further. Positions of near-Earth asteroids a year or more from the epoch are a guide, not an ephemeris.",
|
|
338
339
|
};
|
|
340
|
+
/**
|
|
341
|
+
* The bodies as a record source of the data door, the way the view draws them as points beside the belts: every body of the set as a `SmallBody`, in the order of `asteroidList()`. `<wakusei-space>` adds it for
|
|
342
|
+
* its attribute `asteroids`; a page can hand it to a view's `sources` too.
|
|
343
|
+
*
|
|
344
|
+
* @returns The source.
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* ```ts
|
|
348
|
+
* import { asteroidsSource } from "@johnmorrisdotca/wakusei-planets/asteroids";
|
|
349
|
+
*
|
|
350
|
+
* console.log(asteroidsSource().info.id, asteroidsSource().info.licence.name);
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
export function asteroidsSource() {
|
|
354
|
+
return madeHere({
|
|
355
|
+
kind: "records",
|
|
356
|
+
info: {
|
|
357
|
+
id: "wakusei-asteroids",
|
|
358
|
+
name: { en: "Named asteroids and comets of the Small-Body Database", ja: "小天体データベースの、名前のついた小惑星と彗星" },
|
|
359
|
+
credit: { en: "Asteroid orbits: NASA/JPL Small-Body Database", ja: "小惑星の軌道:NASA/JPL 小天体データベース" },
|
|
360
|
+
licence: { name: "Public domain (NASA/JPL: not subject to copyright in the United States)", url: "https://www.nasa.gov/nasa-brand-center/images-and-media/" },
|
|
361
|
+
url: "https://ssd-api.jpl.nasa.gov/doc/sbdb.html",
|
|
362
|
+
retrieved: ASTEROID_FETCHED,
|
|
363
|
+
},
|
|
364
|
+
records: () => Promise.resolve(ASTEROIDS.map((body) => asteroidAsSmallBody(body))),
|
|
365
|
+
});
|
|
366
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Marks a source object as made by this package. */
|
|
2
|
+
export declare function madeHere<T extends object>(source: T): T;
|
|
3
|
+
/** True for a source object this package made (`tilesSource`), false for any other. */
|
|
4
|
+
export declare const isOwnSource: (source: object) => boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Which source objects this package made, apart from `own.ts` (which holds the credits of the package's own data, and the picture credits with them) so that an entry point that only needs to mark a source, such as `/asteroids`, does not carry them. Pure.
|
|
2
|
+
/** The source objects this package made itself: only these are its own, whatever id a caller's source gives itself. */
|
|
3
|
+
const MADE_HERE = new WeakSet();
|
|
4
|
+
/** Marks a source object as made by this package. */
|
|
5
|
+
export function madeHere(source) {
|
|
6
|
+
MADE_HERE.add(source);
|
|
7
|
+
return source;
|
|
8
|
+
}
|
|
9
|
+
/** True for a source object this package made (`tilesSource`), false for any other. */
|
|
10
|
+
export const isOwnSource = (source) => MADE_HERE.has(source);
|
package/dist/door/own.d.ts
CHANGED
|
@@ -13,10 +13,7 @@ import type { Credit, SourceInfo } from "../data-door.ts";
|
|
|
13
13
|
export declare const OWN_SOURCES: readonly SourceInfo[];
|
|
14
14
|
/** The rows of `OWN_SOURCES` by id. */
|
|
15
15
|
export declare const OWN_BY_ID: ReadonlyMap<string, SourceInfo>;
|
|
16
|
-
|
|
17
|
-
export declare function madeHere<T extends object>(source: T): T;
|
|
18
|
-
/** True for a source object this package made (`tilesSource`), false for any other. */
|
|
19
|
-
export declare const isOwnSource: (source: object) => boolean;
|
|
16
|
+
export { isOwnSource, madeHere } from "./made.ts";
|
|
20
17
|
/**
|
|
21
18
|
* The credit of one of the package's own sources, for a page that draws something itself: the pictures and positions of the elements are credited by the elements' own `credits()`, and a page that draws a body from the
|
|
22
19
|
* painter puts `ownCredit("wakusei-pictures", 1)` in its credit line.
|
package/dist/door/own.js
CHANGED
|
@@ -55,15 +55,7 @@ export const OWN_SOURCES = freeze([
|
|
|
55
55
|
]);
|
|
56
56
|
/** The rows of `OWN_SOURCES` by id. */
|
|
57
57
|
export const OWN_BY_ID = new Map(OWN_SOURCES.map((source) => [source.id, source]));
|
|
58
|
-
|
|
59
|
-
const MADE_HERE = new WeakSet();
|
|
60
|
-
/** Marks a source object as made by this package. */
|
|
61
|
-
export function madeHere(source) {
|
|
62
|
-
MADE_HERE.add(source);
|
|
63
|
-
return source;
|
|
64
|
-
}
|
|
65
|
-
/** True for a source object this package made (`tilesSource`), false for any other. */
|
|
66
|
-
export const isOwnSource = (source) => MADE_HERE.has(source);
|
|
58
|
+
export { isOwnSource, madeHere } from "./made.js";
|
|
67
59
|
/**
|
|
68
60
|
* The credit of one of the package's own sources, for a page that draws something itself: the pictures and positions of the elements are credited by the elements' own `credits()`, and a page that draws a body from the
|
|
69
61
|
* painter puts `ownCredit("wakusei-pictures", 1)` in its credit line.
|
package/dist/element.js
CHANGED
|
@@ -17,6 +17,7 @@ import { createDoorHost } from "./door/host.js";
|
|
|
17
17
|
import { ownCredit } from "./door/own.js";
|
|
18
18
|
export { TEXTURE_BASE, TEXTURE_FAR_BASE, TILES_BASE } from "./scene/textures.js";
|
|
19
19
|
import { mapWidthOf, ringWidthOf, zoomLimit } from "./scene/reach.js";
|
|
20
|
+
import { viewPose } from "./scene/tumble.js";
|
|
20
21
|
import { createBodyItem } from "./scene/body.js";
|
|
21
22
|
import { NAME_LABEL_ATTRIBUTES, nameLabelKey, nameLabelText, readNameLabel } from "./scene/name-label.js";
|
|
22
23
|
import { delegates, onRegister } from "./scene/store.js";
|
|
@@ -50,11 +51,6 @@ const readTime = (value) => {
|
|
|
50
51
|
return Number.isFinite(ms) ? ms : undefined;
|
|
51
52
|
};
|
|
52
53
|
const vectorKey = (v) => `${v[0].toFixed(2)},${v[1].toFixed(2)},${v[2].toFixed(2)}`;
|
|
53
|
-
function turnPose(pose, axis, degrees) {
|
|
54
|
-
pose.pole = turnVec(pose.pole, axis, degrees);
|
|
55
|
-
pose.meridian = turnVec(pose.meridian, axis, degrees);
|
|
56
|
-
pose.light = turnVec(pose.light, axis, degrees);
|
|
57
|
-
}
|
|
58
54
|
/** Keep the body in the picture: at least a quarter of its width stays inside the edge, however far the view is moved. `pan` is in half-widths of the picture. */
|
|
59
55
|
function clampPan(pan, extent, zoom) {
|
|
60
56
|
const half = extent / Math.max(0.05, zoom);
|
|
@@ -133,6 +129,8 @@ export class WakuseiBody extends HTMLElement {
|
|
|
133
129
|
#tilt = 0;
|
|
134
130
|
#roll = 0;
|
|
135
131
|
#pitchDelta = 0;
|
|
132
|
+
/** True while the shared controller tumbles the view about all three axes: the pose is then drawn so it follows the controller's orientation (`scene/tumble.ts`). */
|
|
133
|
+
#tumble = false;
|
|
136
134
|
#lastAnchors = -1;
|
|
137
135
|
#zoom = 1;
|
|
138
136
|
#panX = 0;
|
|
@@ -627,7 +625,10 @@ export class WakuseiBody extends HTMLElement {
|
|
|
627
625
|
this.#handsKey = key;
|
|
628
626
|
const limits = this.#limits();
|
|
629
627
|
this.#limitKey = `${limits.zoomMax}|${this.look}`;
|
|
630
|
-
this.#hands = carryControls(this, { on, limits, grabRadius: this.discRadius, objectSize: { width: this.discRadius * 2, height: this.discRadius * 2 }, onChange: (view) =>
|
|
628
|
+
this.#hands = carryControls(this, { on, limits, grabRadius: this.discRadius, objectSize: { width: this.discRadius * 2, height: this.discRadius * 2 }, onChange: (view) => {
|
|
629
|
+
this.#tumble = this.#hands?.controller.turnAxis === "all";
|
|
630
|
+
this.setView(view);
|
|
631
|
+
} });
|
|
631
632
|
if (this.#zoom !== 1 || this.#yaw !== 0 || this.#tilt !== 0 || this.#panX !== 0 || this.#panY !== 0 || this.#roll !== 0) {
|
|
632
633
|
if (!this.hasAttribute("data-kazoku-bar"))
|
|
633
634
|
this.setView({});
|
|
@@ -748,18 +749,12 @@ export class WakuseiBody extends HTMLElement {
|
|
|
748
749
|
}
|
|
749
750
|
// --- the state of the scene --------------------------------------------------------------------------------------------------------------------
|
|
750
751
|
#sceneOf(frame) {
|
|
751
|
-
const pose = { pole: frame.pose.pole, meridian: frame.pose.meridian, light: frame.pose.light };
|
|
752
752
|
const tiltBy = this.#pitchDelta - this.#tilt;
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
if (tiltBy !== 0)
|
|
756
|
-
turnPose(pose, [1, 0, 0], tiltBy);
|
|
757
|
-
const roll = -this.#roll;
|
|
758
|
-
if (roll !== 0)
|
|
759
|
-
turnPose(pose, [0, 0, 1], roll);
|
|
753
|
+
const roll = this.#tumble ? this.#roll : -this.#roll;
|
|
754
|
+
const pose = viewPose(frame.pose, this.#yaw, tiltBy, roll, this.#tumble);
|
|
760
755
|
const r = this.#request();
|
|
761
756
|
const extent = this.#extent(r.moons);
|
|
762
|
-
const moons = r.moons ? this.#moonsOf(frame, extent, tiltBy, roll) : undefined;
|
|
757
|
+
const moons = r.moons ? this.#moonsOf(frame, extent, tiltBy, roll, this.#tumble ? this.#yaw : 0) : undefined;
|
|
763
758
|
const label = this.#labelNow();
|
|
764
759
|
return { pose, extent, sky: frame.time !== undefined, zoom: this.#zoom, panX: clampPan(this.#panX, extent, this.#zoom), panY: clampPan(this.#panY, extent, this.#zoom), moons, label };
|
|
765
760
|
}
|
|
@@ -818,32 +813,34 @@ export class WakuseiBody extends HTMLElement {
|
|
|
818
813
|
this.#limitKey = key;
|
|
819
814
|
this.#hands.setLimits(limits);
|
|
820
815
|
}
|
|
821
|
-
#moonsOf(frame, extent, tilt, roll) {
|
|
816
|
+
#moonsOf(frame, extent, tilt, roll, spin) {
|
|
822
817
|
const moons = [];
|
|
823
818
|
for (const m of frame.moons) {
|
|
824
819
|
if (m.distance <= extent * 1.05) {
|
|
825
820
|
const orbit = this.#orbits.get(m.id);
|
|
826
|
-
const
|
|
821
|
+
const spun = spin === 0 ? [m.x, m.y, m.z] : turnVec([m.x, m.y, m.z], [0, 1, 0], spin);
|
|
822
|
+
const tipped = tilt === 0 ? spun : turnVec(spun, [1, 0, 0], tilt);
|
|
827
823
|
const rotated = roll === 0 ? tipped : turnVec(tipped, [0, 0, 1], roll);
|
|
828
|
-
moons.push({ id: m.id, x: rotated[0], y: rotated[1], z: rotated[2], orbit: orbit === undefined || (tilt === 0 && roll === 0) ? orbit : this.#tiltedOrbit(m.id, orbit, tilt, roll) });
|
|
824
|
+
moons.push({ id: m.id, x: rotated[0], y: rotated[1], z: rotated[2], orbit: orbit === undefined || (spin === 0 && tilt === 0 && roll === 0) ? orbit : this.#tiltedOrbit(m.id, orbit, tilt, roll, spin) });
|
|
829
825
|
}
|
|
830
826
|
}
|
|
831
827
|
return moons;
|
|
832
828
|
}
|
|
833
829
|
#tilted = new Map();
|
|
834
|
-
#tiltedOrbit(id, orbit, tilt, roll) {
|
|
830
|
+
#tiltedOrbit(id, orbit, tilt, roll, spin) {
|
|
835
831
|
const held = this.#tilted.get(id);
|
|
836
|
-
if (held !== undefined && held.source === orbit && held.tilt === tilt && held.roll === roll)
|
|
832
|
+
if (held !== undefined && held.source === orbit && held.tilt === tilt && held.roll === roll && held.spin === spin)
|
|
837
833
|
return held.out;
|
|
838
834
|
const out = new Float32Array(orbit.length);
|
|
839
835
|
for (let i = 0; i < orbit.length; i += 3) {
|
|
840
|
-
const
|
|
836
|
+
const spun = spin === 0 ? [orbit[i], orbit[i + 1], orbit[i + 2]] : turnVec([orbit[i], orbit[i + 1], orbit[i + 2]], [0, 1, 0], spin);
|
|
837
|
+
const tipped = turnVec(spun, [1, 0, 0], tilt);
|
|
841
838
|
const v = roll === 0 ? tipped : turnVec(tipped, [0, 0, 1], roll);
|
|
842
839
|
out[i] = v[0];
|
|
843
840
|
out[i + 1] = v[1];
|
|
844
841
|
out[i + 2] = v[2];
|
|
845
842
|
}
|
|
846
|
-
this.#tilted.set(id, { source: orbit, tilt, roll, out });
|
|
843
|
+
this.#tilted.set(id, { source: orbit, tilt, roll, spin, out });
|
|
847
844
|
return out;
|
|
848
845
|
}
|
|
849
846
|
/** The moons of Jupiter and Saturn follow their theories once those are fetched; until then the fitted orbits answer. */
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bodies that have a fact sheet: the Sun, the eight planets and Pluto.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { FACT_SHEET_IDS } from "@johnmorrisdotca/wakusei-planets/fact-sheets";
|
|
7
|
+
*
|
|
8
|
+
* console.log(FACT_SHEET_IDS.join(", "));
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
export declare const FACT_SHEET_IDS: readonly ["sun", "mercury", "venus", "earth", "mars", "jupiter", "saturn", "uranus", "neptune", "pluto"];
|
|
12
|
+
/**
|
|
13
|
+
* The name of a body that has a fact sheet.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import { FACT_SHEET_IDS, type FactSheetId } from "@johnmorrisdotca/wakusei-planets/fact-sheets";
|
|
18
|
+
*
|
|
19
|
+
* const id: FactSheetId = FACT_SHEET_IDS[3];
|
|
20
|
+
* console.log(id);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export type FactSheetId = (typeof FACT_SHEET_IDS)[number];
|
|
24
|
+
/**
|
|
25
|
+
* A number in kilometres and in miles.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* import { factSheet, type Length } from "@johnmorrisdotca/wakusei-planets/fact-sheets";
|
|
30
|
+
*
|
|
31
|
+
* const radius: Length = factSheet("earth").radius;
|
|
32
|
+
* console.log(Math.round(radius.km), Math.round(radius.miles));
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export interface Length {
|
|
36
|
+
km: number;
|
|
37
|
+
miles: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A fact sheet: what a page about a body usually says, as data.
|
|
41
|
+
*
|
|
42
|
+
* `radius` is the equatorial radius. `distanceFromSun` is the mean distance (zero for the Sun). `yearDays` is the sidereal year in Earth days (the time to go once round the Sun; `null` for the Sun) and
|
|
43
|
+
* `rotationHours` the time to turn once on its axis against the stars (so it is not the length of a solar day: Venus's sidereal rotation is longer than its year's solar day), with `retrograde` true for a body
|
|
44
|
+
* that turns backwards (Venus, Uranus and Pluto). `knownMoons` is the number of moons known on `moonsReadOn` (a date: the count moves as moons are found). `nasaPage` is NASA's own page about the body.
|
|
45
|
+
* `description` is a short description in our own words.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* import { factSheet, type FactSheet } from "@johnmorrisdotca/wakusei-planets/fact-sheets";
|
|
50
|
+
*
|
|
51
|
+
* const mars: FactSheet = factSheet("mars");
|
|
52
|
+
* console.log(mars.name.en, mars.knownMoons, mars.nasaPage);
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export interface FactSheet {
|
|
56
|
+
id: FactSheetId;
|
|
57
|
+
name: {
|
|
58
|
+
en: string;
|
|
59
|
+
ja: string;
|
|
60
|
+
};
|
|
61
|
+
kind: "star" | "planet" | "dwarf-planet";
|
|
62
|
+
radius: Length;
|
|
63
|
+
distanceFromSun: Length & {
|
|
64
|
+
au: number;
|
|
65
|
+
};
|
|
66
|
+
yearDays: number | null;
|
|
67
|
+
rotationHours: number;
|
|
68
|
+
retrograde: boolean;
|
|
69
|
+
knownMoons: number;
|
|
70
|
+
moonsReadOn: string;
|
|
71
|
+
nasaPage: string;
|
|
72
|
+
description: {
|
|
73
|
+
en: string;
|
|
74
|
+
ja: string;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The date the moon counts were read from JPL's planetary satellite page, the same read as `/moon-catalogue`'s `MOON_CATALOGUE_FETCHED`.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* import { MOONS_READ_ON } from "@johnmorrisdotca/wakusei-planets/fact-sheets";
|
|
83
|
+
*
|
|
84
|
+
* console.log("moon counts read on", MOONS_READ_ON);
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare const MOONS_READ_ON = "2026-11-11";
|
|
88
|
+
/**
|
|
89
|
+
* The fact sheet of the Sun, a planet or Pluto.
|
|
90
|
+
*
|
|
91
|
+
* @param id - `"sun"`, `"mercury"` to `"neptune"`, or `"pluto"`.
|
|
92
|
+
* @returns The sheet (a new object each call).
|
|
93
|
+
* @throws {RangeError} For an id that has no fact sheet, naming it.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* import { factSheet } from "@johnmorrisdotca/wakusei-planets/fact-sheets";
|
|
98
|
+
*
|
|
99
|
+
* const venus = factSheet("venus");
|
|
100
|
+
* console.log(venus.yearDays, venus.retrograde, venus.description.en);
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
export declare function factSheet(id: FactSheetId): FactSheet;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// A fact sheet for the Sun, the eight planets and Pluto, as plain data.
|
|
2
|
+
// Every number is the package's own (radius and rotation from the IAU working group's report, the distance from JPL's approximate elements) or a published figure with its source named here: the sidereal
|
|
3
|
+
// year from NASA's planetary fact sheets (https://nssdc.gsfc.nasa.gov/planetary/factsheet/, read 2026-11-17), the moon counts from JPL's planetary satellite page (read 2026-11-11, the same read as `/moon-catalogue`),
|
|
4
|
+
// the page links to NASA's own page for each body (each fetched 2026-11-17). The descriptions are written here in our own words; no text of NASA's, the IAU's or an encyclopedia's is copied.
|
|
5
|
+
// Pure: no DOM, no clock reads, no three.js.
|
|
6
|
+
import { BODIES } from "./facts.js";
|
|
7
|
+
import { journeyStop } from "./stops.js";
|
|
8
|
+
const KM_PER_MILE = 1.609344;
|
|
9
|
+
const AU_KM = 149_597_870.7;
|
|
10
|
+
/**
|
|
11
|
+
* The bodies that have a fact sheet: the Sun, the eight planets and Pluto.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { FACT_SHEET_IDS } from "@johnmorrisdotca/wakusei-planets/fact-sheets";
|
|
16
|
+
*
|
|
17
|
+
* console.log(FACT_SHEET_IDS.join(", "));
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export const FACT_SHEET_IDS = ["sun", "mercury", "venus", "earth", "mars", "jupiter", "saturn", "uranus", "neptune", "pluto"];
|
|
21
|
+
/**
|
|
22
|
+
* The date the moon counts were read from JPL's planetary satellite page, the same read as `/moon-catalogue`'s `MOON_CATALOGUE_FETCHED`.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { MOONS_READ_ON } from "@johnmorrisdotca/wakusei-planets/fact-sheets";
|
|
27
|
+
*
|
|
28
|
+
* console.log("moon counts read on", MOONS_READ_ON);
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export const MOONS_READ_ON = "2026-11-11";
|
|
32
|
+
// The sidereal year in Earth days, NASA planetary fact sheets (orbital period).
|
|
33
|
+
const YEAR_DAYS = {
|
|
34
|
+
mercury: 87.969,
|
|
35
|
+
venus: 224.701,
|
|
36
|
+
earth: 365.256,
|
|
37
|
+
mars: 686.98,
|
|
38
|
+
jupiter: 4332.589,
|
|
39
|
+
saturn: 10759.22,
|
|
40
|
+
uranus: 30685.4,
|
|
41
|
+
neptune: 60189,
|
|
42
|
+
pluto: 90560,
|
|
43
|
+
};
|
|
44
|
+
// The known moons on MOONS_READ_ON (JPL's planetary satellite page); a test holds these to `/moon-catalogue`.
|
|
45
|
+
const MOONS = { sun: 0, mercury: 0, venus: 0, earth: 1, mars: 2, jupiter: 115, saturn: 293, uranus: 29, neptune: 16, pluto: 5 };
|
|
46
|
+
const NASA = {
|
|
47
|
+
sun: "https://science.nasa.gov/sun/",
|
|
48
|
+
mercury: "https://science.nasa.gov/mercury/",
|
|
49
|
+
venus: "https://science.nasa.gov/venus/",
|
|
50
|
+
earth: "https://science.nasa.gov/earth/",
|
|
51
|
+
mars: "https://science.nasa.gov/mars/",
|
|
52
|
+
jupiter: "https://science.nasa.gov/jupiter/",
|
|
53
|
+
saturn: "https://science.nasa.gov/saturn/",
|
|
54
|
+
uranus: "https://science.nasa.gov/uranus/",
|
|
55
|
+
neptune: "https://science.nasa.gov/neptune/",
|
|
56
|
+
pluto: "https://science.nasa.gov/dwarf-planets/pluto/",
|
|
57
|
+
};
|
|
58
|
+
const DESCRIPTION = {
|
|
59
|
+
sun: {
|
|
60
|
+
en: "The star at the centre of the solar system. It holds almost all of the system's mass and its light and heat keep every planet going.",
|
|
61
|
+
ja: "太陽系の中心にある恒星です。太陽系の質量のほぼすべてを占め、その光と熱がすべての惑星を支えています。",
|
|
62
|
+
},
|
|
63
|
+
mercury: {
|
|
64
|
+
en: "The smallest planet and the nearest to the Sun. It is a dry, cratered rock with almost no air, so its days are scorching and its nights bitterly cold.",
|
|
65
|
+
ja: "いちばん小さく、太陽にいちばん近い惑星です。クレーターだらけの乾いた岩の星で、空気がほとんどないため、昼は灼熱、夜は極寒になります。",
|
|
66
|
+
},
|
|
67
|
+
venus: {
|
|
68
|
+
en: "A rocky planet almost the size of the Earth, wrapped in thick clouds and a heavy carbon dioxide atmosphere that makes it the hottest planet. It turns backwards, very slowly.",
|
|
69
|
+
ja: "地球とほぼ同じ大きさの岩の惑星です。厚い雲と二酸化炭素の濃い大気に包まれ、惑星の中でいちばん高温です。とてもゆっくり、逆向きに自転します。",
|
|
70
|
+
},
|
|
71
|
+
earth: {
|
|
72
|
+
en: "Our home, the only place known to have life. It is the one planet with liquid water on its surface, and it has one large Moon.",
|
|
73
|
+
ja: "私たちの住む星で、生命が確認されている唯一の場所です。表面に液体の水がある唯一の惑星で、大きな衛星を1つ持っています。",
|
|
74
|
+
},
|
|
75
|
+
mars: {
|
|
76
|
+
en: "A cold, dry, rusty-red desert planet with a thin air of carbon dioxide, the tallest volcano known and two small moons. Robots have explored its surface for decades.",
|
|
77
|
+
ja: "二酸化炭素の薄い大気を持つ、冷たく乾いた赤さび色の砂漠の惑星です。知られている中で最も高い火山と、2つの小さな衛星があります。何十年も前からロボットが地表を調べています。",
|
|
78
|
+
},
|
|
79
|
+
jupiter: {
|
|
80
|
+
en: "The largest planet, a giant ball of hydrogen and helium with bands of cloud and a storm bigger than the Earth that has raged for centuries. It has a faint ring and a great many moons.",
|
|
81
|
+
ja: "最大の惑星で、水素とヘリウムでできた巨大なガスの球です。雲の縞模様と、何百年も続く地球より大きな嵐があります。かすかな環と、たくさんの衛星を持っています。",
|
|
82
|
+
},
|
|
83
|
+
saturn: {
|
|
84
|
+
en: "A giant planet of hydrogen and helium, famous for its wide, bright rings of ice. It is light enough that it would float in a big enough bath, and it has more known moons than any other planet.",
|
|
85
|
+
ja: "水素とヘリウムでできた巨大な惑星で、氷でできた広く明るい環で知られています。密度が水より小さく、十分に大きなお風呂があれば浮かぶほどです。知られている衛星の数は惑星の中でいちばん多いです。",
|
|
86
|
+
},
|
|
87
|
+
uranus: {
|
|
88
|
+
en: "A cold blue-green giant that spins on its side, as if rolling round the Sun. Its air of hydrogen, helium and methane gives it its colour, and it has faint rings and many moons.",
|
|
89
|
+
ja: "冷たい青緑色の巨大な惑星で、横倒しになって、転がるように太陽のまわりを回ります。水素、ヘリウム、メタンの大気がその色を生みます。かすかな環と多くの衛星があります。",
|
|
90
|
+
},
|
|
91
|
+
neptune: {
|
|
92
|
+
en: "The farthest planet from the Sun, a deep blue giant with the fastest winds known on any planet. It takes about 165 years to go once round the Sun and has faint rings and many moons.",
|
|
93
|
+
ja: "太陽からいちばん遠い惑星で、濃い青色の巨大な惑星です。知られている中で最も速い風が吹きます。太陽を1周するのに約165年かかり、かすかな環と多くの衛星があります。",
|
|
94
|
+
},
|
|
95
|
+
pluto: {
|
|
96
|
+
en: "A small, icy dwarf planet in the Kuiper belt beyond Neptune, with a heart-shaped bright plain, a thin air that freezes and falls as snow when it moves away from the Sun, and five known moons.",
|
|
97
|
+
ja: "海王星より外側のカイパーベルトにある、小さく氷でできた準惑星です。ハート形の明るい平原があり、薄い大気は太陽から遠ざかると凍って雪になります。知られている衛星は5つです。",
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* The fact sheet of the Sun, a planet or Pluto.
|
|
102
|
+
*
|
|
103
|
+
* @param id - `"sun"`, `"mercury"` to `"neptune"`, or `"pluto"`.
|
|
104
|
+
* @returns The sheet (a new object each call).
|
|
105
|
+
* @throws {RangeError} For an id that has no fact sheet, naming it.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* import { factSheet } from "@johnmorrisdotca/wakusei-planets/fact-sheets";
|
|
110
|
+
*
|
|
111
|
+
* const venus = factSheet("venus");
|
|
112
|
+
* console.log(venus.yearDays, venus.retrograde, venus.description.en);
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export function factSheet(id) {
|
|
116
|
+
if (!FACT_SHEET_IDS.includes(id))
|
|
117
|
+
throw new RangeError(`There is no fact sheet for "${String(id)}"; it has one for ${FACT_SHEET_IDS.join(", ")}.`);
|
|
118
|
+
const facts = BODIES[id];
|
|
119
|
+
const au = id === "sun" ? 0 : journeyStop(id).sunAu;
|
|
120
|
+
const km = (value) => ({ km: value, miles: value / KM_PER_MILE });
|
|
121
|
+
return {
|
|
122
|
+
id,
|
|
123
|
+
name: { ...facts.name },
|
|
124
|
+
kind: facts.kind === "star" ? "star" : facts.kind === "dwarf-planet" ? "dwarf-planet" : "planet",
|
|
125
|
+
radius: km(facts.radiusKm),
|
|
126
|
+
distanceFromSun: { ...km(au * AU_KM), au },
|
|
127
|
+
yearDays: id === "sun" ? null : YEAR_DAYS[id],
|
|
128
|
+
rotationHours: Math.abs(facts.rotationHours),
|
|
129
|
+
retrograde: facts.rotationHours < 0,
|
|
130
|
+
knownMoons: MOONS[id],
|
|
131
|
+
moonsReadOn: MOONS_READ_ON,
|
|
132
|
+
nasaPage: NASA[id],
|
|
133
|
+
description: { ...DESCRIPTION[id] },
|
|
134
|
+
};
|
|
135
|
+
}
|
package/dist/flat/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { FLAT_BODIES, ORBITER_COLOURS, flatBody, isFlatBody, orbiterColour, orbiterName, type FlatBodyId, type FlatBodyInfo } from "./bodies.ts";
|
|
2
2
|
export { MAX_ZOOM, clampView, pixelsPerDegree, projectFlat, unprojectFlat, wrapLongitude, zoomAbout, type FlatView } from "./geometry.ts";
|
|
3
|
+
export { MERCATOR_LIMIT, PROJECTIONS, fitMap, graticule, isProjection, mapExtent, mapOutline, mapPixels, mapSun, projectMap, resampleMap, unprojectMap, type GraticuleLine, type MapCentre, type MapFit, type MapLine, type MapPixels, type ProjectionId } from "./projections.ts";
|
|
3
4
|
export { circleOutline, flatOrbiter, flatSun, flatTrack, hasPath, shadeNight, trackPieces, type FlatOrbiter } from "./scene.ts";
|
|
4
5
|
export { FLAT_WORDS, coordinateText, say, type FlatLang } from "./words.ts";
|
|
5
6
|
export type { FlatPick, WakuseiFlat } from "./element.ts";
|
package/dist/flat/index.js
CHANGED
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
// The element itself is in `@johnmorrisdotca/wakusei-planets/flat/define`, which registers `<wakusei-flat>`.
|
|
3
3
|
export { FLAT_BODIES, ORBITER_COLOURS, flatBody, isFlatBody, orbiterColour, orbiterName } from "./bodies.js";
|
|
4
4
|
export { MAX_ZOOM, clampView, pixelsPerDegree, projectFlat, unprojectFlat, wrapLongitude, zoomAbout } from "./geometry.js";
|
|
5
|
+
export { MERCATOR_LIMIT, PROJECTIONS, fitMap, graticule, isProjection, mapExtent, mapOutline, mapPixels, mapSun, projectMap, resampleMap, unprojectMap } from "./projections.js";
|
|
5
6
|
export { circleOutline, flatOrbiter, flatSun, flatTrack, hasPath, shadeNight, trackPieces } from "./scene.js";
|
|
6
7
|
export { FLAT_WORDS, coordinateText, say } from "./words.js";
|