lunarPhases function

List<LunarPhase> lunarPhases(
  1. Ephemeris ephemeris,
  2. double startJdTT,
  3. double endJdTT
)

New Moons, First Quarters, Full Moons and Last Quarters in startJdTT … endJdTT, in time order: the moments when the excess of the apparent geocentric longitude of the Moon over that of the Sun is 0°, 90°, 180° and 270°.

Implementation

List<LunarPhase> lunarPhases(
  Ephemeris ephemeris,
  double startJdTT,
  double endJdTT,
) => [
  for (final c in longitudeCrossings(
    lunarElongation(ephemeris),
    startJdTT,
    endJdTT,
    period: 90,
  ))
    LunarPhase(c.jdTT, MoonPhase.values[(c.longitude / 90).round() % 4]),
];