@johnmorrisdotca/wakusei-planets 0.70.0 → 0.72.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.
@@ -0,0 +1 @@
1
+ export { moonPage, MOON_PAGE_HOSTS, MOON_PAGE_TIME, type MoonPage, type MoonPageHost, type PageCard, type PageMoon } from "./data.ts";
@@ -0,0 +1,2 @@
1
+ // The moon pages' pure side: every number a giant planet's moon pages show, worked out from the package's data. No DOM, no three.js. `<wakusei-moon-pages>` is in ./element.ts.
2
+ export { moonPage, MOON_PAGE_HOSTS, MOON_PAGE_TIME } from "./data.js";
@@ -0,0 +1,115 @@
1
+ /** The words of `<wakusei-moon-pages>`, by language. */
2
+ export declare const MOON_PAGE_WORDS: {
3
+ readonly en: {
4
+ readonly tabs: "Views";
5
+ readonly title: "{planet} and its moons";
6
+ readonly lede: "{total} known moons, {named} of them with a name. {prograde} go round the same way {planet} spins and {retrograde} go the other way. {featured} are drawn in full.";
7
+ readonly tab_orbits: "Orbits";
8
+ readonly tab_views: "Map and portrait";
9
+ readonly tab_cards: "Main moons";
10
+ readonly tab_table: "Every moon";
11
+ readonly view: "Seen from";
12
+ readonly above: "Above";
13
+ readonly tilted: "At an angle";
14
+ readonly side: "The side";
15
+ readonly reach: "Show";
16
+ readonly all: "Every moon";
17
+ readonly inner: "Inner moons";
18
+ readonly colour: "Colour by";
19
+ readonly direction: "Direction";
20
+ readonly family: "Family";
21
+ readonly view_above: "{planet}'s moons seen from above its north pole";
22
+ readonly view_tilted: "{planet}'s moons seen at an angle";
23
+ readonly view_side: "{planet}'s moons seen from the side, level with its equator";
24
+ readonly orbit_caption: "Each line is a moon's orbit on {date}, and each dot is where that moon is on that day. The orbits are to scale; the dots are not.";
25
+ readonly orbits_hint: "Point at an orbit, or tap it, to see whose it is.";
26
+ readonly pick: "{name}: {direction}, {distance} km from {planet}, once round in {period} days.";
27
+ readonly prograde: "Prograde";
28
+ readonly retrograde: "Retrograde";
29
+ readonly plan_caption: "{planet}'s moons drawn in full, from above its north pole, on {date}. Press a moon to mark it.";
30
+ readonly portrait_caption: "{planet} and the moons drawn in full, nearest first. The sizes are squeezed so the small moons can be seen.";
31
+ readonly cards_intro: "The {n} moons this package draws in full, nearest to {planet} first.";
32
+ readonly cards_shaped: "{shaped} of them are drawn with the shape that was measured.";
33
+ readonly card_size: "Diameter";
34
+ readonly card_axes: "Size";
35
+ readonly card_distance: "Distance";
36
+ readonly card_period: "Once round";
37
+ readonly card_found: "Found";
38
+ readonly card_where: "Where";
39
+ readonly card_by: "By";
40
+ readonly days: "{n} days";
41
+ readonly col_name: "Name";
42
+ readonly col_family: "Family";
43
+ readonly col_size: "Diameter (km)";
44
+ readonly col_distance: "Distance (km)";
45
+ readonly col_period: "Period (days)";
46
+ readonly col_year: "Found";
47
+ readonly col_where: "Where";
48
+ readonly col_by: "By";
49
+ readonly col_direction: "Direction";
50
+ readonly table_intro: "{n} moons, sorted by {col}, {order}. Press a column's name to sort by it.";
51
+ readonly up: "lowest first";
52
+ readonly down: "highest first";
53
+ readonly az: "A to Z";
54
+ readonly za: "Z to A";
55
+ readonly table_note: "≈ marks a size worked out from the moon's brightness, not measured. — means no source gives it. The place of discovery is known here only for the moons drawn in full, which are in bold.";
56
+ readonly credits: "Every number on this page is the package's own, worked out when the page was built: the moons, their orbits, sizes and discoveries from NASA/JPL's moon pages and Horizons, read on {fetched}, and the places of discovery from the IAU Gazetteer.";
57
+ readonly short: "{total} moons · {named} named · {retrograde} go the other way";
58
+ };
59
+ readonly ja: {
60
+ readonly tabs: "表示";
61
+ readonly title: "{planet}とその衛星";
62
+ readonly lede: "知られている衛星は{total}個で、そのうち{named}個に名前があります。{prograde}個は{planet}の自転と同じ向きに回り、{retrograde}個は反対向きに回ります。{featured}個はくわしく描いています。";
63
+ readonly tab_orbits: "軌道";
64
+ readonly tab_views: "地図と集合写真";
65
+ readonly tab_cards: "主な衛星";
66
+ readonly tab_table: "衛星の一覧";
67
+ readonly view: "見る向き";
68
+ readonly above: "真上から";
69
+ readonly tilted: "ななめから";
70
+ readonly side: "真横から";
71
+ readonly reach: "見る範囲";
72
+ readonly all: "すべての衛星";
73
+ readonly inner: "内側の衛星";
74
+ readonly colour: "色分け";
75
+ readonly direction: "回る向き";
76
+ readonly family: "グループ";
77
+ readonly view_above: "{planet}の北極の真上から見た衛星";
78
+ readonly view_tilted: "ななめから見た{planet}の衛星";
79
+ readonly view_side: "{planet}の赤道の真横から見た衛星";
80
+ readonly orbit_caption: "線は{date}の各衛星の軌道で、点はその日に衛星がいる場所です。軌道の大きさは実際の比率どおりですが、点の大きさはちがいます。";
81
+ readonly orbits_hint: "軌道を指すかタップすると、どの衛星の軌道かがわかります。";
82
+ readonly pick: "{name}:{direction}。{planet}から{distance} km、{period}日で1周します。";
83
+ readonly prograde: "同じ向き";
84
+ readonly retrograde: "逆向き";
85
+ readonly plan_caption: "{date}に{planet}の北極の真上から見た、くわしく描いている衛星です。衛星を押すと印がつきます。";
86
+ readonly portrait_caption: "{planet}と、くわしく描いている衛星を近い順に並べました。小さな衛星も見えるように、大きさの差は縮めています。";
87
+ readonly cards_intro: "このパッケージがくわしく描く{n}個の衛星を、{planet}に近い順に並べました。";
88
+ readonly cards_shaped: "そのうち{shaped}個は、測定された形で描いています。";
89
+ readonly card_size: "直径";
90
+ readonly card_axes: "大きさ";
91
+ readonly card_distance: "距離";
92
+ readonly card_period: "1周";
93
+ readonly card_found: "発見";
94
+ readonly card_where: "場所";
95
+ readonly card_by: "発見した人";
96
+ readonly days: "{n}日";
97
+ readonly col_name: "名前";
98
+ readonly col_family: "グループ";
99
+ readonly col_size: "直径 (km)";
100
+ readonly col_distance: "距離 (km)";
101
+ readonly col_period: "1周の日数";
102
+ readonly col_year: "発見した年";
103
+ readonly col_where: "発見した場所";
104
+ readonly col_by: "発見した人";
105
+ readonly col_direction: "回る向き";
106
+ readonly table_intro: "{n}個の衛星を「{col}」の{order}に並べています。列の名前を押すと並べかえます。";
107
+ readonly up: "小さい順";
108
+ readonly down: "大きい順";
109
+ readonly az: "名前の順";
110
+ readonly za: "名前の逆の順";
111
+ readonly table_note: "≈ は、測定ではなく衛星の明るさから見積もった大きさです。— は、資料に値がないことを表します。発見した場所は、くわしく描いている衛星(太字)だけにあります。";
112
+ readonly credits: "このページの数字はすべて、ページを作ったときにパッケージのデータから計算したものです。衛星の軌道・大きさ・発見は NASA/JPL の衛星のページと Horizons({fetched}に読み込み)から、発見した場所は IAU 惑星地名辞典からです。";
113
+ readonly short: "衛星{total}個・名前つき{named}個・反対向き{retrograde}個";
114
+ };
115
+ };
@@ -0,0 +1,116 @@
1
+ // The moon pages' own words, in English and Japanese. `{planet}` and the other braces are filled in. Proper names come from the data (the package's Japanese names), never from here.
2
+ /** The words of `<wakusei-moon-pages>`, by language. */
3
+ export const MOON_PAGE_WORDS = {
4
+ en: {
5
+ tabs: "Views",
6
+ title: "{planet} and its moons",
7
+ lede: "{total} known moons, {named} of them with a name. {prograde} go round the same way {planet} spins and {retrograde} go the other way. {featured} are drawn in full.",
8
+ tab_orbits: "Orbits",
9
+ tab_views: "Map and portrait",
10
+ tab_cards: "Main moons",
11
+ tab_table: "Every moon",
12
+ view: "Seen from",
13
+ above: "Above",
14
+ tilted: "At an angle",
15
+ side: "The side",
16
+ reach: "Show",
17
+ all: "Every moon",
18
+ inner: "Inner moons",
19
+ colour: "Colour by",
20
+ direction: "Direction",
21
+ family: "Family",
22
+ view_above: "{planet}'s moons seen from above its north pole",
23
+ view_tilted: "{planet}'s moons seen at an angle",
24
+ view_side: "{planet}'s moons seen from the side, level with its equator",
25
+ orbit_caption: "Each line is a moon's orbit on {date}, and each dot is where that moon is on that day. The orbits are to scale; the dots are not.",
26
+ orbits_hint: "Point at an orbit, or tap it, to see whose it is.",
27
+ pick: "{name}: {direction}, {distance} km from {planet}, once round in {period} days.",
28
+ prograde: "Prograde",
29
+ retrograde: "Retrograde",
30
+ plan_caption: "{planet}'s moons drawn in full, from above its north pole, on {date}. Press a moon to mark it.",
31
+ portrait_caption: "{planet} and the moons drawn in full, nearest first. The sizes are squeezed so the small moons can be seen.",
32
+ cards_intro: "The {n} moons this package draws in full, nearest to {planet} first.",
33
+ cards_shaped: "{shaped} of them are drawn with the shape that was measured.",
34
+ card_size: "Diameter",
35
+ card_axes: "Size",
36
+ card_distance: "Distance",
37
+ card_period: "Once round",
38
+ card_found: "Found",
39
+ card_where: "Where",
40
+ card_by: "By",
41
+ days: "{n} days",
42
+ col_name: "Name",
43
+ col_family: "Family",
44
+ col_size: "Diameter (km)",
45
+ col_distance: "Distance (km)",
46
+ col_period: "Period (days)",
47
+ col_year: "Found",
48
+ col_where: "Where",
49
+ col_by: "By",
50
+ col_direction: "Direction",
51
+ table_intro: "{n} moons, sorted by {col}, {order}. Press a column's name to sort by it.",
52
+ up: "lowest first",
53
+ down: "highest first",
54
+ az: "A to Z",
55
+ za: "Z to A",
56
+ table_note: "≈ marks a size worked out from the moon's brightness, not measured. — means no source gives it. The place of discovery is known here only for the moons drawn in full, which are in bold.",
57
+ credits: "Every number on this page is the package's own, worked out when the page was built: the moons, their orbits, sizes and discoveries from NASA/JPL's moon pages and Horizons, read on {fetched}, and the places of discovery from the IAU Gazetteer.",
58
+ short: "{total} moons · {named} named · {retrograde} go the other way",
59
+ },
60
+ ja: {
61
+ tabs: "表示",
62
+ title: "{planet}とその衛星",
63
+ lede: "知られている衛星は{total}個で、そのうち{named}個に名前があります。{prograde}個は{planet}の自転と同じ向きに回り、{retrograde}個は反対向きに回ります。{featured}個はくわしく描いています。",
64
+ tab_orbits: "軌道",
65
+ tab_views: "地図と集合写真",
66
+ tab_cards: "主な衛星",
67
+ tab_table: "衛星の一覧",
68
+ view: "見る向き",
69
+ above: "真上から",
70
+ tilted: "ななめから",
71
+ side: "真横から",
72
+ reach: "見る範囲",
73
+ all: "すべての衛星",
74
+ inner: "内側の衛星",
75
+ colour: "色分け",
76
+ direction: "回る向き",
77
+ family: "グループ",
78
+ view_above: "{planet}の北極の真上から見た衛星",
79
+ view_tilted: "ななめから見た{planet}の衛星",
80
+ view_side: "{planet}の赤道の真横から見た衛星",
81
+ orbit_caption: "線は{date}の各衛星の軌道で、点はその日に衛星がいる場所です。軌道の大きさは実際の比率どおりですが、点の大きさはちがいます。",
82
+ orbits_hint: "軌道を指すかタップすると、どの衛星の軌道かがわかります。",
83
+ pick: "{name}:{direction}。{planet}から{distance} km、{period}日で1周します。",
84
+ prograde: "同じ向き",
85
+ retrograde: "逆向き",
86
+ plan_caption: "{date}に{planet}の北極の真上から見た、くわしく描いている衛星です。衛星を押すと印がつきます。",
87
+ portrait_caption: "{planet}と、くわしく描いている衛星を近い順に並べました。小さな衛星も見えるように、大きさの差は縮めています。",
88
+ cards_intro: "このパッケージがくわしく描く{n}個の衛星を、{planet}に近い順に並べました。",
89
+ cards_shaped: "そのうち{shaped}個は、測定された形で描いています。",
90
+ card_size: "直径",
91
+ card_axes: "大きさ",
92
+ card_distance: "距離",
93
+ card_period: "1周",
94
+ card_found: "発見",
95
+ card_where: "場所",
96
+ card_by: "発見した人",
97
+ days: "{n}日",
98
+ col_name: "名前",
99
+ col_family: "グループ",
100
+ col_size: "直径 (km)",
101
+ col_distance: "距離 (km)",
102
+ col_period: "1周の日数",
103
+ col_year: "発見した年",
104
+ col_where: "発見した場所",
105
+ col_by: "発見した人",
106
+ col_direction: "回る向き",
107
+ table_intro: "{n}個の衛星を「{col}」の{order}に並べています。列の名前を押すと並べかえます。",
108
+ up: "小さい順",
109
+ down: "大きい順",
110
+ az: "名前の順",
111
+ za: "名前の逆の順",
112
+ table_note: "≈ は、測定ではなく衛星の明るさから見積もった大きさです。— は、資料に値がないことを表します。発見した場所は、くわしく描いている衛星(太字)だけにあります。",
113
+ credits: "このページの数字はすべて、ページを作ったときにパッケージのデータから計算したものです。衛星の軌道・大きさ・発見は NASA/JPL の衛星のページと Horizons({fetched}に読み込み)から、発見した場所は IAU 惑星地名辞典からです。",
114
+ short: "衛星{total}個・名前つき{named}個・反対向き{retrograde}個",
115
+ },
116
+ };
@@ -0,0 +1,57 @@
1
+ /** One irregular body a distance can be measured on: a volume-equivalent mean radius, and the published full extents when the source gives them. */
2
+ export interface PlaceMeanRadius {
3
+ /** The radius of the sphere with the body's measured volume, in kilometres. */
4
+ radiusKm: number;
5
+ /** The published full extents in kilometres, longest first. Absent when the source gives none. */
6
+ axesKm?: readonly [number, number] | readonly [number, number, number];
7
+ /** Where the radius and the extents were read. */
8
+ source: string;
9
+ /** A fact that is not a shape bound. */
10
+ note?: string;
11
+ }
12
+ /**
13
+ * The six place bodies `BODIES` has no radius for. Read 2026-11-19, one request a second, from JPL's Small-Body Database except Dimorphos, which is not in it.
14
+ *
15
+ * Eros: diameter 16.84 ± 0.06 km (Yeomans et al. 2000), extents 34.4 × 11.2 × 11.2 km (Veverka et al. 2000).
16
+ * Ryugu: diameter 0.896 ± 0.004 km, extents 1.004 × 0.876 km, two axes (Watanabe et al. 2019).
17
+ * Bennu: diameter 0.48444 ± 0.00030 km, extents 0.5047 × 0.4918 × 0.4567 km (Daly et al. 2020).
18
+ * Dimorphos: volume-equivalent diameter 151 ± 5 m, extents 177 ± 2 × 174 ± 4 × 116 ± 2 m (Daly et al., Nature 2023). The volume is the shape model's, not an ellipsoid of those extents.
19
+ * Tempel 1: diameter 6.0 ± 0.2 km, extents 7.6 × 4.9 km, two axes, preliminary (A'Hearn et al. 2005).
20
+ * 67P: diameter 3.4 ± 0.1 km (Sierks et al. 2015). No extents.
21
+ */
22
+ export declare const PLACE_MEAN_RADII: {
23
+ readonly eros: {
24
+ readonly radiusKm: 8.42;
25
+ readonly axesKm: readonly [34.4, 11.2, 11.2];
26
+ readonly source: "JPL SBDB: Yeomans et al. 2000; Veverka et al. 2000";
27
+ };
28
+ readonly ryugu: {
29
+ readonly radiusKm: 0.448;
30
+ readonly axesKm: readonly [1.004, 0.876];
31
+ readonly source: "JPL SBDB, Watanabe et al. 2019";
32
+ readonly note: "Two extents only.";
33
+ };
34
+ readonly bennu: {
35
+ readonly radiusKm: 0.24222;
36
+ readonly axesKm: readonly [0.5047, 0.4918, 0.4567];
37
+ readonly source: "JPL SBDB, Daly et al. 2020";
38
+ };
39
+ readonly dimorphos: {
40
+ readonly radiusKm: 0.0755;
41
+ readonly axesKm: readonly [0.177, 0.174, 0.116];
42
+ readonly source: "Daly et al., Nature 2023";
43
+ };
44
+ readonly "tempel-1": {
45
+ readonly radiusKm: 3;
46
+ readonly axesKm: readonly [7.6, 4.9];
47
+ readonly source: "JPL SBDB, A'Hearn et al. 2005";
48
+ readonly note: "The extents are preliminary, and only two.";
49
+ };
50
+ readonly "67p": {
51
+ readonly radiusKm: 1.7;
52
+ readonly source: "JPL SBDB, Sierks et al. 2015";
53
+ readonly note: "The diameter is 3.4 ± 0.1 km, so the mean radius is uncertain by 0.05 km. The nucleus is two lobes, and the source gives no extents.";
54
+ };
55
+ };
56
+ /** Half the spread of the semi-axes, in kilometres. The extents are full lengths. */
57
+ export declare const shapeHalfRangeKm: (axesKm: readonly number[]) => number;
@@ -0,0 +1,24 @@
1
+ // Volume-equivalent mean radii for the place bodies that are not in BODIES. The extents are the published full lengths, two when the source gives two. accuracyKm uses only those extents.
2
+ /**
3
+ * The six place bodies `BODIES` has no radius for. Read 2026-11-19, one request a second, from JPL's Small-Body Database except Dimorphos, which is not in it.
4
+ *
5
+ * Eros: diameter 16.84 ± 0.06 km (Yeomans et al. 2000), extents 34.4 × 11.2 × 11.2 km (Veverka et al. 2000).
6
+ * Ryugu: diameter 0.896 ± 0.004 km, extents 1.004 × 0.876 km, two axes (Watanabe et al. 2019).
7
+ * Bennu: diameter 0.48444 ± 0.00030 km, extents 0.5047 × 0.4918 × 0.4567 km (Daly et al. 2020).
8
+ * Dimorphos: volume-equivalent diameter 151 ± 5 m, extents 177 ± 2 × 174 ± 4 × 116 ± 2 m (Daly et al., Nature 2023). The volume is the shape model's, not an ellipsoid of those extents.
9
+ * Tempel 1: diameter 6.0 ± 0.2 km, extents 7.6 × 4.9 km, two axes, preliminary (A'Hearn et al. 2005).
10
+ * 67P: diameter 3.4 ± 0.1 km (Sierks et al. 2015). No extents.
11
+ */
12
+ export const PLACE_MEAN_RADII = {
13
+ eros: { radiusKm: 8.42, axesKm: [34.4, 11.2, 11.2], source: "JPL SBDB: Yeomans et al. 2000; Veverka et al. 2000" },
14
+ ryugu: { radiusKm: 0.448, axesKm: [1.004, 0.876], source: "JPL SBDB, Watanabe et al. 2019", note: "Two extents only." },
15
+ bennu: { radiusKm: 0.24222, axesKm: [0.5047, 0.4918, 0.4567], source: "JPL SBDB, Daly et al. 2020" },
16
+ dimorphos: { radiusKm: 0.0755, axesKm: [0.177, 0.174, 0.116], source: "Daly et al., Nature 2023" },
17
+ "tempel-1": { radiusKm: 3, axesKm: [7.6, 4.9], source: "JPL SBDB, A'Hearn et al. 2005", note: "The extents are preliminary, and only two." },
18
+ "67p": { radiusKm: 1.7, source: "JPL SBDB, Sierks et al. 2015", note: "The diameter is 3.4 ± 0.1 km, so the mean radius is uncertain by 0.05 km. The nucleus is two lobes, and the source gives no extents." },
19
+ };
20
+ /** Half the spread of the semi-axes, in kilometres. The extents are full lengths. */
21
+ export const shapeHalfRangeKm = (axesKm) => {
22
+ const semis = axesKm.map((km) => km / 2);
23
+ return (Math.max(...semis) - Math.min(...semis)) / 2;
24
+ };
package/dist/places.d.ts CHANGED
@@ -240,9 +240,39 @@ export declare function nearestPlace(places: readonly Place[], lat: number, lon:
240
240
  degrees: number;
241
241
  } | undefined;
