@johnmorrisdotca/wakusei-planets 0.28.0 → 0.30.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 +17 -0
- package/NOTICE.md +20 -0
- package/README.md +20 -7
- package/dist/embed.d.ts +64 -0
- package/dist/embed.js +66 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/lineup/data.d.ts +160 -0
- package/dist/lineup/data.js +303 -0
- package/dist/lineup/element.d.ts +99 -0
- package/dist/lineup/element.js +782 -0
- package/dist/lineup/labels.d.ts +141 -0
- package/dist/lineup/labels.js +155 -0
- package/dist/lineup/layout.d.ts +174 -0
- package/dist/lineup/layout.js +162 -0
- package/dist/lineup/scene3d.d.ts +47 -0
- package/dist/lineup/scene3d.js +155 -0
- package/dist/portrait/element.d.ts +5 -2
- package/dist/portrait/element.js +57 -6
- package/dist/portrait/scene3d.d.ts +13 -0
- package/dist/portrait/scene3d.js +21 -2
- package/dist/scene/body.d.ts +2 -0
- package/dist/scene/body.js +2 -1
- package/dist/scene/detail.d.ts +8 -2
- package/dist/scene/detail.js +56 -28
- package/dist/scene/painter.d.ts +30 -0
- package/dist/scene/painter.js +93 -9
- package/dist/scene/textures.d.ts +4 -2
- package/dist/scene/textures.js +2 -0
- package/dist/scene/tiles.d.ts +46 -0
- package/dist/scene/tiles.js +165 -19
- package/dist/space/clock.d.ts +31 -0
- package/dist/space/clock.js +45 -0
- package/dist/space/element.d.ts +8 -1
- package/dist/space/element.js +32 -38
- package/dist/space/scene.d.ts +9 -0
- package/dist/space/scene.js +16 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +8 -1
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
// The size line-up's table of radii: every star's radius with its uncertainty, how it was got, and the refereed paper it comes from. Typed here, never read from a catalogue, an infographic or an encyclopedia.
|
|
2
|
+
// A radius is an angular diameter (interferometry, where it exists) times a distance. Where the star has no measured angular diameter, or its distance is not a measured one, the row says so (`basis`).
|
|
3
|
+
// Pure: strings and numbers, no DOM, no three.js. This package never imports hoshi-stars: the stars it needs are typed here.
|
|
4
|
+
import { BODIES } from "../facts.js";
|
|
5
|
+
/** The Sun's nominal radius in kilometres (IAU 2015 Resolution B3), the unit of every radius in the table. */
|
|
6
|
+
export const SUN_RADIUS_KM = 695_700;
|
|
7
|
+
const READ = "2026-11-09";
|
|
8
|
+
/**
|
|
9
|
+
* The stars of the line-up with their radii, smallest first: the Sun, Sirius A, Vega, Arcturus, Aldebaran, Rigel, Antares, Betelgeuse, VY Canis Majoris, WOH G64, UY Scuti and Stephenson 2-18. Each radius comes from a refereed
|
|
10
|
+
* paper that measured the star's angular diameter and used a distance, except where the row's `basis` says otherwise; `NOTICE.md` and the guide list the sources and every disagreement.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* import { LINEUP_STARS } from "@johnmorrisdotca/wakusei-planets";
|
|
15
|
+
*
|
|
16
|
+
* for (const row of LINEUP_STARS) console.log(row.name.en, row.radiusSun, `(-${row.minus} +${row.plus})`, row.cite);
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export const LINEUP_STARS = [
|
|
20
|
+
{
|
|
21
|
+
id: "sun",
|
|
22
|
+
name: { en: "Sun", ja: "太陽" },
|
|
23
|
+
radiusSun: 1,
|
|
24
|
+
minus: 0,
|
|
25
|
+
plus: 0,
|
|
26
|
+
basis: "defined",
|
|
27
|
+
how: "paper",
|
|
28
|
+
method: { en: "The IAU's nominal solar radius, 695,700 km, a defined value.", ja: "IAUが定めた太陽半径の公称値、695,700 km。" },
|
|
29
|
+
cite: "Prša et al. 2016",
|
|
30
|
+
bibcodes: ["2016AJ....152...41P"],
|
|
31
|
+
read: READ,
|
|
32
|
+
look: { temperatureK: 5772, luminosityClass: "V", rotationDays: 25.38 },
|
|
33
|
+
temperatureFrom: "IAU 2015 Resolution B3 nominal effective temperature (Prša et al. 2016)",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "sirius-a",
|
|
37
|
+
name: { en: "Sirius A", ja: "シリウスA" },
|
|
38
|
+
radiusSun: 1.7144,
|
|
39
|
+
minus: 0.009,
|
|
40
|
+
plus: 0.009,
|
|
41
|
+
basis: "angle",
|
|
42
|
+
how: "paper",
|
|
43
|
+
method: { en: "Interferometry with SUSI gave an angular diameter of 6.048 mas (Davis et al. 2011); Bond et al. 2017 turn it into a radius with the star's parallax.", ja: "SUSI干渉計で角直径6.048 mas (Davis ほか 2011)。Bond ほか 2017 が視差から距離を求め、半径に換算しました。" },
|
|
44
|
+
thetaMas: 6.048,
|
|
45
|
+
distancePc: 2.6393,
|
|
46
|
+
cite: "Bond et al. 2017; Davis et al. 2011",
|
|
47
|
+
bibcodes: ["2017ApJ...840...70B", "2011PASA...28...58D"],
|
|
48
|
+
read: READ,
|
|
49
|
+
look: { temperatureK: 9845, luminosityClass: "V" },
|
|
50
|
+
temperatureFrom: "Bond et al. 2017 (the values of Davis et al. 2011 with their parallax)",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: "vega",
|
|
54
|
+
name: { en: "Vega", ja: "ベガ" },
|
|
55
|
+
radiusSun: 2.726,
|
|
56
|
+
minus: 0.006,
|
|
57
|
+
plus: 0.006,
|
|
58
|
+
basis: "angle",
|
|
59
|
+
how: "paper",
|
|
60
|
+
method: { en: "CHARA/MIRC interferometry fits a fast-spinning, flattened star seen almost pole-on: the equatorial radius is 2.726 Suns and the polar one 2.418, so the star is flattened by 0.113.", ja: "CHARA/MIRC干渉計の観測に、ほぼ極の方向から見た、高速で自転してつぶれた星のモデルを当てはめました。赤道半径は太陽の2.726倍、極半径は2.418倍で、扁平率は0.113です。" },
|
|
61
|
+
thetaMas: 3.302,
|
|
62
|
+
cite: "Monnier et al. 2012",
|
|
63
|
+
bibcodes: ["2012ApJ...761L...3M"],
|
|
64
|
+
read: READ,
|
|
65
|
+
look: { temperatureK: 9660, luminosityClass: "V", rotationDays: 0.71, oblateness: 0.113 },
|
|
66
|
+
temperatureFrom: "Monnier et al. 2012 (the apparent temperature of the fit)",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "arcturus",
|
|
70
|
+
name: { en: "Arcturus", ja: "アークトゥルス" },
|
|
71
|
+
radiusSun: 25.4,
|
|
72
|
+
minus: 0.2,
|
|
73
|
+
plus: 0.2,
|
|
74
|
+
basis: "angle",
|
|
75
|
+
how: "paper",
|
|
76
|
+
method: { en: "The limb-darkened angular diameter, 21.06 mas, is the weighted mean of the interferometric measurements; with the star's parallax it gives the radius.", ja: "周縁減光を補正した角直径21.06 masは、干渉計による測定の加重平均です。視差から求めた距離と合わせて半径を出しています。" },
|
|
77
|
+
thetaMas: 21.06,
|
|
78
|
+
cite: "Ramírez and Allende Prieto 2011",
|
|
79
|
+
bibcodes: ["2011ApJ...743..135R"],
|
|
80
|
+
read: READ,
|
|
81
|
+
look: { temperatureK: 4286, luminosityClass: "III" },
|
|
82
|
+
temperatureFrom: "Ramírez and Allende Prieto 2011",
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: "aldebaran",
|
|
86
|
+
name: { en: "Aldebaran", ja: "アルデバラン" },
|
|
87
|
+
radiusSun: 44.2,
|
|
88
|
+
minus: 0.9,
|
|
89
|
+
plus: 0.9,
|
|
90
|
+
basis: "angle",
|
|
91
|
+
how: "paper",
|
|
92
|
+
method: { en: "The mean of lunar-occultation and interferometric diameters, 20.58 mas once limb darkening is allowed for, at the star's parallax distance.", ja: "月による掩蔽と干渉計で測った直径の平均は、周縁減光を補正すると20.58 masです。視差から求めた距離を使って半径にしました。" },
|
|
93
|
+
thetaMas: 20.58,
|
|
94
|
+
cite: "Richichi and Roccatagliata 2005",
|
|
95
|
+
bibcodes: ["2005A&A...433..305R"],
|
|
96
|
+
read: READ,
|
|
97
|
+
look: { temperatureK: 3934, luminosityClass: "III" },
|
|
98
|
+
temperatureFrom: "Richichi and Roccatagliata 2005",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: "rigel",
|
|
102
|
+
name: { en: "Rigel", ja: "リゲル" },
|
|
103
|
+
radiusSun: 78.9,
|
|
104
|
+
minus: 7.4,
|
|
105
|
+
plus: 7.4,
|
|
106
|
+
basis: "angle",
|
|
107
|
+
how: "paper",
|
|
108
|
+
method: { en: "The limb-darkened angular diameter, 2.75 mas (Aufdenberg et al. 2008), at the star's parallax distance; the distance is most of the error.", ja: "周縁減光を補正した角直径2.75 mas (Aufdenberg ほか 2008) に、視差から求めた距離を使って半径を出しました。誤差の大半は距離の不確かさによります。" },
|
|
109
|
+
thetaMas: 2.75,
|
|
110
|
+
cite: "Moravveji et al. 2012",
|
|
111
|
+
bibcodes: ["2012ApJ...747..108M"],
|
|
112
|
+
read: READ,
|
|
113
|
+
look: { temperatureK: 12_100, luminosityClass: "Ia" },
|
|
114
|
+
temperatureFrom: "Przybilla et al. 2010, as listed by Moravveji et al. 2012",
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: "antares",
|
|
118
|
+
name: { en: "Antares", ja: "アンタレス" },
|
|
119
|
+
radiusSun: 680,
|
|
120
|
+
minus: 99,
|
|
121
|
+
plus: 139,
|
|
122
|
+
basis: "angle",
|
|
123
|
+
how: "paper",
|
|
124
|
+
method: { en: "VLTI/AMBER interferometry gave a limb-darkened diameter of 37.38 mas; with the star's parallax the paper gets 680 Suns. The error is worked out here from the 17 percent error of that parallax.", ja: "VLTI/AMBER干渉計で、周縁減光を補正した直径37.38 mas。視差と合わせて、論文は太陽の680倍と出しています。誤差は、その視差の誤差17%からここで計算しました。" },
|
|
125
|
+
thetaMas: 37.38,
|
|
126
|
+
cite: "Ohnaka et al. 2013",
|
|
127
|
+
bibcodes: ["2013A&A...555A..24O"],
|
|
128
|
+
read: READ,
|
|
129
|
+
look: { temperatureK: 3660, luminosityClass: "Iab" },
|
|
130
|
+
temperatureFrom: "Ohnaka et al. 2013",
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
id: "betelgeuse",
|
|
134
|
+
name: { en: "Betelgeuse", ja: "ベテルギウス" },
|
|
135
|
+
radiusSun: 1057,
|
|
136
|
+
minus: 162,
|
|
137
|
+
plus: 228,
|
|
138
|
+
basis: "angle",
|
|
139
|
+
how: "worked-out",
|
|
140
|
+
method: {
|
|
141
|
+
en: "The limb-darkened angular diameter, 44.28 mas (H-band interferometry, Haubois et al. 2009), at the distance of 222 pc (+48, -34) that Harper et al. 2017 get from radio and Hipparcos positions. Worked out here: half the angle times the distance.",
|
|
142
|
+
ja: "周縁減光を補正した角直径44.28 mas (Hバンド干渉計、Haubois ほか 2009) と、Harper ほか 2017 が電波とヒッパルコス衛星の位置から得た距離222 pc (+48, -34)。角直径の半分に距離をかけて、ここで計算しました。",
|
|
143
|
+
},
|
|
144
|
+
thetaMas: 44.28,
|
|
145
|
+
distancePc: 222,
|
|
146
|
+
cite: "Haubois et al. 2009; Harper et al. 2017",
|
|
147
|
+
bibcodes: ["2009A&A...508..923H", "2017AJ....154...11H", "2005ApJ...628..973L"],
|
|
148
|
+
read: READ,
|
|
149
|
+
note: {
|
|
150
|
+
en: "The size is only as good as the distance, which is hard to measure for a star this big. The same angle at the other solution of Harper et al. (190 pc) gives about 905 Suns, and Joyce et al. 2020 get 764 Suns from stellar models and a distance of 168 pc. This line-up uses the measured angle and the paper's nominal distance; a size from models is not a measurement.",
|
|
151
|
+
ja: "大きさは距離しだいですが、これほど大きい星の距離は測りにくいのです。Harper ほかのもう一つの解 (190 pc) だと、同じ角直径で太陽の約905倍、Joyce ほか 2020 は星のモデルと距離168 pcから764倍を出しています。ここでは、測った角直径と、論文が標準とした距離を使います。モデルから出した大きさは測定ではありません。",
|
|
152
|
+
},
|
|
153
|
+
others: [
|
|
154
|
+
{ radiusSun: 905, cite: "the same angle at 190 pc, Harper et al. 2017", why: { en: "their other solution, from the radio positions alone", ja: "電波の位置だけによる、もう一つの解" } },
|
|
155
|
+
{ radiusSun: 764, cite: "Joyce et al. 2020 (ApJ 902, 63)", why: { en: "from stellar models and asteroseismology, not from a measured size", ja: "測った大きさではなく、星のモデルと星震学から" } },
|
|
156
|
+
],
|
|
157
|
+
look: { temperatureK: 3650, luminosityClass: "Iab" },
|
|
158
|
+
temperatureFrom: "Levesque et al. 2005",
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
id: "vy-canis-majoris",
|
|
162
|
+
name: { en: "VY Canis Majoris", ja: "おおいぬ座VY星" },
|
|
163
|
+
radiusSun: 1420,
|
|
164
|
+
minus: 120,
|
|
165
|
+
plus: 120,
|
|
166
|
+
basis: "angle",
|
|
167
|
+
how: "paper",
|
|
168
|
+
method: {
|
|
169
|
+
en: "VLTI/AMBER interferometry gave a Rosseland angular diameter of 11.3 mas (±0.3) at a distance of 1.17 kpc (±0.08), the mean of the radio parallaxes of Choi et al. 2008 and Zhang et al. 2012.",
|
|
170
|
+
ja: "VLTI/AMBER干渉計でロスランド角直径11.3 mas (±0.3)。距離1.17 kpc (±0.08) は、Choi ほか 2008 と Zhang ほか 2012 の電波による視差の平均です。",
|
|
171
|
+
},
|
|
172
|
+
thetaMas: 11.3,
|
|
173
|
+
distancePc: 1170,
|
|
174
|
+
cite: "Wittkowski et al. 2012",
|
|
175
|
+
bibcodes: ["2012A&A...540L..12W", "2012ApJ...744...23Z"],
|
|
176
|
+
read: READ,
|
|
177
|
+
note: {
|
|
178
|
+
en: "Older papers used a distance of 1.5 kpc and drew a larger star. The radio parallaxes brought the distance to about 1.2 kpc and the radius down to about 1,400 Suns.",
|
|
179
|
+
ja: "古い論文は距離を1.5 kpcとして、もっと大きな星だと考えていました。電波による視差で距離が約1.2 kpcになり、半径は太陽の約1,400倍になりました。",
|
|
180
|
+
},
|
|
181
|
+
look: { temperatureK: 3490, luminosityClass: "0" },
|
|
182
|
+
temperatureFrom: "Wittkowski et al. 2012",
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
id: "woh-g64",
|
|
186
|
+
name: { en: "WOH G64", ja: "WOH G64" },
|
|
187
|
+
radiusSun: 1540,
|
|
188
|
+
minus: 77,
|
|
189
|
+
plus: 77,
|
|
190
|
+
basis: "luminosity",
|
|
191
|
+
how: "paper",
|
|
192
|
+
method: {
|
|
193
|
+
en: "No angular diameter of the star itself has been measured. Levesque et al. 2009 fit its spectrum for a temperature of 3,400 K (±25) and take its brightness (log L = 5.45) at the 50 kpc of the Large Magellanic Cloud: 1,540 Suns, an error of 5 percent.",
|
|
194
|
+
ja: "星そのものの角直径は測られていません。Levesque ほか 2009 は、スペクトルから温度3,400 K (±25) を求め、明るさ (log L = 5.45) を大マゼラン雲の距離50 kpcで使って、太陽の1,540倍、誤差5%と出しました。",
|
|
195
|
+
},
|
|
196
|
+
cite: "Levesque et al. 2009",
|
|
197
|
+
bibcodes: ["2009AJ....137.4744L", "2008A&A...484..371O", "2024A&A...691L..15O"],
|
|
198
|
+
read: READ,
|
|
199
|
+
note: {
|
|
200
|
+
en: "Ohnaka et al. 2008 got 1,730 Suns from a model of the dust round it, and the star changed between 2009 and 2016 (Ohnaka et al. 2024), so no single radius is final. The 2 mas image of 2024 is the dust, not the star's disc. The size here is from brightness and temperature: estimated, not measured.",
|
|
201
|
+
ja: "Ohnaka ほか 2008 はまわりのちりのモデルから太陽の1,730倍を出しました。また、この星は2009年から2016年の間に変化しています (Ohnaka ほか 2024)。決まった半径はありません。2024年の2 masの画像は、星の円盤ではなくちりです。ここでの大きさは明るさと温度から求めたもので、測定ではなく推定です。",
|
|
202
|
+
},
|
|
203
|
+
others: [{ radiusSun: 1730, cite: "Ohnaka et al. 2008 (A&A 484, 371)", why: { en: "from a dust-torus model at an assumed temperature of 3,200 K", ja: "温度を3,200 Kと仮定した、ちりのトーラスのモデルから" } }],
|
|
204
|
+
look: { temperatureK: 3400, luminosityClass: "Ia" },
|
|
205
|
+
temperatureFrom: "Levesque et al. 2009",
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
id: "uy-scuti",
|
|
209
|
+
name: { en: "UY Scuti", ja: "たて座UY星" },
|
|
210
|
+
radiusSun: 1708,
|
|
211
|
+
minus: 192,
|
|
212
|
+
plus: 192,
|
|
213
|
+
basis: "weak-distance",
|
|
214
|
+
how: "paper",
|
|
215
|
+
method: {
|
|
216
|
+
en: "VLTI/AMBER interferometry gave a Rosseland angular diameter of 5.48 mas (±0.10). The paper's distance, about 2.9 kpc, is an old estimate and not a parallax, so the radius could be well off.",
|
|
217
|
+
ja: "VLTI/AMBER干渉計でロスランド角直径5.48 mas (±0.10)。論文の距離 (約2.9 kpc) は古い推定で視差ではないので、半径は大きくずれているかもしれません。",
|
|
218
|
+
},
|
|
219
|
+
thetaMas: 5.48,
|
|
220
|
+
cite: "Arroyo-Torres et al. 2013",
|
|
221
|
+
bibcodes: ["2013A&A...554A..76A"],
|
|
222
|
+
read: READ,
|
|
223
|
+
note: {
|
|
224
|
+
en: "Only the angle is measured. At a distance of about 1.8 kpc from Gaia-era work the same angle gives about 1,060 Suns, and Healy et al. 2024 give a revised 909 Suns from photometry and a Gaia distance, not from a measured size. This line-up keeps the measured angle at the distance the measuring paper used, and says the size is uncertain; take 900 to 1,700 Suns as the range.",
|
|
225
|
+
ja: "測ったのは角直径だけです。ガイア時代の距離約1.8 kpcなら、同じ角直径で太陽の約1,060倍になります。Healy ほか 2024 は、測った大きさではなく、測光とガイアの距離から改訂値の909倍を出しています。ここでは、測った角直径と、それを測った論文が使った距離を使い、大きさは不確かだと書きます。太陽の900倍から1,700倍の間と考えてください。",
|
|
226
|
+
},
|
|
227
|
+
others: [
|
|
228
|
+
{ radiusSun: 1060, cite: "the same angle at about 1.8 kpc", why: { en: "worked out here with a Gaia-era distance, which is not copied into this package", ja: "ガイア時代の距離を使った、ここでの計算 (その距離の値はこのパッケージには入れません)" } },
|
|
229
|
+
{ radiusSun: 909, cite: "Healy et al. 2024 (MNRAS 529, 3630)", why: { en: "from photometry and a Gaia distance, not from a measured size", ja: "測った大きさではなく、測光とガイアの距離から" } },
|
|
230
|
+
],
|
|
231
|
+
look: { temperatureK: 3365, luminosityClass: "Ia" },
|
|
232
|
+
temperatureFrom: "Arroyo-Torres et al. 2013",
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
id: "stephenson-2-18",
|
|
236
|
+
name: { en: "Stephenson 2-18", ja: "ステファンソン2-18" },
|
|
237
|
+
radiusSun: 2150,
|
|
238
|
+
minus: 290,
|
|
239
|
+
plus: 710,
|
|
240
|
+
basis: "luminosity",
|
|
241
|
+
how: "worked-out",
|
|
242
|
+
method: {
|
|
243
|
+
en: "No angular diameter has been measured. Fok et al. 2012 fit its dust and get a temperature of 3,200 K and log L = 5.64 at 5.5 kpc (the cluster's kinematic distance, Deguchi et al. 2010). Worked out here by the Stefan-Boltzmann law; the error is from the distance alone (5.83, +1.91 -0.78 kpc, Davies et al. 2007).",
|
|
244
|
+
ja: "角直径は測られていません。Fok ほか 2012 はちりのモデルから温度3,200 Kを求め、星団の運動学的な距離5.5 kpc (Deguchi ほか 2010) で log L = 5.64 としました。半径は、ステファン・ボルツマンの法則を使ってここで計算しました。誤差は距離だけによるものです (5.83 kpc、+1.91 -0.78、Davies ほか 2007)。",
|
|
245
|
+
},
|
|
246
|
+
cite: "Fok et al. 2012",
|
|
247
|
+
bibcodes: ["2012ApJ...760...65F", "2007ApJ...671..781D", "2010PASJ...62..391D"],
|
|
248
|
+
read: READ,
|
|
249
|
+
note: {
|
|
250
|
+
en: "Its distance is a kinematic one, uncertain by about a third, and its temperature comes from a dust model, so this is the least certain size here; it is estimated, not measured. Whether it or another star is the largest depends on those numbers.",
|
|
251
|
+
ja: "距離は運動学的なもので約3分の1の不確かさがあり、温度はちりのモデルから出したものです。ここでいちばん不確かな大きさで、測定ではなく推定です。この星が最大かどうかは、これらの数字しだいです。",
|
|
252
|
+
},
|
|
253
|
+
look: { temperatureK: 3200, luminosityClass: "Ia" },
|
|
254
|
+
temperatureFrom: "Fok et al. 2012 (a dust-shell fit)",
|
|
255
|
+
},
|
|
256
|
+
];
|
|
257
|
+
/** The ordered sets of stars the page and the element offer: the first eight (the Sun and the bright stars), and the Sun with the four largest known. */
|
|
258
|
+
const SETS = {
|
|
259
|
+
bright: ["sun", "sirius-a", "vega", "arcturus", "aldebaran", "rigel", "antares", "betelgeuse"],
|
|
260
|
+
largest: ["sun", "betelgeuse", "vy-canis-majoris", "woh-g64", "uy-scuti", "stephenson-2-18"],
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* The names of the sets of stars: `all` is every star in the table, `bright` the Sun, Sirius A, Vega, Arcturus, Aldebaran, Rigel, Antares and Betelgeuse, and `largest` the Sun beside the largest stars known.
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```ts
|
|
267
|
+
* import { LINEUP_SETS, type LineupSet } from "@johnmorrisdotca/wakusei-planets";
|
|
268
|
+
*
|
|
269
|
+
* const set: LineupSet = LINEUP_SETS[1];
|
|
270
|
+
* console.log(set);
|
|
271
|
+
* ```
|
|
272
|
+
*/
|
|
273
|
+
export const LINEUP_SETS = ["all", "bright", "largest"];
|
|
274
|
+
/** The planets the line-up adds beside the stars: their equatorial radii are the package's own facts (IAU and NASA). */
|
|
275
|
+
const PLANETS = ["earth", "jupiter"];
|
|
276
|
+
/**
|
|
277
|
+
* What the line-up draws for some choices, smallest first: the stars of a set (or the ids of your own list) and, with `planets`, the Earth and Jupiter. The radius of a planet is its equatorial radius from the package's facts.
|
|
278
|
+
* An id that is not in the table throws a `RangeError`.
|
|
279
|
+
*
|
|
280
|
+
* @param options - `set` (`all` by default, or a list of ids from `LINEUP_STARS`) and `planets` (add the Earth and Jupiter).
|
|
281
|
+
* @returns The bodies, ordered by radius.
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```ts
|
|
285
|
+
* import { lineupBodies } from "@johnmorrisdotca/wakusei-planets";
|
|
286
|
+
*
|
|
287
|
+
* console.log(lineupBodies({ set: "bright", planets: true }).map((body) => body.id).join(", "));
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
export function lineupBodies(options = {}) {
|
|
291
|
+
const set = options.set ?? "all";
|
|
292
|
+
const ids = typeof set === "string" ? (set === "all" ? LINEUP_STARS.map((row) => row.id) : [...SETS[set]]) : set;
|
|
293
|
+
const stars = ids.map((id) => {
|
|
294
|
+
const row = LINEUP_STARS.find((one) => one.id === id);
|
|
295
|
+
if (row === undefined)
|
|
296
|
+
throw new RangeError(`no star called ${id} in the line-up: ${LINEUP_STARS.map((one) => one.id).join(", ")}`);
|
|
297
|
+
return { id: row.id, kind: "star", name: row.name, radiusSun: row.radiusSun, radiusKm: row.radiusSun * SUN_RADIUS_KM, minus: row.minus, plus: row.plus, row, flattening: row.look.oblateness ?? 0 };
|
|
298
|
+
});
|
|
299
|
+
const planets = options.planets === true
|
|
300
|
+
? PLANETS.map((id) => ({ id, kind: "planet", name: BODIES[id].name, radiusSun: BODIES[id].radiusKm / SUN_RADIUS_KM, radiusKm: BODIES[id].radiusKm, minus: 0, plus: 0, body: id, flattening: BODIES[id].flattening }))
|
|
301
|
+
: [];
|
|
302
|
+
return [...planets, ...stars].sort((a, b) => a.radiusSun - b.radiusSun);
|
|
303
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { SharedRenderer } from "@johnmorrisdotca/kazoku-ui/renderer";
|
|
2
|
+
import type { ThreeParts } from "../scene/body.ts";
|
|
3
|
+
import { setThreeLoader } from "../scene/shared.ts";
|
|
4
|
+
import { type LineupBody } from "./data.ts";
|
|
5
|
+
import { type LineupView } from "./layout.ts";
|
|
6
|
+
export { setThreeLoader };
|
|
7
|
+
/**
|
|
8
|
+
* What the element is doing: `loading`, `still`, `live`, `lost` or `unavailable` (no WebGL: flat discs are drawn instead).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts no-run
|
|
12
|
+
* import type { LineupState } from "@johnmorrisdotca/wakusei-planets/lineup";
|
|
13
|
+
*
|
|
14
|
+
* const done = (state: LineupState): boolean => state === "live" || state === "unavailable";
|
|
15
|
+
* console.log(done("still"));
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export type LineupState = "loading" | "still" | "live" | "lost" | "unavailable";
|
|
19
|
+
/**
|
|
20
|
+
* The `<wakusei-lineup>` custom element: the size line-up of stars (and, with `planets`, the Earth and Jupiter) at true relative size.
|
|
21
|
+
*
|
|
22
|
+
* Attributes: `stars` (`all`, `bright` or `largest`, or ids from `LINEUP_STARS` separated by commas; `all` by default), `planets` (add the Earth and Jupiter), `layout` (`row` or `stack`), `zoom` (0 to 1, the framed size on a
|
|
23
|
+
* logarithmic scale of radius) or `at` (the id of a body to frame: the Sun by default), `turn` (`off` stops the bodies turning by themselves; they do not under reduced motion unless it is `on`), `look` (`realistic` or `painted`: the
|
|
24
|
+
* planets'), `labels` (`off` hides the words), `controls` (`none` hides the zoom slider), `size` (pixels across), `lang` (`en` or `ja`), `quality` (`full` or `low`), `live` (`always`, `hover` or `off`: when it takes the page's one WebGL
|
|
25
|
+
* context), `texture-base` and `texture-far-base`.
|
|
26
|
+
*
|
|
27
|
+
* A drag on a body turns it (a horizontal swipe on a touch screen); Ctrl, Command or Alt with the wheel zooms; with the element focused the arrow keys go to the next body, + and - zoom a little, Home and End go to the ends,
|
|
28
|
+
* and a double click puts every body back.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts no-run
|
|
32
|
+
* import { WakuseiLineup } from "@johnmorrisdotca/wakusei-planets/lineup";
|
|
33
|
+
*
|
|
34
|
+
* const lineup = document.createElement("wakusei-lineup") as WakuseiLineup;
|
|
35
|
+
* lineup.setAttribute("stars", "bright");
|
|
36
|
+
* lineup.setAttribute("planets", "");
|
|
37
|
+
* document.body.append(lineup);
|
|
38
|
+
* void lineup.zoomTo("betelgeuse");
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare class WakuseiLineup extends HTMLElement {
|
|
42
|
+
#private;
|
|
43
|
+
static observedAttributes: string[];
|
|
44
|
+
/** What the element is doing now. */
|
|
45
|
+
get state(): LineupState;
|
|
46
|
+
/** The zoom now, 0 to 1. Setting it moves the camera at once; `zoomTo` moves it smoothly. */
|
|
47
|
+
get zoom(): number;
|
|
48
|
+
set zoom(value: number);
|
|
49
|
+
/** The body the camera frames now: its id. */
|
|
50
|
+
get focused(): string | undefined;
|
|
51
|
+
/** The bodies drawn, smallest first. */
|
|
52
|
+
get bodies(): readonly LineupBody[];
|
|
53
|
+
/** Numbers for a test or a status line. */
|
|
54
|
+
get stats(): {
|
|
55
|
+
state: LineupState;
|
|
56
|
+
bodies: number;
|
|
57
|
+
drawn: readonly string[];
|
|
58
|
+
renderer: SharedRenderer<ThreeParts>["stats"] | undefined;
|
|
59
|
+
};
|
|
60
|
+
/** Where everything is on the page now: the picture's size in pixels, the camera, and the bodies' centres and radii in pixels. */
|
|
61
|
+
get metrics(): {
|
|
62
|
+
width: number;
|
|
63
|
+
height: number;
|
|
64
|
+
view: LineupView;
|
|
65
|
+
dots: readonly {
|
|
66
|
+
id: string;
|
|
67
|
+
cx: number;
|
|
68
|
+
cy: number;
|
|
69
|
+
r: number;
|
|
70
|
+
}[];
|
|
71
|
+
};
|
|
72
|
+
connectedCallback(): void;
|
|
73
|
+
disconnectedCallback(): void;
|
|
74
|
+
attributeChangedCallback(name: string, before: string | null, after: string | null): void;
|
|
75
|
+
/**
|
|
76
|
+
* Zoom to a body (its id) or to a number from 0 to 1, smoothly: the camera glides there along the logarithmic scale of radius, as fast as a reader can follow, or at once under reduced motion or with `smooth: false`.
|
|
77
|
+
* Resolves when it has arrived (or been interrupted by a hand). An id that is not in the line-up resolves at once and moves nothing.
|
|
78
|
+
*/
|
|
79
|
+
zoomTo(target: string | number, options?: {
|
|
80
|
+
smooth?: boolean;
|
|
81
|
+
}): Promise<void>;
|
|
82
|
+
/** Turn a body by hand, in degrees, as a drag would; both are added to what is there. `pitch` stays within 85 degrees. */
|
|
83
|
+
turnBy(id: string, yaw: number, pitch?: number): void;
|
|
84
|
+
/** Put every body back as it was turned. */
|
|
85
|
+
resetTurns(): void;
|
|
86
|
+
/** Take the page's one WebGL context and draw the line-up on it. Resolves true when it is live. */
|
|
87
|
+
goLive(): Promise<boolean>;
|
|
88
|
+
/** Give the WebGL context back: the picture stays as a still. */
|
|
89
|
+
rest(): void;
|
|
90
|
+
/**
|
|
91
|
+
* The picture as it is now, as an SVG element that stands alone: a dark background, the bodies as a picture (or flat discs when there is no WebGL) and the labels as vector text. It is the same picture that is saved and printed.
|
|
92
|
+
* The element is not in the page; put it in one (out of sight) before saving it, so its styles can be read.
|
|
93
|
+
*/
|
|
94
|
+
picture(): Promise<SVGSVGElement>;
|
|
95
|
+
/** The picture as SVG text. */
|
|
96
|
+
toSvg(): Promise<string>;
|
|
97
|
+
/** The picture as a PNG, `scale` times the size it is on the page (1 to 4). */
|
|
98
|
+
toPng(scale?: number): Promise<Blob>;
|
|
99
|
+
}
|