44 lines
1.2 KiB
C
44 lines
1.2 KiB
C
#ifndef MoonRise_h
|
|
#define MoonRise_h
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.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 48 // Even integer
|
|
|
|
typedef struct {
|
|
double RA; // Right ascension
|
|
double declination; // Declination
|
|
double distance; // Distance
|
|
} skyCoordinates;
|
|
|
|
typedef struct {
|
|
uint32_t queryTime;
|
|
uint32_t riseTime;
|
|
uint32_t setTime;
|
|
float riseAz;
|
|
float setAz;
|
|
bool hasRise;
|
|
bool hasSet;
|
|
bool isVisible;
|
|
} MoonRise;
|
|
|
|
MoonRise MoonRise_calculate(double latitude, double longitude, uint32_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(uint32_t t);
|
|
double localSiderealTime(double offsetDays, double longitude);
|
|
|
|
#endif
|