@motioncomplex/cosmos-lib 1.0.9
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/README.md +125 -0
- package/dist/api.d.ts +246 -0
- package/dist/cache.d.ts +11 -0
- package/dist/clock.d.ts +181 -0
- package/dist/constants.d.ts +43 -0
- package/dist/data/constellations.d.ts +58 -0
- package/dist/data/cutouts.d.ts +70 -0
- package/dist/data/deep-sky.d.ts +27 -0
- package/dist/data/images.d.ts +147 -0
- package/dist/data/index.d.ts +422 -0
- package/dist/data/messier.d.ts +61 -0
- package/dist/data/ps1-files.d.ts +11 -0
- package/dist/data/showers.d.ts +62 -0
- package/dist/data/solar-system.d.ts +34 -0
- package/dist/data/stars.d.ts +57 -0
- package/dist/data/textures.d.ts +67 -0
- package/dist/eclipse.d.ts +176 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +237 -0
- package/dist/index.js +713 -0
- package/dist/math.d.ts +532 -0
- package/dist/media-DVOcIMa1.js +252 -0
- package/dist/media-DlE7RKBL.cjs +1 -0
- package/dist/media.d.ts +217 -0
- package/dist/moon.d.ts +170 -0
- package/dist/planner.d.ts +224 -0
- package/dist/react/index.cjs +1 -0
- package/dist/react/index.d.ts +167 -0
- package/dist/react/index.js +163 -0
- package/dist/skymap-hittest.d.ts +69 -0
- package/dist/skymap-interactive-CLg6FA0X.js +6377 -0
- package/dist/skymap-interactive-D2OZFwJ7.cjs +1 -0
- package/dist/skymap-interactive.d.ts +153 -0
- package/dist/skymap.d.ts +172 -0
- package/dist/sun.d.ts +119 -0
- package/dist/three/factories.d.ts +160 -0
- package/dist/three/flight.d.ts +116 -0
- package/dist/three/index.cjs +20 -0
- package/dist/three/index.d.ts +21 -0
- package/dist/three/index.js +404 -0
- package/dist/three/lod.d.ts +100 -0
- package/dist/three/shaders.d.ts +22 -0
- package/dist/three/types.d.ts +169 -0
- package/dist/transitions.d.ts +246 -0
- package/dist/types.d.ts +730 -0
- package/dist/units.d.ts +132 -0
- package/package.json +93 -0
package/dist/math.d.ts
ADDED
|
@@ -0,0 +1,532 @@
|
|
|
1
|
+
import type { EquatorialCoord, HorizontalCoord, GalacticCoord, EclipticCoord, ObserverParams, PlanetName, PlanetPosition, NutationResult, RiseTransitSet } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Core coordinate-transformation and ephemeris math module for cosmos-lib.
|
|
4
|
+
*
|
|
5
|
+
* Provides functions for time conversions, coordinate transforms (equatorial,
|
|
6
|
+
* horizontal, ecliptic, galactic), angular separation, photometry, Keplerian
|
|
7
|
+
* orbit solving, planetary ephemerides, precession, nutation, atmospheric
|
|
8
|
+
* refraction, proper motion, and rise/transit/set calculations.
|
|
9
|
+
*
|
|
10
|
+
* All angular inputs and outputs are in **degrees** unless explicitly noted
|
|
11
|
+
* otherwise (e.g. Kepler solver uses radians internally).
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* Many algorithms are drawn from Jean Meeus, "Astronomical Algorithms" (2nd ed., Willmann-Bell, 1998).
|
|
15
|
+
* Orbital elements come from JPL (Standish 1992). The IAU 1980 nutation series and
|
|
16
|
+
* Lieske (1979) precession polynomials are used where noted.
|
|
17
|
+
*/
|
|
18
|
+
export declare const AstroMath: {
|
|
19
|
+
/**
|
|
20
|
+
* Convert a JavaScript Date to a Julian Date number.
|
|
21
|
+
*
|
|
22
|
+
* The Julian Date is a continuous count of days since the beginning of the
|
|
23
|
+
* Julian period (January 1, 4713 BC, 12:00 TT).
|
|
24
|
+
*
|
|
25
|
+
* @param date - The JavaScript Date to convert. Defaults to the current date/time.
|
|
26
|
+
* @returns The Julian Date as a floating-point number.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* // J2000.0 epoch: 2000-01-01T12:00:00Z
|
|
31
|
+
* AstroMath.toJulian(new Date('2000-01-01T12:00:00Z'))
|
|
32
|
+
* // => 2451545.0
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
readonly toJulian: (date?: Date) => number;
|
|
36
|
+
/**
|
|
37
|
+
* Convert a Julian Date number back to a JavaScript Date.
|
|
38
|
+
*
|
|
39
|
+
* @param jd - The Julian Date to convert.
|
|
40
|
+
* @returns A JavaScript Date representing the same instant.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* AstroMath.fromJulian(2451545.0)
|
|
45
|
+
* // => Date('2000-01-01T12:00:00.000Z')
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
readonly fromJulian: (jd: number) => Date;
|
|
49
|
+
/**
|
|
50
|
+
* Compute the number of days elapsed since the J2000.0 epoch
|
|
51
|
+
* (2000-01-01T12:00:00 TT, JD 2451545.0).
|
|
52
|
+
*
|
|
53
|
+
* @param date - The observation date. Defaults to the current date/time.
|
|
54
|
+
* @returns Fractional days since J2000.0 (negative for dates before the epoch).
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* // One Julian century after J2000.0
|
|
59
|
+
* AstroMath.j2000Days(new Date('2100-01-01T12:00:00Z'))
|
|
60
|
+
* // => ~36525.0
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
readonly j2000Days: (date?: Date) => number;
|
|
64
|
+
/**
|
|
65
|
+
* Greenwich Mean Sidereal Time (GMST) in degrees.
|
|
66
|
+
*
|
|
67
|
+
* Accurate to ~0.1 s over several centuries around J2000.
|
|
68
|
+
*
|
|
69
|
+
* @param date - The observation date. Defaults to the current date/time.
|
|
70
|
+
* @returns GMST in degrees, normalised to the range [0, 360).
|
|
71
|
+
*
|
|
72
|
+
* @remarks
|
|
73
|
+
* Uses the linear approximation from Meeus, "Astronomical Algorithms", Chapter 12.
|
|
74
|
+
* For higher accuracy near the current epoch, see {@link gast} which includes
|
|
75
|
+
* the nutation correction (equation of the equinoxes).
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* // GMST at J2000.0 epoch
|
|
80
|
+
* AstroMath.gmst(new Date('2000-01-01T12:00:00Z'))
|
|
81
|
+
* // => 280.46061837
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
readonly gmst: (date?: Date) => number;
|
|
85
|
+
/**
|
|
86
|
+
* Local Sidereal Time (LST) in degrees.
|
|
87
|
+
*
|
|
88
|
+
* LST equals GMST plus the observer's geographic longitude.
|
|
89
|
+
*
|
|
90
|
+
* @param date - The observation date/time.
|
|
91
|
+
* @param longitudeDeg - Observer's geographic longitude in degrees (east positive, west negative).
|
|
92
|
+
* @returns LST in degrees, normalised to the range [0, 360).
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* // LST for an observer in London (lng = -0.1) at J2000.0
|
|
97
|
+
* AstroMath.lst(new Date('2000-01-01T12:00:00Z'), -0.1)
|
|
98
|
+
* // => ~280.36
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
readonly lst: (date: Date, longitudeDeg: number) => number;
|
|
102
|
+
/**
|
|
103
|
+
* Convert equatorial coordinates (RA/Dec) to horizontal coordinates (Altitude/Azimuth).
|
|
104
|
+
*
|
|
105
|
+
* Azimuth is measured from North (0) through East (90), South (180), West (270).
|
|
106
|
+
* All angles are in degrees.
|
|
107
|
+
*
|
|
108
|
+
* @param eq - Equatorial coordinates with `ra` (right ascension) and `dec` (declination) in degrees.
|
|
109
|
+
* @param obs - Observer parameters including `lat` (latitude), `lng` (longitude), and optional `date`.
|
|
110
|
+
* @returns Horizontal coordinates with `alt` (altitude) and `az` (azimuth) in degrees.
|
|
111
|
+
*
|
|
112
|
+
* @remarks
|
|
113
|
+
* Based on the standard spherical-trigonometry transformation.
|
|
114
|
+
* See Meeus, "Astronomical Algorithms", Chapter 13.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```ts
|
|
118
|
+
* // Sirius (RA=101.287, Dec=-16.716) as seen from London (lat=51.5, lng=-0.1)
|
|
119
|
+
* const sirius = { ra: 101.287, dec: -16.716 }
|
|
120
|
+
* const london = { lat: 51.5, lng: -0.1, date: new Date('2024-01-15T22:00:00Z') }
|
|
121
|
+
* AstroMath.equatorialToHorizontal(sirius, london)
|
|
122
|
+
* // => { alt: <altitude>, az: <azimuth> }
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
readonly equatorialToHorizontal: (eq: EquatorialCoord, obs: ObserverParams) => HorizontalCoord;
|
|
126
|
+
/**
|
|
127
|
+
* Convert horizontal coordinates (Altitude/Azimuth) to equatorial coordinates (RA/Dec).
|
|
128
|
+
*
|
|
129
|
+
* This is the inverse of {@link equatorialToHorizontal}. All angles are in degrees.
|
|
130
|
+
*
|
|
131
|
+
* @param hor - Horizontal coordinates with `alt` (altitude) and `az` (azimuth) in degrees.
|
|
132
|
+
* @param obs - Observer parameters including `lat` (latitude), `lng` (longitude), and optional `date`.
|
|
133
|
+
* @returns Equatorial coordinates with `ra` (right ascension) and `dec` (declination) in degrees.
|
|
134
|
+
*
|
|
135
|
+
* @remarks
|
|
136
|
+
* See Meeus, "Astronomical Algorithms", Chapter 13.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* // An object at alt=25, az=180 (due south) from Lucerne (lat=47.05, lng=8.31)
|
|
141
|
+
* const hor = { alt: 25, az: 180 }
|
|
142
|
+
* const lucerne = { lat: 47.05, lng: 8.31, date: new Date('2024-03-20T21:00:00Z') }
|
|
143
|
+
* AstroMath.horizontalToEquatorial(hor, lucerne)
|
|
144
|
+
* // => { ra: <right ascension>, dec: <declination> }
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
readonly horizontalToEquatorial: (hor: HorizontalCoord, obs: ObserverParams) => EquatorialCoord;
|
|
148
|
+
/**
|
|
149
|
+
* Convert ecliptic coordinates to equatorial coordinates (J2000 epoch).
|
|
150
|
+
*
|
|
151
|
+
* Uses the mean obliquity of the ecliptic at J2000.0 (23.4393 degrees).
|
|
152
|
+
* All angles are in degrees.
|
|
153
|
+
*
|
|
154
|
+
* @param ecl - Ecliptic coordinates with `lon` (ecliptic longitude) and `lat` (ecliptic latitude) in degrees.
|
|
155
|
+
* @returns Equatorial coordinates with `ra` in [0, 360) and `dec` in [-90, 90] degrees.
|
|
156
|
+
*
|
|
157
|
+
* @remarks
|
|
158
|
+
* See Meeus, "Astronomical Algorithms", Chapter 13. Uses the standard rotation
|
|
159
|
+
* matrix for the obliquity of the ecliptic.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```ts
|
|
163
|
+
* // Convert the ecliptic coordinates of the vernal equinox
|
|
164
|
+
* AstroMath.eclipticToEquatorial({ lon: 0, lat: 0 })
|
|
165
|
+
* // => { ra: 0, dec: 0 }
|
|
166
|
+
*
|
|
167
|
+
* // A point on the ecliptic at lon=90
|
|
168
|
+
* AstroMath.eclipticToEquatorial({ lon: 90, lat: 0 })
|
|
169
|
+
* // => { ra: ~90, dec: ~23.44 }
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
readonly eclipticToEquatorial: (ecl: EclipticCoord) => EquatorialCoord;
|
|
173
|
+
/**
|
|
174
|
+
* Convert galactic coordinates to equatorial coordinates (J2000 epoch).
|
|
175
|
+
*
|
|
176
|
+
* Uses the standard IAU galactic coordinate system with the North Galactic
|
|
177
|
+
* Pole at RA=192.85948, Dec=27.12825 and the ascending node of the galactic
|
|
178
|
+
* plane at l=122.93192.
|
|
179
|
+
*
|
|
180
|
+
* @param gal - Galactic coordinates with `l` (galactic longitude) and `b` (galactic latitude) in degrees.
|
|
181
|
+
* @returns Equatorial coordinates with `ra` in [0, 360) and `dec` in [-90, 90] degrees.
|
|
182
|
+
*
|
|
183
|
+
* @remarks
|
|
184
|
+
* Implements the standard IAU (1958) galactic coordinate transformation.
|
|
185
|
+
* See Meeus, "Astronomical Algorithms", Chapter 13, and
|
|
186
|
+
* Blaauw et al. (1960), MNRAS 121, 123.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```ts
|
|
190
|
+
* // Galactic centre (l=0, b=0) -> equatorial
|
|
191
|
+
* AstroMath.galacticToEquatorial({ l: 0, b: 0 })
|
|
192
|
+
* // => { ra: ~266.4, dec: ~-28.9 } (near Sagittarius A*)
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
readonly galacticToEquatorial: (gal: GalacticCoord) => EquatorialCoord;
|
|
196
|
+
/**
|
|
197
|
+
* Compute the great-circle angular separation between two equatorial positions.
|
|
198
|
+
*
|
|
199
|
+
* Uses the haversine formula for numerical stability at small angular distances.
|
|
200
|
+
*
|
|
201
|
+
* @param a - First equatorial position with `ra` and `dec` in degrees.
|
|
202
|
+
* @param b - Second equatorial position with `ra` and `dec` in degrees.
|
|
203
|
+
* @returns Angular separation in degrees, in the range [0, 180].
|
|
204
|
+
*
|
|
205
|
+
* @remarks
|
|
206
|
+
* The haversine formula avoids the floating-point cancellation issues that
|
|
207
|
+
* affect the simpler cosine formula at small separations.
|
|
208
|
+
* See Meeus, "Astronomical Algorithms", Chapter 17.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```ts
|
|
212
|
+
* // Angular separation between Sirius and Betelgeuse
|
|
213
|
+
* const sirius = { ra: 101.287, dec: -16.716 }
|
|
214
|
+
* const betelgeuse = { ra: 88.793, dec: 7.407 }
|
|
215
|
+
* AstroMath.angularSeparation(sirius, betelgeuse)
|
|
216
|
+
* // => ~27.07 degrees
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
readonly angularSeparation: (a: EquatorialCoord, b: EquatorialCoord) => number;
|
|
220
|
+
/**
|
|
221
|
+
* Compute apparent magnitude from absolute magnitude and distance.
|
|
222
|
+
*
|
|
223
|
+
* Uses the distance modulus formula: m = M + 5 * log10(d / 10).
|
|
224
|
+
*
|
|
225
|
+
* @param absoluteMag - Absolute magnitude (M) of the object.
|
|
226
|
+
* @param distancePc - Distance to the object in parsecs.
|
|
227
|
+
* @returns Apparent magnitude (m) as seen from the observer.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```ts
|
|
231
|
+
* // Sirius: absolute magnitude M=1.42, distance=2.64 pc
|
|
232
|
+
* AstroMath.apparentMagnitude(1.42, 2.64)
|
|
233
|
+
* // => ~-1.46 (apparent magnitude)
|
|
234
|
+
* ```
|
|
235
|
+
*/
|
|
236
|
+
readonly apparentMagnitude: (absoluteMag: number, distancePc: number) => number;
|
|
237
|
+
/**
|
|
238
|
+
* Compute absolute magnitude from apparent magnitude and distance.
|
|
239
|
+
*
|
|
240
|
+
* Uses the inverse distance modulus formula: M = m - 5 * log10(d / 10).
|
|
241
|
+
*
|
|
242
|
+
* @param apparentMag - Apparent magnitude (m) of the object.
|
|
243
|
+
* @param distancePc - Distance to the object in parsecs.
|
|
244
|
+
* @returns Absolute magnitude (M), i.e. apparent magnitude at 10 parsecs.
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```ts
|
|
248
|
+
* // Sirius: apparent magnitude m=-1.46, distance=2.64 pc
|
|
249
|
+
* AstroMath.absoluteMagnitude(-1.46, 2.64)
|
|
250
|
+
* // => ~1.42 (absolute magnitude)
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
readonly absoluteMagnitude: (apparentMag: number, distancePc: number) => number;
|
|
254
|
+
/**
|
|
255
|
+
* Convert stellar parallax to distance.
|
|
256
|
+
*
|
|
257
|
+
* By definition, 1 parsec is the distance at which 1 AU subtends 1 arcsecond.
|
|
258
|
+
*
|
|
259
|
+
* @param parallaxArcsec - Trigonometric parallax in arcseconds. Must be positive.
|
|
260
|
+
* @returns Distance in parsecs.
|
|
261
|
+
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```ts
|
|
264
|
+
* // Sirius parallax: 0.37921 arcsec
|
|
265
|
+
* AstroMath.parallaxToDistance(0.37921)
|
|
266
|
+
* // => ~2.637 parsecs
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
readonly parallaxToDistance: (parallaxArcsec: number) => number;
|
|
270
|
+
/**
|
|
271
|
+
* Solve Kepler's equation `M = E - e * sin(E)` for the eccentric anomaly E.
|
|
272
|
+
*
|
|
273
|
+
* Uses Newton-Raphson iteration with Meeus's initial-guess formula.
|
|
274
|
+
* Converges in 3-6 iterations for all planetary eccentricities (e < 1).
|
|
275
|
+
*
|
|
276
|
+
* @param M - Mean anomaly in **radians**.
|
|
277
|
+
* @param e - Orbital eccentricity (0 <= e < 1 for elliptical orbits).
|
|
278
|
+
* @param tol - Convergence tolerance in radians. Defaults to 1e-12.
|
|
279
|
+
* @returns Eccentric anomaly E in **radians**.
|
|
280
|
+
*
|
|
281
|
+
* @remarks
|
|
282
|
+
* Source: Meeus, "Astronomical Algorithms" (2nd ed.), Chapter 30.
|
|
283
|
+
* The initial guess uses `E0 = M + e * sin(M) * (1 + e * cos(M))`,
|
|
284
|
+
* which provides rapid convergence for moderate eccentricities.
|
|
285
|
+
* The iteration is capped at 30 steps as a safety limit.
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* ```ts
|
|
289
|
+
* // Earth's orbit: e=0.0167, mean anomaly = 1.0 rad
|
|
290
|
+
* AstroMath.solveKepler(1.0, 0.0167)
|
|
291
|
+
* // => ~1.0166 radians
|
|
292
|
+
*
|
|
293
|
+
* // Mars's orbit: e=0.0934, mean anomaly = pi/2 rad
|
|
294
|
+
* AstroMath.solveKepler(Math.PI / 2, 0.0934)
|
|
295
|
+
* // => ~1.6521 radians
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
readonly solveKepler: (M: number, e: number, tol?: number) => number;
|
|
299
|
+
/**
|
|
300
|
+
* Compute heliocentric ecliptic position of a planet.
|
|
301
|
+
*
|
|
302
|
+
* Uses J2000 orbital elements with linear secular rates and an iterative
|
|
303
|
+
* Kepler solver. Accurate to ~0.1 degrees within several centuries of J2000.
|
|
304
|
+
*
|
|
305
|
+
* @param planet - Planet name: `'mercury'` | `'venus'` | `'earth'` | `'mars'` | `'jupiter'` | `'saturn'` | `'uranus'` | `'neptune'`.
|
|
306
|
+
* @param date - The observation date. Defaults to the current date/time.
|
|
307
|
+
* @returns A {@link PlanetPosition} object with heliocentric ecliptic `lon` (degrees),
|
|
308
|
+
* `lat` (degrees), `r` (distance in AU), `M` (mean anomaly in degrees),
|
|
309
|
+
* and `nu` (true anomaly in degrees).
|
|
310
|
+
*
|
|
311
|
+
* @remarks
|
|
312
|
+
* Orbital elements and secular rates are from JPL (Standish 1992) via
|
|
313
|
+
* Meeus, "Astronomical Algorithms", Table 31.A. The Kepler equation is solved
|
|
314
|
+
* iteratively by {@link solveKepler}. This method returns **heliocentric**
|
|
315
|
+
* coordinates; for geocentric positions, subtract Earth's position.
|
|
316
|
+
*
|
|
317
|
+
* @example
|
|
318
|
+
* ```ts
|
|
319
|
+
* // Mars position on 2024-07-04
|
|
320
|
+
* const mars = AstroMath.planetEcliptic('mars', new Date('2024-07-04T00:00:00Z'))
|
|
321
|
+
* // => { lon: <ecliptic longitude>, lat: <ecliptic latitude>, r: <AU>, M: <mean anomaly>, nu: <true anomaly> }
|
|
322
|
+
*
|
|
323
|
+
* // Jupiter position at J2000.0
|
|
324
|
+
* const jupiter = AstroMath.planetEcliptic('jupiter', new Date('2000-01-01T12:00:00Z'))
|
|
325
|
+
* // => { lon: ~34.4, lat: ~-1.3, r: ~5.03, ... }
|
|
326
|
+
* ```
|
|
327
|
+
*/
|
|
328
|
+
readonly planetEcliptic: (planet: PlanetName, date?: Date) => PlanetPosition;
|
|
329
|
+
/**
|
|
330
|
+
* Precess equatorial coordinates from one epoch to another.
|
|
331
|
+
*
|
|
332
|
+
* Uses the rigorous rotation-matrix method with Lieske (1979) precession
|
|
333
|
+
* polynomials for the three precession parameters (zeta_A, z_A, theta_A).
|
|
334
|
+
*
|
|
335
|
+
* @param eq - Equatorial coordinates at the source epoch, with `ra` and `dec` in degrees.
|
|
336
|
+
* @param jdFrom - Julian Date of the source epoch (e.g. 2451545.0 for J2000.0).
|
|
337
|
+
* @param jdTo - Julian Date of the target epoch.
|
|
338
|
+
* @returns Equatorial coordinates at the target epoch, with `ra` in [0, 360) and `dec` in degrees.
|
|
339
|
+
*
|
|
340
|
+
* @remarks
|
|
341
|
+
* Source: Meeus, "Astronomical Algorithms", Chapter 21.
|
|
342
|
+
* The Lieske (1979) polynomials are accurate to ~0.1 arcsecond over a few
|
|
343
|
+
* centuries around J2000.0. For longer time spans, use the Capitaine et al.
|
|
344
|
+
* (2003) IAU 2006 precession model.
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* ```ts
|
|
348
|
+
* // Precess Sirius from J2000.0 to J2050.0
|
|
349
|
+
* const sirius = { ra: 101.287, dec: -16.716 }
|
|
350
|
+
* const j2000 = 2451545.0
|
|
351
|
+
* const j2050 = 2451545.0 + 50 * 365.25
|
|
352
|
+
* AstroMath.precess(sirius, j2000, j2050)
|
|
353
|
+
* // => { ra: ~101.61, dec: ~-16.79 }
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
readonly precess: (eq: EquatorialCoord, jdFrom: number, jdTo: number) => EquatorialCoord;
|
|
357
|
+
/**
|
|
358
|
+
* Compute nutation in longitude (dPsi) and nutation in obliquity (dEpsilon).
|
|
359
|
+
*
|
|
360
|
+
* Evaluates the first 13 terms of the IAU 1980 nutation series, which capture
|
|
361
|
+
* the dominant periodic terms with amplitudes down to ~0.01 arcsecond.
|
|
362
|
+
*
|
|
363
|
+
* @param jd - Julian Date of the observation.
|
|
364
|
+
* @returns A {@link NutationResult} with `dPsi` (nutation in longitude) and
|
|
365
|
+
* `dEpsilon` (nutation in obliquity), both in degrees.
|
|
366
|
+
*
|
|
367
|
+
* @remarks
|
|
368
|
+
* Source: Meeus, "Astronomical Algorithms", Chapter 22, Table 22.A.
|
|
369
|
+
* The five fundamental arguments are the Moon's mean elongation (D),
|
|
370
|
+
* Sun's mean anomaly (M), Moon's mean anomaly (M'), Moon's argument of
|
|
371
|
+
* latitude (F), and the longitude of the ascending node of the Moon's
|
|
372
|
+
* orbit (Omega). Coefficients are in units of 0.0001 arcsecond.
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* ```ts
|
|
376
|
+
* // Nutation at J2000.0
|
|
377
|
+
* const jd = 2451545.0
|
|
378
|
+
* AstroMath.nutation(jd)
|
|
379
|
+
* // => { dPsi: ~-0.00385, dEpsilon: ~-0.00165 } (degrees)
|
|
380
|
+
* ```
|
|
381
|
+
*/
|
|
382
|
+
readonly nutation: (jd: number) => NutationResult;
|
|
383
|
+
/**
|
|
384
|
+
* Compute the true obliquity of the ecliptic (mean obliquity + nutation in obliquity).
|
|
385
|
+
*
|
|
386
|
+
* The mean obliquity polynomial is from Laskar (1986).
|
|
387
|
+
*
|
|
388
|
+
* @param jd - Julian Date of the observation.
|
|
389
|
+
* @returns True obliquity of the ecliptic in degrees.
|
|
390
|
+
*
|
|
391
|
+
* @remarks
|
|
392
|
+
* Combines the mean obliquity (a polynomial in T) with the nutation correction
|
|
393
|
+
* from {@link nutation}. See Meeus, "Astronomical Algorithms", Chapter 22.
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* ```ts
|
|
397
|
+
* // True obliquity at J2000.0
|
|
398
|
+
* AstroMath.trueObliquity(2451545.0)
|
|
399
|
+
* // => ~23.439 degrees (mean obliquity plus small nutation correction)
|
|
400
|
+
* ```
|
|
401
|
+
*/
|
|
402
|
+
readonly trueObliquity: (jd: number) => number;
|
|
403
|
+
/**
|
|
404
|
+
* Greenwich Apparent Sidereal Time (GAST) in degrees.
|
|
405
|
+
*
|
|
406
|
+
* GAST equals GMST corrected by the equation of the equinoxes
|
|
407
|
+
* (nutation in longitude projected onto the equator).
|
|
408
|
+
*
|
|
409
|
+
* @param date - The observation date. Defaults to the current date/time.
|
|
410
|
+
* @returns GAST in degrees, normalised to the range [0, 360).
|
|
411
|
+
*
|
|
412
|
+
* @remarks
|
|
413
|
+
* The equation of the equinoxes is `dPsi * cos(epsilon)`, where dPsi is the
|
|
414
|
+
* nutation in longitude and epsilon is the true obliquity. This correction
|
|
415
|
+
* is typically on the order of a few arcseconds.
|
|
416
|
+
* See Meeus, "Astronomical Algorithms", Chapter 12.
|
|
417
|
+
*
|
|
418
|
+
* @example
|
|
419
|
+
* ```ts
|
|
420
|
+
* // GAST at J2000.0
|
|
421
|
+
* AstroMath.gast(new Date('2000-01-01T12:00:00Z'))
|
|
422
|
+
* // => ~280.46 degrees (GMST + small nutation correction)
|
|
423
|
+
* ```
|
|
424
|
+
*/
|
|
425
|
+
readonly gast: (date?: Date) => number;
|
|
426
|
+
/**
|
|
427
|
+
* Compute atmospheric refraction correction for a given apparent altitude.
|
|
428
|
+
*
|
|
429
|
+
* Uses Saemundsson's formula with pressure and temperature scaling.
|
|
430
|
+
* Returns zero for objects well below the horizon (apparent altitude < -1 degree).
|
|
431
|
+
*
|
|
432
|
+
* @param apparentAlt - Apparent (observed) altitude of the object in degrees.
|
|
433
|
+
* @param tempC - Air temperature in degrees Celsius. Defaults to 10.
|
|
434
|
+
* @param pressureMb - Atmospheric pressure in millibars. Defaults to 1010.
|
|
435
|
+
* @returns Refraction correction in degrees (always non-negative). Add this value
|
|
436
|
+
* to the true altitude to obtain the apparent altitude, or subtract it from
|
|
437
|
+
* the apparent altitude to obtain the true altitude.
|
|
438
|
+
*
|
|
439
|
+
* @remarks
|
|
440
|
+
* Saemundsson's formula as presented in Meeus, "Astronomical Algorithms", Chapter 16.
|
|
441
|
+
* The formula is valid for altitudes above about -0.5 degrees. For objects below -1
|
|
442
|
+
* degree, the function returns 0 as the refraction model is not meaningful there.
|
|
443
|
+
* At the horizon (alt ~0), the refraction is approximately 0.57 degrees (~34 arcminutes).
|
|
444
|
+
*
|
|
445
|
+
* @example
|
|
446
|
+
* ```ts
|
|
447
|
+
* // Refraction at the horizon (apparent altitude = 0) with standard conditions
|
|
448
|
+
* AstroMath.refraction(0)
|
|
449
|
+
* // => ~0.57 degrees (~34 arcminutes)
|
|
450
|
+
*
|
|
451
|
+
* // Refraction at 45 degrees altitude from Lucerne (500m elevation, ~955 mbar, 5 C)
|
|
452
|
+
* AstroMath.refraction(45, 5, 955)
|
|
453
|
+
* // => ~0.016 degrees (~58 arcseconds)
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
readonly refraction: (apparentAlt: number, tempC?: number, pressureMb?: number) => number;
|
|
457
|
+
/**
|
|
458
|
+
* Apply proper motion to propagate star coordinates to a different epoch.
|
|
459
|
+
*
|
|
460
|
+
* This is a linear approximation that is accurate for time spans of a few
|
|
461
|
+
* hundred years for most stars.
|
|
462
|
+
*
|
|
463
|
+
* @param eq - Equatorial coordinates at the source epoch, with `ra` and `dec` in degrees.
|
|
464
|
+
* @param pmRA - Proper motion in right ascension in milliarcseconds per year.
|
|
465
|
+
* This must already include the cos(dec) factor (i.e. `pmRA*` as given in most
|
|
466
|
+
* modern catalogues like Hipparcos/Gaia).
|
|
467
|
+
* @param pmDec - Proper motion in declination in milliarcseconds per year.
|
|
468
|
+
* @param fromEpoch - Source epoch as a Besselian/Julian year (e.g. 2000.0 for J2000).
|
|
469
|
+
* @param toEpoch - Target epoch as a Besselian/Julian year (e.g. 2025.0).
|
|
470
|
+
* @returns Equatorial coordinates at the target epoch, with `ra` in [0, 360) and `dec` clamped to [-90, 90].
|
|
471
|
+
*
|
|
472
|
+
* @remarks
|
|
473
|
+
* The pmRA value is divided by cos(dec) internally to convert from great-circle
|
|
474
|
+
* motion to coordinate motion before applying the linear offset.
|
|
475
|
+
* For very fast-moving stars (e.g. Barnard's Star) or long time intervals,
|
|
476
|
+
* consider using a full 6D space-motion propagation instead.
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* ```ts
|
|
480
|
+
* // Propagate Sirius from J2000.0 to J2025.0
|
|
481
|
+
* // Sirius: pmRA = -546.01 mas/yr, pmDec = -1223.14 mas/yr
|
|
482
|
+
* const sirius = { ra: 101.287, dec: -16.716 }
|
|
483
|
+
* AstroMath.applyProperMotion(sirius, -546.01, -1223.14, 2000.0, 2025.0)
|
|
484
|
+
* // => { ra: ~101.283, dec: ~-16.724 }
|
|
485
|
+
* ```
|
|
486
|
+
*/
|
|
487
|
+
readonly applyProperMotion: (eq: EquatorialCoord, pmRA: number, pmDec: number, fromEpoch: number, toEpoch: number) => EquatorialCoord;
|
|
488
|
+
/**
|
|
489
|
+
* Compute rise, transit (culmination), and set times for a celestial object.
|
|
490
|
+
*
|
|
491
|
+
* Calculates the UTC times at which the object crosses the standard altitude
|
|
492
|
+
* (rise/set) and reaches its highest point above the horizon (transit) on the
|
|
493
|
+
* given date. If the object is circumpolar or never rises, `rise` and `set`
|
|
494
|
+
* are returned as `null` while `transit` is still provided.
|
|
495
|
+
*
|
|
496
|
+
* @param eq - Equatorial coordinates of the object with `ra` and `dec` in degrees (J2000).
|
|
497
|
+
* @param obs - Observer parameters including `lat` (latitude in degrees), `lng` (longitude
|
|
498
|
+
* in degrees, east positive), and optional `date` (the day of interest; defaults to now).
|
|
499
|
+
* @param h0 - Standard altitude in degrees that defines the rise/set event. Defaults to
|
|
500
|
+
* -0.5667 (accounting for atmospheric refraction for point sources / stars).
|
|
501
|
+
* Common values:
|
|
502
|
+
* - Stars: -0.5667 (default)
|
|
503
|
+
* - Sun (upper limb): -0.8333
|
|
504
|
+
* - Moon (upper limb): +0.125
|
|
505
|
+
* @returns A {@link RiseTransitSet} object with `rise`, `transit`, and `set` as
|
|
506
|
+
* JavaScript Date objects (or `null` for rise/set if the object is circumpolar
|
|
507
|
+
* or never rises above h0).
|
|
508
|
+
*
|
|
509
|
+
* @remarks
|
|
510
|
+
* Source: Meeus, "Astronomical Algorithms", Chapter 15.
|
|
511
|
+
* This implementation assumes fixed RA/Dec over the course of the day, which is
|
|
512
|
+
* adequate for stars and adequate as a first approximation for planets. For the
|
|
513
|
+
* Sun and Moon, whose coordinates change significantly during a day, an iterative
|
|
514
|
+
* approach with interpolated coordinates yields better accuracy.
|
|
515
|
+
*
|
|
516
|
+
* @example
|
|
517
|
+
* ```ts
|
|
518
|
+
* // Rise/transit/set of Sirius from London on 2024-01-15
|
|
519
|
+
* const sirius = { ra: 101.287, dec: -16.716 }
|
|
520
|
+
* const london = { lat: 51.5, lng: -0.1, date: new Date('2024-01-15T00:00:00Z') }
|
|
521
|
+
* const rts = AstroMath.riseTransitSet(sirius, london)
|
|
522
|
+
* // => { rise: Date(~17:08 UTC), transit: Date(~00:02 UTC), set: Date(~06:56 UTC) }
|
|
523
|
+
*
|
|
524
|
+
* // Sun rise/set from Lucerne on the March equinox
|
|
525
|
+
* const sunEquinox = { ra: 0, dec: 0 }
|
|
526
|
+
* const lucerne = { lat: 47.05, lng: 8.31, date: new Date('2024-03-20T00:00:00Z') }
|
|
527
|
+
* AstroMath.riseTransitSet(sunEquinox, lucerne, -0.8333)
|
|
528
|
+
* // => { rise: Date(~05:30 UTC), transit: Date(~11:25 UTC), set: Date(~17:20 UTC) }
|
|
529
|
+
* ```
|
|
530
|
+
*/
|
|
531
|
+
readonly riseTransitSet: (eq: EquatorialCoord, obs: ObserverParams, h0?: number) => RiseTransitSet;
|
|
532
|
+
};
|