@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.
50 lines (49 loc) • 1.75 kB
JavaScript
import { g as h, u as M } from "./epoch-nmyjNjKp.js";
import { e as T, c as s, g as S, d as f } from "./utilities-BM-rBPno.js";
const p = (t, o) => {
let e = T(Math.acos(Math.sin(s(t.θ)) * Math.sin(s(o.θ)) + Math.cos(s(t.θ)) * Math.cos(s(o.θ)) * Math.cos(s(t.φ - o.φ)))) % 360;
return e < 0 && (e += 360), e;
}, J = (t) => ({
θ: (t.θ + 180) % 360,
φ: -t.φ
}), U = (t) => {
const { θ: o, φ: e } = t;
return {
θ: S(o),
φ: f(e)
};
}, u = (t) => {
const o = h(t), a = (Math.floor(o - 0.5) + 0.5 - 2451545) / 36525;
let r = (6.697374558 + 2400.051336 * a + 25862e-9 * a ** 2) % 24;
r < 0 && (r += 24);
const c = M(t), i = (c.getUTCHours() + c.getUTCMinutes() / 60 + c.getUTCSeconds() / 3600 + c.getUTCMilliseconds() / 36e5) * 1.002737909;
r += i;
const g = r % 24;
return g < 0 ? g + 24 : g;
}, G = u, d = (t, o) => {
let n = (u(t) + o / 15) / 24;
return n = n - Math.floor(n), n < 0 && (n += 1), 24 * n;
}, L = d, D = (t, o, e) => {
let a = d(t, o) * 15 - e;
return a < 0 && (a += 360), a;
}, z = (t) => {
const e = (h(t) - 2451545) / 36525;
return 23.439292 - (46.845 * e + 59e-5 * e ** 2 + 1813e-6 * e ** 3) / 3600;
}, A = (t, o, e) => {
const { latitude: n, longitude: a } = o, { ra: r, dec: c } = e, l = s(D(t, a, r));
let i = T(Math.atan2(Math.sin(l), Math.tan(s(n)) * Math.cos(s(c)) - Math.sin(s(c)) * Math.cos(l)));
return i < 0 && (i += 360), i % 360;
};
export {
G as GST,
L as LST,
p as getAngularSeparation,
J as getAntipodeCoordinate,
u as getGreenwhichSiderealTime,
D as getHourAngle,
d as getLocalSiderealTime,
U as getNormalisedSphericalCoordinate,
z as getObliquityOfTheEcliptic,
A as getParallacticAngle
};
//# sourceMappingURL=astrometry.js.map