-
Notifications
You must be signed in to change notification settings - Fork 2
/
equations.h
42 lines (31 loc) · 1.13 KB
/
equations.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// $Revision: 1.3 $
// equations.h
// (c) 2004-2022 Matthew Arcus
// MIT License
#if !defined EQUATIONS_H
#define EQUATIONS_H
#include "constants.h"
// 16 minutes half-diameter + 34 minutes refraction
// The earth
const double eccentricity = 0.017;
// It's orbit
const double inclination = radians(23.45);
const double perihelion = radians(12.25);// Angle from winter solstice to perihelion
const double equinoxangle = pi/2.0 - perihelion; // Angle from equinox to perihelion
const double periheliontime = -1.323859; // Time from equinox to perihelion
// Sun declination for sunrise/sunset
const double sunriseangle = radians(-(16.0 + 34)/60.0);
const double daysinyear = 365.242;
inline double days(double t) { return t * daysinyear / (2 * pi); };
double equationoftime(double date);
double sunheight (double date); // sin of the declination at date
double sundec (double date); // sin of the declination at date
double sunrise (double date, double phi);
class Equation
{
public:
virtual double operator() (double t) const = 0;
bool FindRoot (double t0, double t1, double epsilon, double& t) const;
virtual ~Equation() {};
};
#endif