@johnmorrisdotca/wakusei-planets 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +22 -3
- package/dist/nearest.d.ts +344 -0
- package/dist/nearest.js +399 -0
- package/dist/scene/textures.d.ts +2 -2
- package/dist/sky/engine.d.ts +3 -0
- package/dist/sky/engine.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.23.0] - 2026-11-08
|
|
6
|
+
|
|
7
|
+
- **`/nearest`: what is nearby, and when bodies come close** (MODULES-651). `nearest(target, { count, within, kind, bodies, by, date, observer })` lists the Sun, planets, dwarf planets and moons nearest to a body on a date, by the angle between them in the sky of the Earth's centre, a place on the Earth (the Moon's parallax counts) or another body (`by: "sky"`, exact near 0 and 180 degrees, astrometric as Horizons' RA and DEC are) or by the distance between their centres (`by: "space"`, km and au); `within(target, radius, options)` lists all inside a radius; `closestApproach(a, b, { from, to })` and `conjunctions({ from, to, within, bodies })` scan a span in coarse steps (the fastest body's period over 40, at most 2 days) and narrow each minimum to about a second of time by golden-section search. Every result carries the accuracy to expect from the theories (`uncertaintyArcseconds` or `uncertaintyKm`, and `uncertaintySeconds` for the moment), with the part of the error that two bodies share cancelled. Against JPL Horizons (`test/data/horizons-approach.json`, `scripts/fetch-horizons-approach.py`): the Jupiter-Saturn great conjunction of 2020-12-21 within 270 s and 0.27 arc-second, Venus and Jupiter of 2023-03-02 within 23 s and 0.54, the Moon's nine closest approaches to the planets in December 2026 within 8 s and 1.5 arc-seconds, and the Moon and Venus from Vancouver within 0.9 arc-second; also against a brute-force scan. `distance(a, b, date)` is the straight-line distance of any two bodies in km and au; `distanceRange(a, b, { from, to })` is the least and the greatest distance over a span, each with its moment, found the same way (the greatest on the negated distance): Earth and Mars come to 0.3727 au on 2003-08-27 and go to 2.676 au in 2066, and the guide tabulates every pair of planets for 1900 to 2100 (`scripts/distance-table.ts`); on three pairs against Horizons (`test/data/horizons-distance.json`, `scripts/fetch-horizons-distance.py`) the distances are within 4,000 km, inside the claimed uncertainty. A year's search of the Sun and the planets takes 18 ms (`scripts/bench-nearest.ts`). A separate entry point that nothing else imports. EN/JA guide `docs/guides/nearest.md`.
|
|
8
|
+
|
|
5
9
|
## [0.22.0] - 2026-11-08
|
|
6
10
|
|
|
7
11
|
- **Moons follow published theories, and every planet is measured on 60 dates from 1800 to 2200** (MODULES-528, 511). Io, Europa, Ganymede and Callisto come from L1.2 (Lainey, Duriez and Vienne, IMCCE) and Mimas to Iapetus from TASS1.7 (Vienne and Duriez, IMCCE; the table as Orbiter keeps it, MIT, with its notice in NOTICE.md), as optional entry points `tables/galilean` and `tables/saturn-moons` that `tables` loads and the web component fetches by dynamic import only when it draws Jupiter's or Saturn's moons (its own chunk stays 68 kB gzipped, 68,286 bytes on 0.21.0; `test/lazy-size.test.ts`); on 60 dates Io is 0.11 degree from Horizons (0.19 before), Europa 0.04 (0.15), Ganymede 0.03 (0.36), Callisto 0.014 (0.14), Mimas 1.7 (9.0), Tethys 0.21 (0.61) and Iapetus 0.03 (0.88). The fitted orbits of the other moons now use Horizons for 1800 to 2199 instead of 1950 to 2050 (Phobos 4.0 degrees to 0.4 in 1800, Ariel 1.4 to 0.2, Nereid 13.5 to 4.6). `tables/vsop` is a finer VSOP87B cut (2,581 terms, 32 kB gzipped, not in `tables`): every planet within 2 arc-seconds of Horizons on 60 dates; the default cut stays 13.8 kB and Jupiter and Neptune have their drift from DE441 taken out (Neptune 5.7 to 2.6 arc-seconds). New `test/accuracy-dense.test.ts`, `test/accuracy-fine.test.ts`, `test/moon-theories.test.ts` (the two ports reproduce IMCCE's published check values), `scripts/fetch-horizons-dense.py`, `scripts/compare/dense.mjs`; the accuracy limits only went down. A bundle of every export and optional table is 76,978 bytes gzipped, 11,318 more. GUST86 and ESAPHO/ESADEI are not used: their notice forbids passing on changed files.
|
package/README.md
CHANGED
|
@@ -15,9 +15,9 @@ A clean line drawing, a shaded realistic drawing, or a painted surface map, with
|
|
|
15
15
|
|
|
16
16
|
<p align="center"><a href="https://johnmorrisdotca.github.io/wakusei-planets/"><strong>Open the demo →</strong></a> · <a href="https://johnmorrisdotca.github.io/wakusei-planets/embed.html">Embed page</a> · <a href="https://johnmorrisdotca.github.io/wakusei-planets/docs/">Docs</a></p>
|
|
17
17
|
|
|
18
|
-
<p align="center"><img alt="Jupiter and Saturn drawn in the realistic look, and Saturn as a line drawing" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.
|
|
18
|
+
<p align="center"><img alt="Jupiter and Saturn drawn in the realistic look, and Saturn as a line drawing" src="https://raw.githubusercontent.com/johnmorrisdotca/wakusei-planets/v0.23.0/docs/images/hero-desk.png" width="640"></p>
|
|
19
19
|
|
|
20
|
-
<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.
|
|
20
|
+
<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.23.0/docs/images/lineup-desk.png" width="640"></p>
|
|
21
21
|
|
|
22
22
|
## One minute
|
|
23
23
|
|
|
@@ -279,7 +279,7 @@ A body that turns by itself and a moving sky, in HTML:
|
|
|
279
279
|
|
|
280
280
|
## The portrait builder
|
|
281
281
|
|
|
282
|
-
<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.
|
|
282
|
+
<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.23.0/docs/images/portrait-family.png" width="640"></p>
|
|
283
283
|
|
|
284
284
|
[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.
|
|
285
285
|
|
|
@@ -290,6 +290,23 @@ A body that turns by itself and a moving sky, in HTML:
|
|
|
290
290
|
<wakusei-portrait scene="look:painted~jupiter_0_0_0.3_0~io_0_0_0.1_0"></wakusei-portrait>
|
|
291
291
|
```
|
|
292
292
|
|
|
293
|
+
## What is nearby, and when bodies come close
|
|
294
|
+
|
|
295
|
+
`/nearest` answers "what is next to this?" for the Sun, the planets, the dwarf planets and the moons. `nearest` and `within` list the bodies closest to one on a date, by the angle between them in the sky (of the Earth, a place on it or another body) or by the distance between them in space. `closestApproach` and `conjunctions` search a span of time: coarse steps, then each minimum narrowed to about a second. `distance` and `distanceRange` give two bodies' distance on a date and how near and far they get over a span (Earth and Mars: 0.373 to 2.676 au from 1900 to 2100, the guide has every planet pair). Every result carries the accuracy the theories are held to; against JPL Horizons the great conjunction of 2020 is within 270 s and 0.3 arc-seconds, and the Moon's approaches to the planets within 8 s and 1.5 arc-seconds. [The guide](docs/guides/nearest.md) has the options and the numbers.
|
|
296
|
+
|
|
297
|
+
```ts
|
|
298
|
+
import { closestApproach, distanceRange, nearest } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
299
|
+
|
|
300
|
+
const planets = nearest("moon", { kind: "planet", count: 2, date: Date.UTC(2026, 11, 27, 16) });
|
|
301
|
+
console.log(planets.map((row) => `${row.id} ${row.angle.toFixed(2)} degrees`).join(", "));
|
|
302
|
+
|
|
303
|
+
const great = closestApproach("jupiter", "saturn", { from: Date.UTC(2020, 11, 1), to: Date.UTC(2021, 0, 1) });
|
|
304
|
+
console.log(great.time.toISOString(), great.angle?.toFixed(2), "degrees");
|
|
305
|
+
|
|
306
|
+
const mars = distanceRange("earth", "mars", { from: Date.UTC(1900, 0, 1), to: Date.UTC(2100, 0, 1) });
|
|
307
|
+
console.log(mars.min.distanceAu.toFixed(2), "to", mars.max.distanceAu.toFixed(2), "au");
|
|
308
|
+
```
|
|
309
|
+
|
|
293
310
|
## The space view
|
|
294
311
|
|
|
295
312
|
[The space view](https://johnmorrisdotca.github.io/wakusei-planets/space.html) puts the Earth, the Moon, the Sun and the planets in their places for any date and time, in one WebGL context: the Moon's phase and the Earth's day side come out of the real Sun's light. Zoom from the Earth out to the whole solar system, in a compressed scale (every direction real, the distances squeezed) or the true one, and run time forwards or backwards. Positions come from this package's own models.
|
|
@@ -318,6 +335,7 @@ The reference is a site, made from the source's own doc comments: every export h
|
|
|
318
335
|
| `.../portrait` | `<wakusei-portrait>`: many bodies in one scene. The scene model (`addBody`, `layoutPortrait`, `encodeScene`, `decodeScene`) is in the main entry. |
|
|
319
336
|
| `.../space` | Where the Sun, the Moon and the planets are for a date, in two scales, and where a camera riding along looks: `frameAt`, `createTrack`, `placeSun`, `placeAround`, `ridePose`. No browser. |
|
|
320
337
|
| `.../space/element` | `<wakusei-space>`: the Earth, the Moon, the Sun and the planets in their places. |
|
|
338
|
+
| `.../nearest` | The bodies nearest to a body on a date (`nearest`, `within`), when two bodies come closest (`closestApproach`, `conjunctions`) and how far apart they are (`distance`, `distanceRange`). No browser. |
|
|
321
339
|
| `.../look` | What a body needs to be drawn with three.js. |
|
|
322
340
|
| `.../painter` | The bodies as objects for a scene of your own. |
|
|
323
341
|
| `.../all` | Every body's shaded look, at once. |
|
|
@@ -351,6 +369,7 @@ Each guide has a Japanese twin in [docs/guides/ja](docs/guides/ja/getting-starte
|
|
|
351
369
|
| [In your own three.js scene](docs/guides/in-your-own-scene.md) | `painter.make` |
|
|
352
370
|
| [Time](docs/guides/time.md) | Julian dates, calendars, time scales, sidereal time, Mars time |
|
|
353
371
|
| [The stars you can see without a telescope](docs/guides/stars.md) | 5,080 stars with names, positions, proper motion, distance and colour |
|
|
372
|
+
| [What is nearby, and when bodies come close](docs/guides/nearest.md) | The nearest bodies to a body on a date, closest approaches and conjunctions, and how close they are to Horizons |
|
|
354
373
|
| [Famous spacecraft](docs/guides/spacecraft.md) | Voyager, New Horizons, Pioneer, Cassini, Galileo, Juno, Parker and Webb: where they are and their whole voyage |
|
|
355
374
|
| [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 |
|
|
356
375
|
| [Coordinate conversions](docs/guides/coordinates.md) | Pure spherical, ecliptic, equatorial and horizontal coordinate conversions |
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { type BodyFacts, type BodyId } from "./facts.ts";
|
|
2
|
+
import type { Observer } from "./sky/types.ts";
|
|
3
|
+
import { type When } from "./when.ts";
|
|
4
|
+
/**
|
|
5
|
+
* What kind of body: the Sun is `"star"`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { nearest, type NearestKind } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
10
|
+
*
|
|
11
|
+
* const kind: NearestKind = "planet";
|
|
12
|
+
* console.log(nearest("moon", { kind, count: 1, date: Date.UTC(2026, 10, 8) })[0]?.id);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export type NearestKind = BodyFacts["kind"];
|
|
16
|
+
/**
|
|
17
|
+
* Where the sky is seen from: a body's centre (`"mars"` for the sky of Mars), or a place on the Earth, whose parallax counts (the Moon is up to a degree different from there than from the Earth's centre). The default is the Earth's centre.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* import { nearest, type Viewpoint } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
22
|
+
*
|
|
23
|
+
* const vancouver: Viewpoint = { latitude: 49.28, longitude: -123.12 };
|
|
24
|
+
* console.log(nearest("moon", { observer: vancouver, count: 1, date: Date.UTC(2026, 10, 8) })[0]?.id);
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export type Viewpoint = BodyId | Observer;
|
|
28
|
+
/**
|
|
29
|
+
* The options of `nearest`, `within`, `closestApproach` and `conjunctions` that mean the same in each.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* import { nearest, type NearestOptions } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
34
|
+
*
|
|
35
|
+
* const options: NearestOptions = { count: 3, kind: "planet", date: Date.UTC(2026, 10, 8) };
|
|
36
|
+
* console.log(nearest("moon", options).map((row) => row.id).join(", "));
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export interface NearestOptions {
|
|
40
|
+
/** How many to return. Default 5, or all of those inside `within` when `within` is given. */
|
|
41
|
+
count?: number;
|
|
42
|
+
/** Only those this close: degrees for `by: "sky"`, kilometres for `by: "space"`. */
|
|
43
|
+
within?: number;
|
|
44
|
+
/** Only this kind of body, or any of these kinds. */
|
|
45
|
+
kind?: NearestKind | readonly NearestKind[];
|
|
46
|
+
/** Search only these bodies. Default: every body. */
|
|
47
|
+
bodies?: readonly BodyId[];
|
|
48
|
+
/** `"sky"` (default): the angle between the two in the sky of the observer. `"space"`: the distance between their centres. */
|
|
49
|
+
by?: "sky" | "space";
|
|
50
|
+
/** The moment, a `Date` or milliseconds since 1970 (UTC). Default: now. */
|
|
51
|
+
date?: When;
|
|
52
|
+
/** Where the sky is seen from; ignored by `by: "space"`. Default: the Earth's centre. */
|
|
53
|
+
observer?: Viewpoint;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A body near the target in the sky: its angle from the target in degrees (0 to 180) and how far that angle may be off, in arc-seconds.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* import { nearest, type SkyNeighbour } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
61
|
+
*
|
|
62
|
+
* const next: SkyNeighbour | undefined = nearest("moon", { count: 1, date: Date.UTC(2026, 10, 8) })[0];
|
|
63
|
+
* console.log(next?.id, next?.angle.toFixed(1));
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export interface SkyNeighbour {
|
|
67
|
+
id: BodyId;
|
|
68
|
+
kind: NearestKind;
|
|
69
|
+
/** The angle between the target and this body in the observer's sky, degrees. */
|
|
70
|
+
angle: number;
|
|
71
|
+
/** The accuracy to expect of `angle`, in arc-seconds: the limits the accuracy tests hold the theories to, combined. An expectation, not a bound. */
|
|
72
|
+
uncertaintyArcseconds: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A body near the target in space: the distance between their centres, and how far that may be off.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* import { nearest, type SpaceNeighbour } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
80
|
+
*
|
|
81
|
+
* const next: SpaceNeighbour | undefined = nearest("earth", { by: "space", count: 1, date: Date.UTC(2026, 10, 8) })[0];
|
|
82
|
+
* console.log(next?.id, Math.round(next?.distanceKm ?? 0));
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export interface SpaceNeighbour {
|
|
86
|
+
id: BodyId;
|
|
87
|
+
kind: NearestKind;
|
|
88
|
+
/** The distance between the two centres at the date, kilometres. */
|
|
89
|
+
distanceKm: number;
|
|
90
|
+
/** The same in astronomical units. */
|
|
91
|
+
distanceAu: number;
|
|
92
|
+
/** The accuracy to expect of `distanceKm`, kilometres: the limits the accuracy tests hold the theories to, combined. An expectation, not a bound. */
|
|
93
|
+
uncertaintyKm: number;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The closest two bodies come in a span: the moment of the minimum and the separation then.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts
|
|
100
|
+
* import { closestApproach, type Approach } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
101
|
+
*
|
|
102
|
+
* const found: Approach = closestApproach("jupiter", "saturn", { from: Date.UTC(2020, 11, 1), to: Date.UTC(2021, 0, 1) });
|
|
103
|
+
* console.log(found.time.toISOString(), found.angle?.toFixed(2));
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export interface Approach {
|
|
107
|
+
a: BodyId;
|
|
108
|
+
b: BodyId;
|
|
109
|
+
/** The moment of the minimum, to about a second of time. */
|
|
110
|
+
time: Date;
|
|
111
|
+
/** Degrees, for `by: "sky"`. */
|
|
112
|
+
angle?: number;
|
|
113
|
+
/** The accuracy to expect of `angle`, arc-seconds, for `by: "sky"`. */
|
|
114
|
+
uncertaintyArcseconds?: number;
|
|
115
|
+
/** Kilometres, for `by: "space"`. */
|
|
116
|
+
distanceKm?: number;
|
|
117
|
+
/** Astronomical units, for `by: "space"`. */
|
|
118
|
+
distanceAu?: number;
|
|
119
|
+
/** The accuracy to expect of `distanceKm`, for `by: "space"`. */
|
|
120
|
+
uncertaintyKm?: number;
|
|
121
|
+
/** How far the moment may be off, in seconds: the position's accuracy over how fast the two move past each other. */
|
|
122
|
+
uncertaintySeconds: number;
|
|
123
|
+
/** True when the smallest separation in the span is at its start or end, not a minimum inside it. */
|
|
124
|
+
atEdge: boolean;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Where a search looks, and what counts as close.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```ts
|
|
131
|
+
* import { closestApproach, type ApproachOptions } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
132
|
+
*
|
|
133
|
+
* const options: ApproachOptions = { from: Date.UTC(2023, 1, 20), to: Date.UTC(2023, 2, 10) };
|
|
134
|
+
* console.log(closestApproach("venus", "jupiter", options).time.toISOString());
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
export interface ApproachOptions {
|
|
138
|
+
/** The start of the span, a `Date` or milliseconds since 1970 (UTC). */
|
|
139
|
+
from: When;
|
|
140
|
+
/** The end of the span. */
|
|
141
|
+
to: When;
|
|
142
|
+
/** `"sky"` (default) or `"space"`, as in `nearest`. */
|
|
143
|
+
by?: "sky" | "space";
|
|
144
|
+
/** Where the sky is seen from; ignored by `by: "space"`. Default: the Earth's centre. */
|
|
145
|
+
observer?: Viewpoint;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The options of `conjunctions`.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* import { conjunctions, type ConjunctionOptions } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
153
|
+
*
|
|
154
|
+
* const options: ConjunctionOptions = { from: Date.UTC(2020, 11, 1), to: Date.UTC(2021, 0, 1), bodies: ["jupiter", "saturn"], within: 1 };
|
|
155
|
+
* console.log(conjunctions(options).length);
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
export interface ConjunctionOptions extends ApproachOptions {
|
|
159
|
+
/** Only closest approaches this small: degrees for `by: "sky"` (default 5), kilometres for `by: "space"` (default: all). */
|
|
160
|
+
within?: number;
|
|
161
|
+
/** The bodies to pair up. Default: the Sun and Mercury to Neptune, without the Earth's own place. */
|
|
162
|
+
bodies?: readonly BodyId[];
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The bodies nearest to a body on a date, nearest first: by the angle between them in the sky of an observer, or by the distance between them in space. The Sun, the planets, the dwarf planets and the moons are searched; the target itself, and the body the sky is seen from, are not in the answer.
|
|
166
|
+
*
|
|
167
|
+
* A sky angle is astrometric: the observer's place at the date, each body where it was when its light left (a second and a half for the Moon, hours for Neptune), with no aberration or light bending. It is the angle between two centres, found with an arc tangent so that it is as exact near 0 and 180 degrees as at 90. A distance is the straight line between the two centres at that instant, with no light time. Every result carries the accuracy to expect from the theories (the accuracy guide's limits, combined).
|
|
168
|
+
*
|
|
169
|
+
* @param target - The body to look around.
|
|
170
|
+
* @param options - `count` (default 5; all inside `within` when that is given), `within` (degrees for `by: "sky"`, kilometres for `by: "space"`), `kind`, `bodies` (search only these), `by`, `date` (default now) and `observer` (default the Earth's centre).
|
|
171
|
+
* @returns The bodies, nearest first, as `{ id, kind, angle, uncertaintyArcseconds }` for the sky and `{ id, kind, distanceKm, distanceAu, uncertaintyKm }` for space.
|
|
172
|
+
* @throws RangeError for a target, kind, body, count, radius or observer that is not valid, and for a sky target that is the observer's own body.
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* import { nearest } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
177
|
+
*
|
|
178
|
+
* const date = Date.UTC(2020, 11, 21, 18);
|
|
179
|
+
* console.log(nearest("jupiter", { count: 2, kind: "planet", date }).map((row) => `${row.id} ${row.angle.toFixed(2)}`).join(", "));
|
|
180
|
+
* console.log(nearest("earth", { by: "space", kind: "planet", count: 2, date }).map((row) => `${row.id} ${row.distanceAu.toFixed(2)} au`).join(", "));
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
export declare function nearest(target: BodyId, options: NearestOptions & {
|
|
184
|
+
by: "space";
|
|
185
|
+
}): SpaceNeighbour[];
|
|
186
|
+
export declare function nearest(target: BodyId, options?: NearestOptions & {
|
|
187
|
+
by?: "sky";
|
|
188
|
+
}): SkyNeighbour[];
|
|
189
|
+
export declare function nearest(target: BodyId, options: NearestOptions): SkyNeighbour[] | SpaceNeighbour[];
|
|
190
|
+
/**
|
|
191
|
+
* Every body inside a radius of a body on a date, nearest first: `nearest` with no limit on how many. The radius is degrees for `by: "sky"` and kilometres for `by: "space"`.
|
|
192
|
+
*
|
|
193
|
+
* @param target - The body to look around.
|
|
194
|
+
* @param radius - How close, in degrees (the sky) or kilometres (space).
|
|
195
|
+
* @param options - The same as `nearest`, without `count` and `within`.
|
|
196
|
+
* @returns The bodies inside the radius, nearest first.
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```ts
|
|
200
|
+
* import { within } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
201
|
+
*
|
|
202
|
+
* const date = Date.UTC(2023, 2, 2, 0);
|
|
203
|
+
* console.log(within("venus", 1, { date }).map((row) => `${row.id} ${row.angle.toFixed(2)}`).join(", "));
|
|
204
|
+
* console.log(within("jupiter", 1_000_000, { by: "space", kind: "moon", date }).map((row) => row.id).join(", "));
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
export declare function within(target: BodyId, radius: number, options: Omit<NearestOptions, "count" | "within"> & {
|
|
208
|
+
by: "space";
|
|
209
|
+
}): SpaceNeighbour[];
|
|
210
|
+
export declare function within(target: BodyId, radius: number, options?: Omit<NearestOptions, "count" | "within"> & {
|
|
211
|
+
by?: "sky";
|
|
212
|
+
}): SkyNeighbour[];
|
|
213
|
+
export declare function within(target: BodyId, radius: number, options: Omit<NearestOptions, "count" | "within">): SkyNeighbour[] | SpaceNeighbour[];
|
|
214
|
+
/**
|
|
215
|
+
* When two bodies come closest in a span, and how close: the span is scanned in coarse steps (the fastest body goes round forty times in the step, at most two days), then the smallest minimum is narrowed to about a second of time by golden-section search. If the separation only falls or only rises through the span, the end that is smaller is returned and `atEdge` says so. With `by: "sky"` the separation is the angle in the sky of the observer and a minimum may be an occultation, the angle falling through 0; with `by: "space"` it is the distance between the centres.
|
|
216
|
+
*
|
|
217
|
+
* The result carries `uncertaintyArcseconds` (or `uncertaintyKm`) for the separation, from the accuracy guide's limits, and `uncertaintySeconds` for the moment: that error over how fast the pair moves past each other.
|
|
218
|
+
*
|
|
219
|
+
* @param a - One body.
|
|
220
|
+
* @param b - The other.
|
|
221
|
+
* @param options - `from` and `to` (the span), `by` and `observer` as in `nearest`.
|
|
222
|
+
* @returns The moment, the separation, and the accuracy to expect.
|
|
223
|
+
* @throws RangeError for bodies, a span or an observer that is not valid, or two bodies that are the same, or one of them the observer.
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```ts
|
|
227
|
+
* import { closestApproach } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
228
|
+
*
|
|
229
|
+
* const great = closestApproach("jupiter", "saturn", { from: Date.UTC(2020, 11, 1), to: Date.UTC(2021, 0, 1) });
|
|
230
|
+
* console.log(great.time.toISOString(), great.angle?.toFixed(3), "degrees");
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
export declare function closestApproach(a: BodyId, b: BodyId, options: ApproachOptions): Approach;
|
|
234
|
+
/**
|
|
235
|
+
* The close approaches of every pair of bodies in a span, soonest first: each pair's separation is scanned in coarse steps (the fastest body goes round forty times in the step, at most two days), and every minimum inside the span that is within `within` is narrowed to about a second of time. Each is the same as `closestApproach` would return for that pair and that minimum.
|
|
236
|
+
*
|
|
237
|
+
* @param options - `from` and `to`, `within` (degrees for the sky, default 5; kilometres for space, default all), `bodies` (default the Sun and Mercury to Neptune, less the body the sky is seen from), `by` and `observer`.
|
|
238
|
+
* @returns The approaches, soonest first, each with its moment, separation and the accuracy to expect.
|
|
239
|
+
* @throws RangeError for a span, body or observer that is not valid.
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* ```ts
|
|
243
|
+
* import { conjunctions } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
244
|
+
*
|
|
245
|
+
* const found = conjunctions({ from: Date.UTC(2023, 0, 1), to: Date.UTC(2024, 0, 1), bodies: ["venus", "jupiter"], within: 2 });
|
|
246
|
+
* console.log(found.map((one) => `${one.a}-${one.b} ${one.time.toISOString().slice(0, 10)} ${one.angle?.toFixed(2)}`).join("\n"));
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
export declare function conjunctions(options: ConjunctionOptions): Approach[];
|
|
250
|
+
/**
|
|
251
|
+
* The distance between two bodies at one instant: their centres, in the Sun's frame, with no light time.
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```ts
|
|
255
|
+
* import { distance, type Distance } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
256
|
+
*
|
|
257
|
+
* const found: Distance = distance("earth", "moon", Date.UTC(2026, 10, 8));
|
|
258
|
+
* console.log(Math.round(found.distanceKm), "km");
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
export interface Distance {
|
|
262
|
+
a: BodyId;
|
|
263
|
+
b: BodyId;
|
|
264
|
+
/** The moment, milliseconds since 1970 (UTC). */
|
|
265
|
+
time: number;
|
|
266
|
+
distanceKm: number;
|
|
267
|
+
distanceAu: number;
|
|
268
|
+
/** The accuracy to expect of `distanceKm`, kilometres: the limits the accuracy tests hold the theories to, combined. An expectation, not a bound. */
|
|
269
|
+
uncertaintyKm: number;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* The least or the greatest distance of a pair over a span, and when.
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```ts
|
|
276
|
+
* import { distanceRange, type DistanceAt } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
277
|
+
*
|
|
278
|
+
* const least: DistanceAt = distanceRange("earth", "mars", { from: Date.UTC(2003, 0, 1), to: Date.UTC(2004, 0, 1) }).min;
|
|
279
|
+
* console.log(least.time.toISOString().slice(0, 10), least.distanceAu.toFixed(3));
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
282
|
+
export interface DistanceAt {
|
|
283
|
+
/** The moment, to about a second of time. */
|
|
284
|
+
time: Date;
|
|
285
|
+
distanceKm: number;
|
|
286
|
+
distanceAu: number;
|
|
287
|
+
/** The accuracy to expect of `distanceKm`, kilometres. */
|
|
288
|
+
uncertaintyKm: number;
|
|
289
|
+
/** True when this is the span's start or end, not a turning point inside it. */
|
|
290
|
+
atEdge: boolean;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Where a pair is nearest and farthest over a span.
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```ts
|
|
297
|
+
* import { distanceRange, type DistanceRange } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
298
|
+
*
|
|
299
|
+
* const range: DistanceRange = distanceRange("venus", "earth", { from: Date.UTC(2026, 0, 1), to: Date.UTC(2028, 0, 1) });
|
|
300
|
+
* console.log(range.min.distanceAu.toFixed(2), range.max.distanceAu.toFixed(2));
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
export interface DistanceRange {
|
|
304
|
+
a: BodyId;
|
|
305
|
+
b: BodyId;
|
|
306
|
+
min: DistanceAt;
|
|
307
|
+
max: DistanceAt;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* The distance between two bodies on a date: the straight line between their centres at that instant, in kilometres and astronomical units, with no light time. Any two of the Sun, the planets, the dwarf planets and the moons.
|
|
311
|
+
*
|
|
312
|
+
* @param a - One body.
|
|
313
|
+
* @param b - The other.
|
|
314
|
+
* @param date - The moment, a `Date` or milliseconds since 1970 (UTC). Default: now.
|
|
315
|
+
* @returns The distance and the accuracy to expect of it.
|
|
316
|
+
* @throws RangeError for a body or a date that is not valid, or two bodies that are the same.
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* ```ts
|
|
320
|
+
* import { distance } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
321
|
+
*
|
|
322
|
+
* const mars = distance("earth", "mars", Date.UTC(2003, 7, 27, 9));
|
|
323
|
+
* console.log(mars.distanceAu.toFixed(4), Math.round(mars.distanceKm), "km");
|
|
324
|
+
* ```
|
|
325
|
+
*/
|
|
326
|
+
export declare function distance(a: BodyId, b: BodyId, date?: When): Distance;
|
|
327
|
+
/**
|
|
328
|
+
* The least and the greatest distance between two bodies over a span, each with its moment: the span is scanned in coarse steps (as `closestApproach` does) and each turning point is narrowed to about a second of time by golden-section search, the greatest on the negated distance. If the distance only falls or only rises through the span, the end that is the extreme is returned and `atEdge` says so.
|
|
329
|
+
*
|
|
330
|
+
* @param a - One body.
|
|
331
|
+
* @param b - The other.
|
|
332
|
+
* @param options - `from` and `to`, the span.
|
|
333
|
+
* @returns `min` and `max`, each `{ time, distanceKm, distanceAu, uncertaintyKm, atEdge }`.
|
|
334
|
+
* @throws RangeError for a body or a span that is not valid, or two bodies that are the same.
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* ```ts
|
|
338
|
+
* import { distanceRange } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
339
|
+
*
|
|
340
|
+
* const { min, max } = distanceRange("earth", "mars", { from: Date.UTC(1990, 0, 1), to: Date.UTC(2020, 0, 1) });
|
|
341
|
+
* console.log(min.time.toISOString().slice(0, 10), min.distanceAu.toFixed(3), "to", max.distanceAu.toFixed(3), "au");
|
|
342
|
+
* ```
|
|
343
|
+
*/
|
|
344
|
+
export declare function distanceRange(a: BodyId, b: BodyId, options: Pick<ApproachOptions, "from" | "to">): DistanceRange;
|
package/dist/nearest.js
ADDED
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
// Which bodies are nearest to a body on a date, and when two bodies come closest over a span: for the Sun, the planets, the dwarf planets and the moons, by the angle between them in the sky of an observer
|
|
2
|
+
// or by the distance between them in space. The positions are this package's own (heliocentric, ephemeris.ts): a sky angle is astrometric (the Earth's or the observer's place at the date, the body's place when
|
|
3
|
+
// its light left, no aberration or light bending), a distance is the geometry at one instant. Each result carries the accuracy the theories are held to (docs/guides/accuracy.md). Pure: no DOM, no three.js.
|
|
4
|
+
import { heliocentric, heliocentricModel, meanSunAu, moonVector } from "./ephemeris.js";
|
|
5
|
+
import { julianCenturies } from "./clock.js";
|
|
6
|
+
import { BODIES, BODY_IDS } from "./facts.js";
|
|
7
|
+
import { ORBITS } from "./data/orbits.js";
|
|
8
|
+
import { moonTheoryOf } from "./data/theories.js";
|
|
9
|
+
import { eclipticJ2000ToTrueEquatorialOfDate } from "./sky/frames.js";
|
|
10
|
+
import { observerVector } from "./sky/engine.js";
|
|
11
|
+
import { cross, DEG, length, scale, sub } from "./vec.js";
|
|
12
|
+
import { moment } from "./when.js";
|
|
13
|
+
const AU_KM = 149_597_870.7;
|
|
14
|
+
const LIGHT_SECONDS_PER_AU = 499.004784;
|
|
15
|
+
const DAY_MS = 86_400_000;
|
|
16
|
+
const ARCSECONDS_PER_RADIAN = 206_264.806;
|
|
17
|
+
const KINDS = ["star", "planet", "dwarf-planet", "moon"];
|
|
18
|
+
/** The worst direction error from the Sun in arc-seconds over 60 dates from 1800 to 2200, as the accuracy guide holds each planet to. */
|
|
19
|
+
const PLANET_ARCSECONDS = { mercury: 4.5, venus: 2.6, earth: 4, mars: 6, jupiter: 3.6, saturn: 5.7, uranus: 5, neptune: 3.4, pluto: 0.2 };
|
|
20
|
+
/** The same for a dwarf planet inside its fitted table's years. */
|
|
21
|
+
const DWARF_ARCSECONDS = { ceres: 0.3, orcus: 0.1, haumea: 0.1, quaoar: 0.15, makemake: 0.15, gonggong: 0.1, eris: 0.1, sedna: 0.1 };
|
|
22
|
+
/** A dwarf planet outside its table's years runs on the osculating elements of one epoch, and Pluto outside 1800 to 2200 on JPL's approximate elements. */
|
|
23
|
+
const OSCULATING_ARCSECONDS = 3600;
|
|
24
|
+
const APPROXIMATE_ARCSECONDS = 120;
|
|
25
|
+
/** The worst direction error from the planet in degrees over 60 dates, for the Moon and each moon; a moon the accuracy guide does not measure is given 5 degrees. */
|
|
26
|
+
const MOON_DEGREES = {
|
|
27
|
+
moon: 0.0016, phobos: 0.55, deimos: 0.55, io: 0.15, europa: 0.05, ganymede: 0.03, callisto: 0.02,
|
|
28
|
+
mimas: 2.1, enceladus: 0.72, tethys: 0.27, dione: 0.23, rhea: 0.27, titan: 0.06, iapetus: 0.04,
|
|
29
|
+
miranda: 3, ariel: 0.3, umbriel: 0.28, titania: 0.52, oberon: 0.6,
|
|
30
|
+
triton: 0.17, nereid: 6.3, proteus: 0.17, charon: 0.06, nix: 2.6, hydra: 2.1,
|
|
31
|
+
};
|
|
32
|
+
/** The same for the moons of Jupiter and Saturn when `tables` has not been imported and their fitted orbits answer. */
|
|
33
|
+
const FITTED_MOON_DEGREES = { io: 0.15, europa: 0.18, ganymede: 0.6, callisto: 0.09, mimas: 7.5, enceladus: 0.72, tethys: 0.45, dione: 0.23, rhea: 0.27, titan: 0.08, iapetus: 0.72 };
|
|
34
|
+
const finite = (name, value) => {
|
|
35
|
+
if (typeof value !== "number" || !Number.isFinite(value))
|
|
36
|
+
throw new RangeError(`${name} must be a finite number, got ${String(value)}`);
|
|
37
|
+
return value;
|
|
38
|
+
};
|
|
39
|
+
function bodyOf(name, value) {
|
|
40
|
+
if (typeof value !== "string" || !BODY_IDS.includes(value))
|
|
41
|
+
throw new RangeError(`${name} must be a body such as "mars" or "io", got ${JSON.stringify(value)}`);
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
function byOf(by) {
|
|
45
|
+
if (by === undefined)
|
|
46
|
+
return "sky";
|
|
47
|
+
if (by !== "sky" && by !== "space")
|
|
48
|
+
throw new RangeError(`by must be "sky" or "space", got ${JSON.stringify(by)}`);
|
|
49
|
+
return by;
|
|
50
|
+
}
|
|
51
|
+
function viewOf(observer) {
|
|
52
|
+
if (observer === undefined)
|
|
53
|
+
return { body: "earth" };
|
|
54
|
+
if (typeof observer === "string")
|
|
55
|
+
return { body: bodyOf("observer", observer) };
|
|
56
|
+
if (typeof observer !== "object" || observer === null)
|
|
57
|
+
throw new TypeError(`observer must be a body name or { latitude, longitude }, got ${String(observer)}`);
|
|
58
|
+
const latitude = finite("observer.latitude", observer.latitude);
|
|
59
|
+
const longitude = finite("observer.longitude", observer.longitude);
|
|
60
|
+
if (latitude < -90 || latitude > 90)
|
|
61
|
+
throw new RangeError(`observer.latitude must be between -90 and 90, got ${latitude}`);
|
|
62
|
+
return { body: "earth", place: { latitude, longitude, heightM: observer.heightM === undefined ? 0 : finite("observer.heightM", observer.heightM) } };
|
|
63
|
+
}
|
|
64
|
+
/** A body's centre in the Sun's frame (J2000 ecliptic, au) at an instant. */
|
|
65
|
+
function placeAu(id, ms) {
|
|
66
|
+
if (id === "sun")
|
|
67
|
+
return [0, 0, 0];
|
|
68
|
+
const facts = BODIES[id];
|
|
69
|
+
if (facts.kind !== "moon")
|
|
70
|
+
return heliocentric(id, ms);
|
|
71
|
+
const host = heliocentric(facts.parent ?? "earth", ms);
|
|
72
|
+
const offset = moonVector(id, ms);
|
|
73
|
+
return [host[0] + offset[0] / AU_KM, host[1] + offset[1] / AU_KM, host[2] + offset[2] / AU_KM];
|
|
74
|
+
}
|
|
75
|
+
/** The unit direction to a body and its distance in km from a view at an instant, with the light time allowed for. */
|
|
76
|
+
function sight(view, id, ms) {
|
|
77
|
+
const origin = placeAu(view.body, ms);
|
|
78
|
+
let emit = ms;
|
|
79
|
+
let v = sub(placeAu(id, emit), origin);
|
|
80
|
+
for (let i = 0; i < 2; i += 1) {
|
|
81
|
+
emit = ms - length(v) * LIGHT_SECONDS_PER_AU * 1000;
|
|
82
|
+
v = sub(placeAu(id, emit), origin);
|
|
83
|
+
}
|
|
84
|
+
if (view.place !== undefined) {
|
|
85
|
+
const turned = eclipticJ2000ToTrueEquatorialOfDate(scale(v, AU_KM), julianCenturies(ms));
|
|
86
|
+
const topocentric = sub(turned, observerVector(view.place, ms));
|
|
87
|
+
const km = length(topocentric);
|
|
88
|
+
return { v: scale(topocentric, 1 / km), km };
|
|
89
|
+
}
|
|
90
|
+
const km = length(v) * AU_KM;
|
|
91
|
+
return { v: scale(v, 1 / length(v)), km };
|
|
92
|
+
}
|
|
93
|
+
function sample(by, view, ids, ms) {
|
|
94
|
+
const at = new Map();
|
|
95
|
+
for (const id of ids)
|
|
96
|
+
at.set(id, by === "sky" ? sight(view, id, ms) : { v: placeAu(id, ms), km: 0 });
|
|
97
|
+
return at;
|
|
98
|
+
}
|
|
99
|
+
/** Degrees between two unit directions, or kilometres between two positions in au; atan2 keeps it exact near 0 and 180 degrees. */
|
|
100
|
+
function separation(by, a, b) {
|
|
101
|
+
if (by === "space")
|
|
102
|
+
return length(sub(a.v, b.v)) * AU_KM;
|
|
103
|
+
return Math.atan2(length(cross(a.v, b.v)), a.v[0] * b.v[0] + a.v[1] * b.v[1] + a.v[2] * b.v[2]) * DEG;
|
|
104
|
+
}
|
|
105
|
+
function hostErrorKm(host, ms) {
|
|
106
|
+
const model = heliocentricModel(host, ms);
|
|
107
|
+
const arcseconds = model.theory === "vsop87b" ? PLANET_ARCSECONDS[host] : model.theory === "chebyshev" ? (PLANET_ARCSECONDS[host] ?? DWARF_ARCSECONDS[host]) : model.theory === "osculating-elements" ? OSCULATING_ARCSECONDS : APPROXIMATE_ARCSECONDS;
|
|
108
|
+
return length(heliocentric(host, ms)) * AU_KM * Math.tan(arcseconds / ARCSECONDS_PER_RADIAN);
|
|
109
|
+
}
|
|
110
|
+
/** The independent parts of how far a body's place may be off, kilometres: the planet it goes round (which its moons share) and its own part. */
|
|
111
|
+
function partsOf(id, ms) {
|
|
112
|
+
const parts = new Map();
|
|
113
|
+
if (id === "sun")
|
|
114
|
+
return parts;
|
|
115
|
+
const facts = BODIES[id];
|
|
116
|
+
if (facts.kind !== "moon")
|
|
117
|
+
return parts.set(id, hostErrorKm(id, ms));
|
|
118
|
+
const host = facts.parent ?? "earth";
|
|
119
|
+
const fitted = host === "jupiter" || host === "saturn" ? moonTheoryOf(id) === undefined : false;
|
|
120
|
+
const degrees = (fitted ? FITTED_MOON_DEGREES[id] : undefined) ?? MOON_DEGREES[id] ?? 5;
|
|
121
|
+
parts.set(host, hostErrorKm(host, ms));
|
|
122
|
+
return parts.set(`${id} orbit`, length(moonVector(id, ms)) * Math.tan((degrees * Math.PI) / 180));
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* How far the separation of a and b may be off: each part of the places' errors moves a and b by its size over their distance, in the same direction for a part they share (the planet two moons go round,
|
|
126
|
+
* the Earth's own error seen from the Earth), so a shared part cancels in the difference. The parts add in quadrature; a part is taken as acting across the line of sight, the worst case.
|
|
127
|
+
*/
|
|
128
|
+
function separationError(a, b, from, distanceA, distanceB, ms) {
|
|
129
|
+
const parts = [partsOf(a, ms), partsOf(b, ms), from === undefined ? new Map() : partsOf(from, ms)];
|
|
130
|
+
let sum = 0;
|
|
131
|
+
for (const key of new Set(parts.flatMap((part) => [...part.keys()]))) {
|
|
132
|
+
const size = parts.find((part) => part.has(key)).get(key);
|
|
133
|
+
const onA = (parts[0].has(key) ? 1 : 0) - (parts[2].has(key) ? 1 : 0);
|
|
134
|
+
const onB = (parts[1].has(key) ? 1 : 0) - (parts[2].has(key) ? 1 : 0);
|
|
135
|
+
sum += (size * onA / distanceA - size * onB / distanceB) ** 2;
|
|
136
|
+
}
|
|
137
|
+
return Math.sqrt(sum);
|
|
138
|
+
}
|
|
139
|
+
function skyUncertainty(view, a, b, at, ms) {
|
|
140
|
+
return separationError(a, b, view.body, at.get(a).km, at.get(b).km, ms) * ARCSECONDS_PER_RADIAN;
|
|
141
|
+
}
|
|
142
|
+
function spaceUncertainty(a, b, ms) {
|
|
143
|
+
return separationError(a, b, undefined, 1, 1, ms);
|
|
144
|
+
}
|
|
145
|
+
function kindsOf(kind) {
|
|
146
|
+
if (kind === undefined)
|
|
147
|
+
return undefined;
|
|
148
|
+
const list = typeof kind === "string" ? [kind] : kind;
|
|
149
|
+
for (const one of list)
|
|
150
|
+
if (!KINDS.includes(one))
|
|
151
|
+
throw new RangeError(`kind must be one of ${KINDS.join(", ")}, got ${JSON.stringify(one)}`);
|
|
152
|
+
return list;
|
|
153
|
+
}
|
|
154
|
+
function lookup(target, options, defaultCount) {
|
|
155
|
+
bodyOf("target", target);
|
|
156
|
+
const by = byOf(options.by);
|
|
157
|
+
const view = viewOf(options.observer);
|
|
158
|
+
const ms = options.date === undefined ? Date.now() : moment(options.date, "date");
|
|
159
|
+
const kinds = kindsOf(options.kind);
|
|
160
|
+
const radius = options.within === undefined ? Infinity : finite("within", options.within);
|
|
161
|
+
if (radius < 0)
|
|
162
|
+
throw new RangeError(`within must not be negative, got ${radius}`);
|
|
163
|
+
const count = options.count === undefined ? (options.within === undefined ? defaultCount ?? 5 : Infinity) : finite("count", options.count);
|
|
164
|
+
if (count < 0 || !Number.isInteger(count) && count !== Infinity)
|
|
165
|
+
throw new RangeError(`count must be a whole number of 0 or more, got ${count}`);
|
|
166
|
+
if (by === "sky" && target === view.body)
|
|
167
|
+
throw new RangeError(`target ${target} is where the sky is seen from (the observer), so it is not in that sky`);
|
|
168
|
+
const pool = (options.bodies ?? BODY_IDS).map((id) => bodyOf("bodies", id));
|
|
169
|
+
const ids = pool.filter((id) => id !== target && (by === "space" || id !== view.body) && (kinds === undefined || kinds.includes(BODIES[id].kind)));
|
|
170
|
+
const at = sample(by, view, [target, ...ids], ms);
|
|
171
|
+
const here = at.get(target);
|
|
172
|
+
const rows = ids.map((id) => ({ id, value: separation(by, here, at.get(id)) })).filter((row) => row.value <= radius).sort((a, b) => a.value - b.value).slice(0, count);
|
|
173
|
+
if (by === "sky")
|
|
174
|
+
return rows.map((row) => ({ id: row.id, kind: BODIES[row.id].kind, angle: row.value, uncertaintyArcseconds: skyUncertainty(view, target, row.id, at, ms) }));
|
|
175
|
+
return rows.map((row) => ({ id: row.id, kind: BODIES[row.id].kind, distanceKm: row.value, distanceAu: row.value / AU_KM, uncertaintyKm: spaceUncertainty(target, row.id, ms) }));
|
|
176
|
+
}
|
|
177
|
+
export function nearest(target, options = {}) {
|
|
178
|
+
return lookup(target, options, undefined);
|
|
179
|
+
}
|
|
180
|
+
export function within(target, radius, options = {}) {
|
|
181
|
+
return lookup(target, { ...options, within: radius, count: undefined }, undefined);
|
|
182
|
+
}
|
|
183
|
+
/** Days a body takes to go once round what it goes round (the Earth's own orbit for the Earth). */
|
|
184
|
+
function periodDays(id) {
|
|
185
|
+
if (id === "sun")
|
|
186
|
+
return Infinity;
|
|
187
|
+
const facts = BODIES[id];
|
|
188
|
+
if (facts.kind === "moon")
|
|
189
|
+
return 360 / Math.abs(ORBITS[id]?.sid ?? 1);
|
|
190
|
+
return 365.25 * Math.pow(meanSunAu(id), 1.5);
|
|
191
|
+
}
|
|
192
|
+
/** How far apart to look: the fastest body of the pairs goes round forty times in this many steps, never more than two days. */
|
|
193
|
+
function stepMs(ids, view) {
|
|
194
|
+
const fastest = Math.min(...ids.map(periodDays), periodDays(view.body));
|
|
195
|
+
return Math.max(60_000, Math.min(2 * DAY_MS, (fastest * DAY_MS) / 40));
|
|
196
|
+
}
|
|
197
|
+
const GOLDEN = (Math.sqrt(5) - 1) / 2;
|
|
198
|
+
/** The moment of the smallest value of a function with one minimum in [low, high], to within `tolerance` ms. */
|
|
199
|
+
function golden(f, low, high, tolerance) {
|
|
200
|
+
let a = low;
|
|
201
|
+
let b = high;
|
|
202
|
+
let c = b - GOLDEN * (b - a);
|
|
203
|
+
let d = a + GOLDEN * (b - a);
|
|
204
|
+
let fc = f(c);
|
|
205
|
+
let fd = f(d);
|
|
206
|
+
while (b - a > tolerance) {
|
|
207
|
+
if (fc < fd) {
|
|
208
|
+
b = d;
|
|
209
|
+
d = c;
|
|
210
|
+
fd = fc;
|
|
211
|
+
c = b - GOLDEN * (b - a);
|
|
212
|
+
fc = f(c);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
a = c;
|
|
216
|
+
c = d;
|
|
217
|
+
fc = fd;
|
|
218
|
+
d = a + GOLDEN * (b - a);
|
|
219
|
+
fd = f(d);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return (a + b) / 2;
|
|
223
|
+
}
|
|
224
|
+
function valueAt(by, view, a, b, ms) {
|
|
225
|
+
const at = sample(by, view, [a, b], ms);
|
|
226
|
+
return separation(by, at.get(a), at.get(b));
|
|
227
|
+
}
|
|
228
|
+
/** Every minimum of the separation of each pair inside [from, to] (every maximum, for a sign of -1): a coarse scan, then each bracket narrowed to about a second. */
|
|
229
|
+
function minima(pairs, by, view, from, to, sign = 1) {
|
|
230
|
+
const ids = [...new Set(pairs.flat())];
|
|
231
|
+
const step = stepMs(ids, view);
|
|
232
|
+
const count = Math.ceil((to - from) / step) + 3;
|
|
233
|
+
const times = Array.from({ length: count }, (_, i) => from - step + i * step);
|
|
234
|
+
const values = pairs.map(() => new Float64Array(count));
|
|
235
|
+
times.forEach((ms, i) => {
|
|
236
|
+
const at = sample(by, view, ids, ms);
|
|
237
|
+
pairs.forEach(([a, b], p) => {
|
|
238
|
+
values[p][i] = sign * separation(by, at.get(a), at.get(b));
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
const found = [];
|
|
242
|
+
pairs.forEach(([a, b], p) => {
|
|
243
|
+
const v = values[p];
|
|
244
|
+
for (let i = 1; i < count - 1; i += 1) {
|
|
245
|
+
if (!(v[i] <= v[i - 1] && v[i] < v[i + 1]))
|
|
246
|
+
continue;
|
|
247
|
+
const ms = golden((t) => sign * valueAt(by, view, a, b, t), times[i - 1], times[i + 1], 500);
|
|
248
|
+
if (ms >= from && ms <= to)
|
|
249
|
+
found.push({ a, b, ms, value: valueAt(by, view, a, b, ms) });
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
return found;
|
|
253
|
+
}
|
|
254
|
+
/** The expected accuracy of a separation and of the moment of its minimum. */
|
|
255
|
+
function describe(by, view, a, b, ms, value, atEdge) {
|
|
256
|
+
const at = sample(by, view, [a, b], ms);
|
|
257
|
+
const half = 30_000;
|
|
258
|
+
const before = sample(by, view, [a, b], ms - half);
|
|
259
|
+
const after = sample(by, view, [a, b], ms + half);
|
|
260
|
+
const chord = (s) => sub(s.get(b).v, s.get(a).v);
|
|
261
|
+
const moved = length(sub(chord(after), chord(before))) / (2 * half / 1000);
|
|
262
|
+
const base = { a, b, time: new Date(ms), atEdge };
|
|
263
|
+
if (by === "sky") {
|
|
264
|
+
const uncertaintyArcseconds = skyUncertainty(view, a, b, at, ms);
|
|
265
|
+
return { ...base, angle: value, uncertaintyArcseconds, uncertaintySeconds: moved > 0 ? uncertaintyArcseconds / ARCSECONDS_PER_RADIAN / moved : Infinity };
|
|
266
|
+
}
|
|
267
|
+
const uncertaintyKm = spaceUncertainty(a, b, ms);
|
|
268
|
+
return { ...base, distanceKm: value, distanceAu: value / AU_KM, uncertaintyKm, uncertaintySeconds: moved > 0 ? uncertaintyKm / (moved * AU_KM) : Infinity };
|
|
269
|
+
}
|
|
270
|
+
function span(options) {
|
|
271
|
+
const from = moment(options.from, "from");
|
|
272
|
+
const to = moment(options.to, "to");
|
|
273
|
+
if (to < from)
|
|
274
|
+
throw new RangeError("to must not be before from");
|
|
275
|
+
return { from, to, by: byOf(options.by), view: viewOf(options.observer) };
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* When two bodies come closest in a span, and how close: the span is scanned in coarse steps (the fastest body goes round forty times in the step, at most two days), then the smallest minimum is narrowed to about a second of time by golden-section search. If the separation only falls or only rises through the span, the end that is smaller is returned and `atEdge` says so. With `by: "sky"` the separation is the angle in the sky of the observer and a minimum may be an occultation, the angle falling through 0; with `by: "space"` it is the distance between the centres.
|
|
279
|
+
*
|
|
280
|
+
* The result carries `uncertaintyArcseconds` (or `uncertaintyKm`) for the separation, from the accuracy guide's limits, and `uncertaintySeconds` for the moment: that error over how fast the pair moves past each other.
|
|
281
|
+
*
|
|
282
|
+
* @param a - One body.
|
|
283
|
+
* @param b - The other.
|
|
284
|
+
* @param options - `from` and `to` (the span), `by` and `observer` as in `nearest`.
|
|
285
|
+
* @returns The moment, the separation, and the accuracy to expect.
|
|
286
|
+
* @throws RangeError for bodies, a span or an observer that is not valid, or two bodies that are the same, or one of them the observer.
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* ```ts
|
|
290
|
+
* import { closestApproach } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
291
|
+
*
|
|
292
|
+
* const great = closestApproach("jupiter", "saturn", { from: Date.UTC(2020, 11, 1), to: Date.UTC(2021, 0, 1) });
|
|
293
|
+
* console.log(great.time.toISOString(), great.angle?.toFixed(3), "degrees");
|
|
294
|
+
* ```
|
|
295
|
+
*/
|
|
296
|
+
export function closestApproach(a, b, options) {
|
|
297
|
+
bodyOf("a", a);
|
|
298
|
+
bodyOf("b", b);
|
|
299
|
+
if (a === b)
|
|
300
|
+
throw new RangeError(`a and b must be different bodies, got ${a} twice`);
|
|
301
|
+
const { from, to, by, view } = span(options);
|
|
302
|
+
if (by === "sky" && (a === view.body || b === view.body))
|
|
303
|
+
throw new RangeError(`${a === view.body ? a : b} is where the sky is seen from (the observer), so it is not in that sky`);
|
|
304
|
+
const inside = minima([[a, b]], by, view, from, to);
|
|
305
|
+
const best = inside.sort((x, y) => x.value - y.value)[0];
|
|
306
|
+
const start = valueAt(by, view, a, b, from);
|
|
307
|
+
const end = valueAt(by, view, a, b, to);
|
|
308
|
+
const edge = start <= end ? { ms: from, value: start } : { ms: to, value: end };
|
|
309
|
+
if (best !== undefined && best.value <= edge.value)
|
|
310
|
+
return describe(by, view, a, b, best.ms, best.value, false);
|
|
311
|
+
return describe(by, view, a, b, edge.ms, edge.value, true);
|
|
312
|
+
}
|
|
313
|
+
const DEFAULT_BODIES = ["sun", "mercury", "venus", "earth", "mars", "jupiter", "saturn", "uranus", "neptune"];
|
|
314
|
+
/**
|
|
315
|
+
* The close approaches of every pair of bodies in a span, soonest first: each pair's separation is scanned in coarse steps (the fastest body goes round forty times in the step, at most two days), and every minimum inside the span that is within `within` is narrowed to about a second of time. Each is the same as `closestApproach` would return for that pair and that minimum.
|
|
316
|
+
*
|
|
317
|
+
* @param options - `from` and `to`, `within` (degrees for the sky, default 5; kilometres for space, default all), `bodies` (default the Sun and Mercury to Neptune, less the body the sky is seen from), `by` and `observer`.
|
|
318
|
+
* @returns The approaches, soonest first, each with its moment, separation and the accuracy to expect.
|
|
319
|
+
* @throws RangeError for a span, body or observer that is not valid.
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```ts
|
|
323
|
+
* import { conjunctions } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
324
|
+
*
|
|
325
|
+
* const found = conjunctions({ from: Date.UTC(2023, 0, 1), to: Date.UTC(2024, 0, 1), bodies: ["venus", "jupiter"], within: 2 });
|
|
326
|
+
* console.log(found.map((one) => `${one.a}-${one.b} ${one.time.toISOString().slice(0, 10)} ${one.angle?.toFixed(2)}`).join("\n"));
|
|
327
|
+
* ```
|
|
328
|
+
*/
|
|
329
|
+
export function conjunctions(options) {
|
|
330
|
+
const { from, to, by, view } = span(options);
|
|
331
|
+
const radius = options.within === undefined ? (by === "sky" ? 5 : Infinity) : finite("within", options.within);
|
|
332
|
+
const ids = [...new Set((options.bodies ?? DEFAULT_BODIES).map((id) => bodyOf("bodies", id)))].filter((id) => by === "space" || id !== view.body);
|
|
333
|
+
const pairs = [];
|
|
334
|
+
ids.forEach((a, i) => ids.slice(i + 1).forEach((b) => pairs.push([a, b])));
|
|
335
|
+
if (pairs.length === 0)
|
|
336
|
+
return [];
|
|
337
|
+
return minima(pairs, by, view, from, to)
|
|
338
|
+
.filter((found) => found.value <= radius)
|
|
339
|
+
.sort((x, y) => x.ms - y.ms)
|
|
340
|
+
.map((found) => describe(by, view, found.a, found.b, found.ms, found.value, false));
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* The distance between two bodies on a date: the straight line between their centres at that instant, in kilometres and astronomical units, with no light time. Any two of the Sun, the planets, the dwarf planets and the moons.
|
|
344
|
+
*
|
|
345
|
+
* @param a - One body.
|
|
346
|
+
* @param b - The other.
|
|
347
|
+
* @param date - The moment, a `Date` or milliseconds since 1970 (UTC). Default: now.
|
|
348
|
+
* @returns The distance and the accuracy to expect of it.
|
|
349
|
+
* @throws RangeError for a body or a date that is not valid, or two bodies that are the same.
|
|
350
|
+
*
|
|
351
|
+
* @example
|
|
352
|
+
* ```ts
|
|
353
|
+
* import { distance } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
354
|
+
*
|
|
355
|
+
* const mars = distance("earth", "mars", Date.UTC(2003, 7, 27, 9));
|
|
356
|
+
* console.log(mars.distanceAu.toFixed(4), Math.round(mars.distanceKm), "km");
|
|
357
|
+
* ```
|
|
358
|
+
*/
|
|
359
|
+
export function distance(a, b, date) {
|
|
360
|
+
bodyOf("a", a);
|
|
361
|
+
bodyOf("b", b);
|
|
362
|
+
if (a === b)
|
|
363
|
+
throw new RangeError(`a and b must be different bodies, got ${a} twice`);
|
|
364
|
+
const ms = date === undefined ? Date.now() : moment(date, "date");
|
|
365
|
+
const km = valueAt("space", viewOf(undefined), a, b, ms);
|
|
366
|
+
return { a, b, time: ms, distanceKm: km, distanceAu: km / AU_KM, uncertaintyKm: spaceUncertainty(a, b, ms) };
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* The least and the greatest distance between two bodies over a span, each with its moment: the span is scanned in coarse steps (as `closestApproach` does) and each turning point is narrowed to about a second of time by golden-section search, the greatest on the negated distance. If the distance only falls or only rises through the span, the end that is the extreme is returned and `atEdge` says so.
|
|
370
|
+
*
|
|
371
|
+
* @param a - One body.
|
|
372
|
+
* @param b - The other.
|
|
373
|
+
* @param options - `from` and `to`, the span.
|
|
374
|
+
* @returns `min` and `max`, each `{ time, distanceKm, distanceAu, uncertaintyKm, atEdge }`.
|
|
375
|
+
* @throws RangeError for a body or a span that is not valid, or two bodies that are the same.
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* ```ts
|
|
379
|
+
* import { distanceRange } from "@johnmorrisdotca/wakusei-planets/nearest";
|
|
380
|
+
*
|
|
381
|
+
* const { min, max } = distanceRange("earth", "mars", { from: Date.UTC(1990, 0, 1), to: Date.UTC(2020, 0, 1) });
|
|
382
|
+
* console.log(min.time.toISOString().slice(0, 10), min.distanceAu.toFixed(3), "to", max.distanceAu.toFixed(3), "au");
|
|
383
|
+
* ```
|
|
384
|
+
*/
|
|
385
|
+
export function distanceRange(a, b, options) {
|
|
386
|
+
bodyOf("a", a);
|
|
387
|
+
bodyOf("b", b);
|
|
388
|
+
if (a === b)
|
|
389
|
+
throw new RangeError(`a and b must be different bodies, got ${a} twice`);
|
|
390
|
+
const { from, to, view } = span({ ...options, by: "space" });
|
|
391
|
+
const start = valueAt("space", view, a, b, from);
|
|
392
|
+
const end = valueAt("space", view, a, b, to);
|
|
393
|
+
const pick = (sign) => {
|
|
394
|
+
const candidates = [...minima([[a, b]], "space", view, from, to, sign).map((found) => ({ ms: found.ms, value: found.value, atEdge: false })), { ms: from, value: start, atEdge: true }, { ms: to, value: end, atEdge: true }];
|
|
395
|
+
const best = candidates.sort((x, y) => sign * (x.value - y.value) || Number(x.atEdge) - Number(y.atEdge))[0];
|
|
396
|
+
return { time: new Date(best.ms), distanceKm: best.value, distanceAu: best.value / AU_KM, uncertaintyKm: spaceUncertainty(a, b, best.ms), atEdge: best.atEdge };
|
|
397
|
+
};
|
|
398
|
+
return { a, b, min: pick(1), max: pick(-1) };
|
|
399
|
+
}
|
package/dist/scene/textures.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type * as THREE from "three";
|
|
|
9
9
|
* console.log(TEXTURE_BASE);
|
|
10
10
|
* ```
|
|
11
11
|
*/
|
|
12
|
-
export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.
|
|
12
|
+
export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.23.0/dist/textures/";
|
|
13
13
|
/**
|
|
14
14
|
* 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
|
|
15
15
|
* never zooms in never fetches them. Set `texture-far-base` on an element to serve them yourself.
|
|
@@ -21,7 +21,7 @@ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdot
|
|
|
21
21
|
* console.log(TEXTURE_FAR_BASE);
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.
|
|
24
|
+
export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.23.0/textures/";
|
|
25
25
|
export declare const slash: (base: string) => string;
|
|
26
26
|
export declare function texturePaths(element: Element): {
|
|
27
27
|
textureBase(): string;
|
package/dist/sky/engine.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { greenwichApparentSiderealTime as greenwichSiderealTime } from "../sidereal.ts";
|
|
2
|
+
import type { Vec3 as Vec } from "../vec.ts";
|
|
2
3
|
import type { EquatorialAngles, HorizontalAngles, Observer } from "./types.ts";
|
|
3
4
|
export type { Observer } from "./types.ts";
|
|
4
5
|
/** A body's place on the sky of date, as the Earth's centre sees it (apparent: light time, aberration for the Sun, nutation): angles in degrees, distance in kilometres. */
|
|
@@ -18,6 +19,8 @@ export declare function sunEquatorial(ms: number): Equatorial;
|
|
|
18
19
|
export declare function moonEquatorial(ms: number): Equatorial;
|
|
19
20
|
/** The apparent sidereal time at Greenwich in degrees, from the UTC instant taken as UT1. */
|
|
20
21
|
export { greenwichSiderealTime };
|
|
22
|
+
/** The observer's place from the Earth's centre in the true equator of date, in kilometres, with the turn of the Earth (Meeus ch. 11). */
|
|
23
|
+
export declare function observerVector(observer: Observer, ms: number): Vec;
|
|
21
24
|
/**
|
|
22
25
|
* Altitude, azimuth, hour angle and parallactic angle of a body for an observer: topocentric (parallax taken out of the Earth's centre to the place) and geometric, with no refraction.
|
|
23
26
|
* `ms` is the instant the observer's sky turns for; the body's place `equatorial` is its apparent place at that instant.
|
package/dist/sky/engine.js
CHANGED
|
@@ -45,7 +45,7 @@ export function moonEquatorial(ms) {
|
|
|
45
45
|
/** The apparent sidereal time at Greenwich in degrees, from the UTC instant taken as UT1. */
|
|
46
46
|
export { greenwichSiderealTime };
|
|
47
47
|
/** The observer's place from the Earth's centre in the true equator of date, in kilometres, with the turn of the Earth (Meeus ch. 11). */
|
|
48
|
-
function observerVector(observer, ms) {
|
|
48
|
+
export function observerVector(observer, ms) {
|
|
49
49
|
const lat = observer.latitude * RAD;
|
|
50
50
|
const height = (observer.heightM ?? 0) / 1000;
|
|
51
51
|
const u = Math.atan((1 - EARTH_FLATTENING) * Math.tan(lat));
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.23.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "0.
|
|
1
|
+
export const VERSION = "0.23.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johnmorrisdotca/wakusei-planets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"description": "Wakusei Planets 惑星 — The Sun, planets and moons for the web: each as a clean line drawing, a shaded realistic drawing or a painted surface map, with real sizes, axial tilt and rotation as data, and positions of the moons for any date and time. SVG for the lines, three.js (optional) for the rest.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"planets",
|
|
@@ -69,7 +69,10 @@
|
|
|
69
69
|
"coordinates",
|
|
70
70
|
"spacecraft",
|
|
71
71
|
"voyager",
|
|
72
|
-
"trajectory"
|
|
72
|
+
"trajectory",
|
|
73
|
+
"conjunction",
|
|
74
|
+
"close-approach",
|
|
75
|
+
"nearest"
|
|
73
76
|
],
|
|
74
77
|
"homepage": "https://johnmorrisdotca.github.io/wakusei-planets/",
|
|
75
78
|
"repository": {
|
|
@@ -135,6 +138,11 @@
|
|
|
135
138
|
"import": "./dist/stars.js",
|
|
136
139
|
"default": "./dist/stars.js"
|
|
137
140
|
},
|
|
141
|
+
"./nearest": {
|
|
142
|
+
"types": "./dist/nearest.d.ts",
|
|
143
|
+
"import": "./dist/nearest.js",
|
|
144
|
+
"default": "./dist/nearest.js"
|
|
145
|
+
},
|
|
138
146
|
"./spacecraft": {
|
|
139
147
|
"types": "./dist/spacecraft.d.ts",
|
|
140
148
|
"import": "./dist/spacecraft.js",
|