242
242
  /**
243
- * The distance over the surface between two places on a body, in kilometres: the great circle on a sphere of the body's equatorial radius from `BODIES` (1737.4 km for the Moon, 3396.19 km for Mars; flattening is not allowed for, which is 0.6 per cent on Mars and nothing on the Moon). A body the package has no radius for (Eros, Ryugu, Bennu, Dimorphos and the two comets: their shapes are not spheres) is a `RangeError`.
243
+ * The distance over the surface between two points, and the shape bound on it.
244
244
  *
245
- * @param body - A body of `PLACE_BODIES` that has a radius in `BODIES`.
245
+ * `km` is the great circle. On a body in `BODIES` the sphere is the equatorial radius (1737.4 km for the Moon, 3396.19 km for Mars; flattening is not allowed for, which is 0.6 per cent on Mars and nothing on the Moon). On Eros, Ryugu, Bennu, Dimorphos, Tempel 1 and 67P the sphere is the volume-equivalent mean radius.
246
+ *
247
+ * `accuracyKm` is the shape bound: the same angle times half the spread of the published semi-axes. It is `null` when no shape bound is stated, which is a sphere in `BODIES`, and 67P (the source gives no extents; the 0.05 km uncertainty of its mean radius is a note, not this bound).
248
+ *
249
+ * @param body - A body of `PLACE_BODIES`.
250
+ * @param a - A place, or a latitude and east longitude.
251
+ * @param b - The other.
252
+ * @returns The kilometres, and the shape bound in kilometres, or `null` when none is stated.
253
+ *
254
+ * @example
255
+ * ```ts
256
+ * import { placeDistance } from "@johnmorrisdotca/wakusei-planets/places";
257
+ *
258
+ * const d = placeDistance("bennu", { lat: 0, lon: 0 }, { lat: 0, lon: 90 });
259
+ * console.log(d.km.toFixed(3), d.accuracyKm?.toFixed(3) ?? "not stated");
260
+ * ```
261
+ */
262
+ export declare function placeDistance(body: PlaceBody, a: Place | {
263
+ lat: number;
264
+ lon: number;
265
+ }, b: Place | {
266
+ lat: number;
267
+ lon: number;
268
+ }): {
269
+ km: number;
270
+ accuracyKm: number | null;
271
+ };
272
+ /**
273
+ * The distance over the surface between two places on a body, in kilometres: `placeDistance(body, a, b).km`.
274
+ *
275
+ * @param body - A body of `PLACE_BODIES`.
246
276
  * @param a - A place, or a latitude and east longitude.
247
277
  * @param b - The other.
248
278
  * @returns Kilometres.
package/dist/places.js CHANGED
@@ -3,6 +3,7 @@
3
3
  // themselves are the entry points `/places/<body>`, so a page pays only for the body it shows.
4
4
  import { apparent } from "./ephemeris.js";
5
5
  import { BODIES } from "./facts.js";
6
+ import { PLACE_MEAN_RADII, shapeHalfRangeKm } from "./place-radii.js";
6
7
  import { cross, dot } from "./vec.js";
7
8
  import { moment } from "./when.js";
8
9
  export { layerOf, MARK_RULES, PLACE_LAYERS, marksToShow, placeMarks, placeRank, pointUnder, readPlaceLayers, readSurfaceNames, spotView, surfacePoint, turnToPlace } from "./place-marks.js";
@@ -211,9 +212,42 @@ export function nearestPlace(places, lat, lon, ...kinds) {
211
212
  return best;
212
213
  }
213
214
  /**
214
- * The distance over the surface between two places on a body, in kilometres: the great circle on a sphere of the body's equatorial radius from `BODIES` (1737.4 km for the Moon, 3396.19 km for Mars; flattening is not allowed for, which is 0.6 per cent on Mars and nothing on the Moon). A body the package has no radius for (Eros, Ryugu, Bennu, Dimorphos and the two comets: their shapes are not spheres) is a `RangeError`.
215
+ * The distance over the surface between two points, and the shape bound on it.
215
216
  *
216
- * @param body - A body of `PLACE_BODIES` that has a radius in `BODIES`.
217
+ * `km` is the great circle. On a body in `BODIES` the sphere is the equatorial radius (1737.4 km for the Moon, 3396.19 km for Mars; flattening is not allowed for, which is 0.6 per cent on Mars and nothing on the Moon). On Eros, Ryugu, Bennu, Dimorphos, Tempel 1 and 67P the sphere is the volume-equivalent mean radius.
218
+ *
219
+ * `accuracyKm` is the shape bound: the same angle times half the spread of the published semi-axes. It is `null` when no shape bound is stated, which is a sphere in `BODIES`, and 67P (the source gives no extents; the 0.05 km uncertainty of its mean radius is a note, not this bound).
220
+ *
221
+ * @param body - A body of `PLACE_BODIES`.
222
+ * @param a - A place, or a latitude and east longitude.
223
+ * @param b - The other.
224
+ * @returns The kilometres, and the shape bound in kilometres, or `null` when none is stated.
225
+ *
226
+ * @example
227
+ * ```ts
228
+ * import { placeDistance } from "@johnmorrisdotca/wakusei-planets/places";
229
+ *
230
+ * const d = placeDistance("bennu", { lat: 0, lon: 0 }, { lat: 0, lon: 90 });
231
+ * console.log(d.km.toFixed(3), d.accuracyKm?.toFixed(3) ?? "not stated");
232
+ * ```
233
+ */
234
+ export function placeDistance(body, a, b) {
235
+ if (!PLACE_BODIES.includes(body))
236
+ throw new RangeError(`places are held for ${PLACE_BODIES.join(", ")}, not "${String(body)}"`);
237
+ const radians = angleBetween(a.lat, a.lon, b.lat, b.lon) * RAD;
238
+ const facts = BODIES[body];
239
+ if (facts !== undefined)
240
+ return { km: radians * facts.radiusKm, accuracyKm: null };
241
+ const mean = PLACE_MEAN_RADII[body];
242
+ if (mean === undefined)
243
+ throw new RangeError(`the package has no radius for ${body}`);
244
+ const accuracyKm = "axesKm" in mean ? radians * shapeHalfRangeKm(mean.axesKm) : null;
245
+ return { km: radians * mean.radiusKm, accuracyKm };
246
+ }
247
+ /**
248
+ * The distance over the surface between two places on a body, in kilometres: `placeDistance(body, a, b).km`.
249
+ *
250
+ * @param body - A body of `PLACE_BODIES`.
217
251
  * @param a - A place, or a latitude and east longitude.
218
252
  * @param b - The other.
219
253
  * @returns Kilometres.
@@ -229,12 +263,7 @@ export function nearestPlace(places, lat, lon, ...kinds) {
229
263
  * ```
230
264
  */
