UNPKG

@observerly/astrometry

Version:

observerly's lightweight, zero-dependency, type safe astrometry library written in Typescript for calculating the position of celestial objects in the sky.

153 lines (152 loc) 3.89 kB
import { convertEclipticToEquatorial as E, convertEquatorialToHorizontal as A } from "./coordinates.js"; import { J2000 as g } from "./constants.js"; import { earth as h } from "./earth.js"; import { g as H } from "./epoch-nmyjNjKp.js"; import { c as o, e as u } from "./utilities-BM-rBPno.js"; // @license Copyright © 2021-2023 observerly const I = { uid: "01HD49QMD7GA502WXEMY1ZAG15", name: "Mercury", symbol: "☿", T: 0.2408467, m: 0.055274, r: 2439700, e: 0.205636, a: 0.3870993, i: 7.004979, ε: 252.250324, ϖ: 77.457796, Ω: 48.330766, isInferior: !0 }, P = { uid: "01HD49R1NASDCYK3ZBYYCBJTBW", name: "Venus", symbol: "♀", T: 0.615197, m: 0.8149984, r: 6051800, e: 67767e-7, a: 0.72333566, i: 3.39467605, ε: 181.9791, ϖ: 131.602467, Ω: 76.679843, isInferior: !0 }, J = { uid: "01HD4ARM2X130B6M2Q74JFKRW4", name: "Mars", symbol: "♂", T: 1.880848, m: 0.107447, r: 3389500, e: 0.093394, a: 1.52371, i: 1.849691, ε: -4.553432, ϖ: -23.943629, Ω: 49.559539, isInferior: !1 }, R = { uid: "01HD4AYRMZP734M8FVQGXDB5BV", name: "Jupiter", symbol: "♃", T: 11.862615, m: 317.828133, r: 69911e3, e: 0.048393, a: 5.202887, i: 1.3043975, ε: 34.396441, ϖ: 14.728479, Ω: 100.473909, isInferior: !1 }, b = { uid: "01HD4AYZAHS15TJJMZDQWV1TET", name: "Saturn", symbol: "♄", T: 29.447498, m: 95.160904, r: 58232e3, e: 0.053862, a: 9.536676, i: 2.485992, ε: 49.954244, ϖ: 92.598878, Ω: 113.662424, isInferior: !1 }, v = { uid: "01HD4AZ66TP0P2KY9A8XFMRQ4T", name: "Uranus", symbol: "♅", T: 84.016846, m: 14.535757, r: 25362e3, e: 0.0472574, a: 19.18916464, i: 0.772638, ε: 313.238104, ϖ: 170.954276, Ω: 74.016925, isInferior: !1 }, Y = { uid: "01HD4AZGMADD008W4XT4HEV9ZC", name: "Neptune", symbol: "♆", T: 164.79132, m: 17.147241, r: 24622e3, e: 867797e-8, a: 30.069923, i: 1.77004347, ε: -55.120029, ϖ: 44.964762, Ω: 131.784226, isInferior: !1 }, Z = [I, P, h, J, R, b, v, Y], T = (n, t) => { const s = H(n) - g; let e = (360 / 365.242191 * (s / t.T) + t.ε - t.ϖ) % 360; return e < 0 && (e += 360), e; }, p = (n, t) => { const r = T(n, t); return 360 / Math.PI * t.e * Math.sin(o(r)); }, D = (n, t) => { const r = T(n, t), s = p(n, t); return (r + s) % 360; }, l = (n, t) => (D(n, t) + t.ϖ) % 360, B = (n, t) => { const r = l(n, t), s = t.Ω || 0; return u(Math.asin(Math.sin(o(r - s)) * Math.sin(o(t.i)))) % 360; }, f = (n, t) => { const r = D(n, t); return t.a * (1 - t.e ** 2) / (1 + t.e * Math.cos(o(r))); }, G = (n, t) => { const r = l(n, t), s = B(n, t), e = f(n, t), c = t.Ω || 0, a = c + u(Math.atan2(Math.sin(o(r - c)) * Math.cos(o(t.i)), Math.cos(o(r - c)))), i = l(n, h), M = f(n, h); let m = Number.NEGATIVE_INFINITY; t.isInferior ? m = 180 + i + u(Math.atan2(e * Math.cos(o(s)) * Math.sin(o(i - a)), M - e * Math.cos(o(s)) * Math.cos(o(i - a)))) : m = a + u(Math.atan2(M * Math.sin(o(a - i)), e * Math.cos(o(s)) - M * Math.sin(o(i - a)))); const y = u(Math.atan(e * Math.cos(o(s)) * Math.tan(o(s)) * Math.sin(o(m - a)) / (M * Math.sin(o(a - i))))); return { λ: m % 360, β: y }; }, Q = (n, t) => Z.filter((r) => r.name !== "Earth").map((r) => { const s = G(n, r), e = E(n, s), c = A(n, t, e); return { ...r, ...s, ...e, ...c }; }); export { p as getPlanetaryEquationOfCenter, G as getPlanetaryGeocentricEclipticCoordinate, f as getPlanetaryHeliocentricDistance, B as getPlanetaryHeliocentricEclipticLatitude, l as getPlanetaryHeliocentricEclipticLongitude, T as getPlanetaryMeanAnomaly, Q as getPlanetaryPositions, D as getPlanetaryTrueAnomaly, R as jupiter, J as mars, I as mercury, Y as neptune, Z as planets, b as saturn, v as uranus, P as venus }; //# sourceMappingURL=planets.js.map