nsat / sgp4-rs

A Rust package for the SGP-4 orbital propagator.
MIT License
8 stars 3 forks source link

Add bindings for remaining SGP4 functions and provide safe conversions for GMST #4

Closed nickpascucci closed 4 years ago

nickpascucci commented 4 years ago

These functions are necessary for converting SGP4 state vectors into different coordinate frames, such as Earth-Centered Earth-Fixed (ECEF).

3ed66fe adds trait implementations to make working with Greenwhich Mean Sidereal Time (GMST) easier:

Implement the From trait for GMST and Julian Day newtypes.

This is intended to help with conversions using DateTimes, which are common in propagation applications. Newtype wrappers provide a measure of safety in dealing with different time values, which are easily confused.

SGP4 provides two functions, jday and invjday, for converting between year/month/day/hour/minute/second format and astronomical Julian days. These functions are logical inverses of each other, so I've added a test to verify that they compose to form an identity function. The GMST conversion is not paired with such an inverse, so I validate it against an example drawn from an online GMST calculator.