approxTimes function
Approximate rise, transit, set times.
lat, lon observer geographic coords (radians, lon positive west).
h0 standard altitude (radians).
th0 apparent sidereal time at Greenwich at 0h UT (seconds of day, [0..86400)).
alpha right ascension (radians), delta declination (radians).
Returns seconds of day for rise, transit, set. Range [0, 86400). Returns null if the body is circumpolar or never rises.
Implementation
({double rise, double transit, double set})? approxTimes(
double lat, double lon, double h0,
double th0, double alpha, double delta) {
final hAngle = hourAngle(lat, h0, delta);
if (hAngle == null) return null;
final h0Secs = hAngle * _secsPerDeg * 180 / math.pi;
// Transit time (15.2).
final mt = (lon + alpha) * _secsPerDeg * 180 / math.pi - th0;
return (
rise: _mod86400(mt - h0Secs),
transit: _mod86400(mt),
set: _mod86400(mt + h0Secs),
);
}