lunarElongation function

LongitudeFunction lunarElongation(
  1. Ephemeris ephemeris
)

Elongation of the Moon from the Sun in ecliptic longitude: the apparent geocentric longitude of the Moon minus that of the Sun, in degrees (0 ≤ x < 360) – 0° at New Moon, 180° at Full Moon.

Implementation

LongitudeFunction lunarElongation(Ephemeris ephemeris) {
  final moon = bodyLongitude(ephemeris, Naif.moon);
  final sun = bodyLongitude(ephemeris, Naif.sun);
  return (jdTT) => (moon(jdTT) - sun(jdTT)) % 360;
}