231
265
  export function placeDistanceKm(body, a, b) {
232
- if (!PLACE_BODIES.includes(body))
233
- throw new RangeError(`places are held for ${PLACE_BODIES.join(", ")}, not "${String(body)}"`);
234
- const facts = BODIES[body];
235
- if (facts === undefined)
236
- throw new RangeError(`the package has no radius for ${body}, an irregular body: no distance over a sphere is given`);
237
- return (angleBetween(a.lat, a.lon, b.lat, b.lon) * RAD * facts.radiusKm);
266
+ return placeDistance(body, a, b).km;
238
267
  }
239
268
  /**
240
269
  * The great-circle angle between two points on a sphere, in degrees.
@@ -11,7 +11,7 @@ import { type BodyMapSource } from "../door/map.ts";
11
11
  * console.log(TEXTURE_BASE);
12
12
  * ```
13
13
  */
14
- export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.54.0/dist/textures/";
14
+ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdotca/wakusei-planets@0.72.0/dist/textures/";
15
15
  /**
16
16
  * Where the sharpest surface pictures are: the files of this exact version in the repository, on jsDelivr's GitHub address. The npm package holds only the two smaller widths, so a page that
17
17
  * never zooms in never fetches them. Set `texture-far-base` on an element to serve them yourself.
@@ -23,7 +23,7 @@ export declare const TEXTURE_BASE = "https://cdn.jsdelivr.net/npm/@johnmorrisdot
23
23
  * console.log(TEXTURE_FAR_BASE);
24
24
  * ```
25
25
  */
