skymath 0.3.3

Planning-grade astronomy math for astrophotography tooling: angles, equatorial coordinates, sexagesimal parsing and formatting, angular separation and offsets, precession, MJD/JD/calendar conversions, sidereal time, and observer-local quantities (alt-az, airmass, transit).
Documentation

skymath

CI crates.io docs.rs

Rust library of planning-grade astronomy math for astrophotography tooling.

docs.rs · Guide

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.

Install

cargo add skymath time

The time crate supplies the OffsetDateTime instants every ephemeris function takes.

Usage

use skymath::{alt_az, altitude_crossings, separation, Angle, CrossingOutcome,
              Equatorial, Location, ParseMode};
use time::OffsetDateTime;

fn main() -> skymath::Result<()> {
    let site = Location::parse("+52 05 32", "+004 18 27", 6.0)?;
    let m31 = Equatorial::parse_j2000("00:42:44.3", "+41:16:09", ParseMode::Strict)?;

    let now = OffsetDateTime::now_utc();
    let h = alt_az(m31, now, &site);
    println!("M31: alt {:.1}°, az {:.1}°", h.altitude.degrees(), h.azimuth.degrees());

    match altitude_crossings(m31, Angle::from_degrees(30.0), now, &site) {
        CrossingOutcome::Crosses { rise, set } => println!("above 30°: {rise}{set}"),
        outcome => println!("{outcome:?}"),
    }
    Ok(())
}

cargo run --example plan_night walks the full planning flow (site + target parsing, constellation lookup, precession to tonight, sidereal time, airmass, parallactic angle, transit and window, twilight, and Moon separation and illumination). See the guide for a task-by-task walkthrough, or docs.rs for the full API reference.

Instants are time crate types; functions taking an OffsetDateTime fold the offset in internally, so passing local civil time cannot skew results.

Configuration

Feature Type Default Effect
serde Cargo feature off Derives Serialize/Deserialize on all public types.

License

Licensed under the Apache License, Version 2.0.