skymath
Rust library of planning-grade astronomy math for astrophotography tooling.
- Angles — typed
Angle(degrees, radians, hours, arcminutes, arcseconds), normalization helpers, exact conversion constants. - Equatorial coordinates — validated RA/Dec with epoch (J2000 or of-date); sexagesimal parsing in strict and lenient modes, and sexagesimal formatting.
- Spherical geometry — great-circle separation, position angle, tangent-plane offsets and their inverse (offset applied to a coordinate).
- Precession — IAU-1976 conversion between J2000 and equinox-of-date.
- Coordinate frames — equatorial ↔ galactic and equatorial ↔ ecliptic.
- Time — MJD/JD ↔ calendar conversions, FITS
DATE-OBSparsing and formatting, Julian epoch from a date, Greenwich and local sidereal time. - Observer-local quantities — observer
Location(with sexagesimal parsing), hour angle, alt-azimuth transforms, airmass, atmospheric refraction, parallactic angle, and transit / altitude-crossing times. - Sun & Moon — solar and lunar positions (geocentric and topocentric), twilight times (civil / nautical / astronomical, with typed polar-night and midnight-sun outcomes), moonrise/set, lunar separation from a target, Moon illumination and phase angle, and the moon-avoidance Lorentzian criterion.
- Constellations — which of the 88 IAU constellations contains a coordinate (Roman 1987 boundary table at B1875.0), as a typed value with official abbreviations ("UMi") and Latin names ("Ursa Minor", "Boötes").
Precision is planning-grade (≈1 arcminute) throughout: suitable for framing, scheduling, and session planning, not for telescope pointing or astrometry. Apparent-place corrections (nutation, aberration, proper motion) are out of scope by design.
Usage
use ;
use OffsetDateTime;
cargo run --example plan_night walks the full planning flow (site + target
parsing, precession to tonight, sidereal time, airmass, parallactic angle,
transit and window). Enable the serde feature for Serialize/Deserialize
derives on all public types.
Instants are time crate types; functions taking an OffsetDateTime fold the
offset in internally, so passing local civil time cannot skew results.
License
Licensed under the Apache License, Version 2.0.