26
- export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.54.0/textures/";
26
+ export declare const TEXTURE_FAR_BASE = "https://cdn.jsdelivr.net/gh/johnmorrisdotca/wakusei-planets@v0.72.0/textures/";
27
27
  /**
28
28
  * Where the finer map tiles are by default: the demo site's `tiles/` folder (GitHub Pages sends `access-control-allow-origin: *`). The tiles are made by `scripts/make-body-tiles.py` and are in no package and no repository:
29
29
  * a page that serves its own gives the folder in the `tiles` attribute, and `tiles="off"` turns them off. A page that sets `texture-base` (it serves its own pictures) has none unless it says where they are.
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.54.0";
1
+ export declare const VERSION = "0.72.0";
package/dist/version.js CHANGED
@@ -1 +1,2 @@
1
- export const VERSION = "0.54.0";
1
+ // The published package version. Snippets and texture addresses name it. test/version.test.ts keeps it equal to package.json.
2
+ export const VERSION = "0.72.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johnmorrisdotca/wakusei-planets",
3
- "version": "0.70.0",
3
+ "version": "0.72.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",
@@ -95,6 +95,7 @@
95
95
  "./dist/lineup/element.js",
96
96
  "./dist/space/element.js",
97
97
  "./dist/plan/element.js",
98
+ "./dist/moon-pages/element.js",
98
99
  "./dist/flat/define.js",
99
100
  "./dist/flat/system-define.js",
100
101
  "./dist/surface/element.js",
@@ -108,6 +109,7 @@
108
109
  "./src/lineup/element.ts",
109
110
  "./src/space/element.ts",
110
111
  "./src/plan/element.ts",
112
+ "./src/moon-pages/element.ts",
111
113
  "./src/flat/define.ts",
112
114
  "./src/flat/system-define.ts",
113
115
  "./src/surface/element.ts",
@@ -161,6 +163,16 @@
161
163
  "import": "./dist/plan/element.js",
162
164
  "default": "./dist/plan/element.js"
163
165
  },
166
+ "./moon-pages": {
167
+ "types": "./dist/moon-pages/index.d.ts",
168
+ "import": "./dist/moon-pages/index.js",
169
+ "default": "./dist/moon-pages/index.js"
170
+ },
171
+ "./moon-pages/element": {
172
+ "types": "./dist/moon-pages/element.d.ts",
173
+ "import": "./dist/moon-pages/element.js",
174
+ "default": "./dist/moon-pages/element.js"
175
+ },
164
176
  "./flat": {
165
177
  "types": "./dist/flat/index.d.ts",
166
178
  "import": "./dist/flat/index.js",