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.

4 lines (3 loc) 953 B
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});// @license Copyright © 2021-2024 observerly const f=(n,a,s)=>{const t=[],[e,o]=n,[r,l]=a,p=Math.hypot(r-e,l-o),h=Math.ceil(p/s);for(let i=0;i<=h;i++){const c=i/h,u=e+c*(r-e),d=o+c*(l-o);t.push([u,d])}return t},M=(n,a,s)=>{const t=[],[e,o]=n,[r,l]=a;let p=r;Math.abs(r-e)>180&&(p=r>e?r-360:r+360);const h=Math.hypot(p-e,l-o),i=Math.ceil(h/s);for(let c=0;c<=i;c++){const u=c/i;let d=e+u*(p-e),y=o+u*(l-o);d=(d+360)%360,y=Math.max(-90,Math.min(90,y)),t.push([d,y])}return t};function X(n,a=1){const s=[];for(let t=0;t<n.length-1;t++){const e=n[t],o=n[t+1];s.push(...f(e,o,a))}return s}function g(n,a=1){const s=[];for(let t=0;t<n.length-1;t++){const e=n[t],o=n[t+1];s.push(...M(e,o,a))}return s}exports.interpolate=f;exports.interpolateGeodesic=M;exports.interpolateRank2DArray=X;exports.interpolateRank2DGeodesicCoordinateArray=g; //# sourceMappingURL=maths.cjs.map