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.

20 lines (19 loc) 917 B
import { e as P, c as d } from "./utilities-BM-rBPno.js"; const f = (g, i, v = 0.42) => { const { az: e, alt: r } = g, { width: M, height: o } = i, s = v, l = 0, a = 1, n = Math.cos(d(e) - Math.PI), c = Math.sin(d(e) - Math.PI), t = Math.sin(d(r)), h = Math.cos(d(r)), z = 2 / (1 + l * t + a * h * n), T = M / 2 + s * z * o * h * c, w = o - s * z * o * (a * t - l * h * n); return { x: T, y: w }; }, m = (g, i, v = 0.2) => { const { x: e, y: r } = g, M = 0, o = 1, s = i.height, l = i.width, a = (e - l / 2) / s, n = (s - r) / s, c = Math.sqrt(a ** 2 + n ** 2), t = 2 * Math.atan2(c, 2 * v), h = Math.asin(Math.cos(t) * M + n * Math.sin(t) * o / c), z = Math.PI + Math.atan2(a * Math.sin(t), c * o * Math.cos(t) - n * M * Math.sin(t)); return { az: P(z), alt: P(h) }; }; export { f as convertHorizontalToStereo, m as convertStereoToHorizontal }; //# sourceMappingURL=projection.js.map