별자리판 UI 없이 천문학 계산 로직만 필요하신가요? `astronomy.js`는 순수 자바스크립트(ESM)로 작성되어 어떤 프로젝트에서도 독립적으로 사용할 수 있습니다.
NPM 또는 CDN을 통해 간편하게 시작하세요.
// NPM 사용 시
import { AstroTime, AstroMath, AstroVector } from 'planisphere-js/astronomy';
// CDN 사용 시
import { AstroTime, AstroMath, AstroVector } from 'https://cdn.jsdelivr.net/npm/planisphere-js/js/core/astronomy.js';
const year = 2024, month = 6, day = 21, h = 12, m = 0, s = 0;
// 1. 율리우스일(JD) 계산
const jd = AstroTime.jd(year, month, day, h, m, s);
console.log('JD:', jd); //
// 2. 지방시(LCT) → 항성시(LST) 변환 (서울 기준)
const astroTime = new AstroTime(9, 126.98, 37.57); // GMT+9, 경도, 위도
const lst = astroTime.LCT2LST(jd);
console.log('LST (Deg):', lst); //
const solarNoon = astroTime.lasn(2024, 6, 21);
console.log('서울 남중 시각:', solarNoon.toFixed(2) + '시'); //
import { AstroVector, AstroMatrix } from '...';
const star = new AstroVector();
// 적경 2.5h, 적위 89.26도 (북극성 근처) 설정
star.setSphe(2.5 * AstroMath.H2R, 89.26 * AstroMath.D2R);
// 변환 행렬 생성 (LST와 위도 필요)
const matrix = new AstroMatrix();
matrix.equ2hor(lst * AstroMath.D2R, 37.57 * AstroMath.D2R);
const horVector = new AstroVector();
horVector.multiply(matrix, star);
console.log('방위각:', (horVector.lon() * AstroMath.R2D).toFixed(2)); //
console.log('고도:', (horVector.lat() * AstroMath.R2D).toFixed(2)); //
import { EquiDistanceProjection } from '...';
const radius = 300; // 별자리판 반경
const proj = new EquiDistanceProjection(radius, 37.57 * AstroMath.D2R);
const { x, y } = proj.project(2.5 * AstroMath.H2R, 89.26 * AstroMath.D2R);
console.log('SVG 좌표:', x.toFixed(1), y.toFixed(1)); //