2025-05-15 12:01:41 -03:00

43 lines
1.2 KiB
C

#ifndef MoonRise_h
#define MoonRise_h
#include <time.h>
// Size of event search window in hours.
// Events further away from the search time than MR_WINDOW/2 will not be
// found. At higher latitudes the moon rise/set intervals become larger, so if
// you want to find the nearest events this will need to increase. Larger
// windows will increase interpolation error. Useful values are probably from
// 12 - 48 but will depend upon your application.
#define MR_WINDOW 72 // Even integer
typedef struct {
double RA; // Right ascension
double declination; // Declination
double distance; // Distance
} skyCoordinates;
typedef struct {
time_t queryTime;
time_t riseTime;
time_t setTime;
float riseAz;
float setAz;
bool hasRise;
bool hasSet;
bool isVisible;
} MoonRise;
MoonRise MoonRise_calculate(double latitude, double longitude, time_t t);
// private:
void testMoonRiseSet(MoonRise *self, int i, double offsetDays, double latitude, double longitude,
skyCoordinates *mp);
skyCoordinates moon(double dayOffset);
double interpolate(double f0, double f1, double f2, double p);
double julianDate(time_t t);
double localSiderealTime(double offsetDays, double longitude);
#endif