1 #ifndef CALC_EPHEM_H
2 #define CALC_EPHEM_H
3 /* (C) Mike Henderson <mghenderson@lanl.gov>.
4  *
5  * I've added function prototypes, a couple of data to the CTrans
6  * structure, converted standard data types to their glib counterparts
7  * (as compared to original wmMoonClock code), and piped the whole
8  * thing through indent.
9  *
10  * josh buhl <jbuhl@users.sourceforge.net>
11  */
12 
13 #include <glib.h>
14 
15 #include <stdio.h>
16 #include <math.h>
17 
18 #define DegPerRad       57.29577951308232087680
19 #define RadPerDeg        0.01745329251994329576
20 
21 
22 typedef struct Vector {
23 	gdouble x;
24 	gdouble y;
25 	gdouble z;
26 } Vector;
27 
28 
29 typedef struct Position {
30 	gdouble x;
31 	gdouble y;
32 	gdouble z;
33 } Position;
34 
35 
36 typedef struct CTrans {
37 	gdouble UT;		/* Universal Time (in decimal hours) */
38 	gint year;		/* 2 digit year */
39 	gint month;		/* 2 digit month of year */
40 	gint day;		/* 2 digit day of month */
41 	gint doy;		/* 3 digit Day Of Year */
42 	gint dow;		/* 1 digit day of week */
43 	gchar dowstr[80];	/* Day of week String (e.g. "Sun") */
44 	gdouble gmst;		/* Greenwich Mean Sidereal Time */
45 	gdouble eccentricity;	/* Eccentricity of Earth-Sun orbit */
46 	gdouble epsilon;	/* Obliquity of the ecliptic (in radians) */
47 	gdouble lambda_sun;	/* Ecliptic Long. of Sun (in radians) */
48 	gdouble earth_sun_dist;	/* Earth-Sun distance (in units of earth radii) */
49 	gdouble RA_sun;		/* Right Ascention of Sun (in degrees) */
50 	gdouble DEC_sun;	/* Declination of Sun (in degrees) */
51 	Vector Sun;		/* direction of Sun in GEI system (unit vector) */
52 	Vector EcPole;		/* direction of Ecliptic Pole in GEI system (unit vector) */
53 	gdouble psi;		/* Geodipole tilt angle (in radians) */
54 	gdouble Dipole_Gcolat;	/* Geographic colat of centered dipole axis (deg.) */
55 	gdouble Dipole_Glon;	/* Geographic long. of centered dipole axis (deg.) */
56 
57 	gdouble RA_moon;	/* Right Ascention of Moon (in degrees) */
58 	gdouble DEC_moon;	/* Declination of Moon (in degrees) */
59 	gdouble MoonPhase;	/* The Phase of the Moon (in days) */
60 	gdouble MoonAge;	/* Age of Moon in Days */
61 	gdouble EarthMoonDistance;	/* Distance between the Earth and Moon (in earth-radii) */
62 	gdouble Glat;		/* Geographic Latitude of Observer */
63 	gdouble Glon;		/* Geographic Longitude of Observer */
64 	gdouble h_moon;		/* Altitude of Moon (in degrees) */
65 	gdouble A_moon;		/* Azimuth of Moon (in degrees) */
66 	gint Visible;		/* Whether or not moon is above horizon */
67 
68 	/* Additional Data for glunarclock */
69 	gdouble SinGlat;	/* data calc. in CalcEphem, used in MoonRise */
70 	gdouble CosGlat;	/* data calc. in CalcEphem, used in MoonRise */
71 
72 	gdouble LAT;		/* Local Apparent Time (sundial time) */
73 	gdouble LMT;		/* Local Mean Time (eqn of time corrected LAT) */
74 	gdouble LST;		/* Local Standard Time */
75 	/* end additional data */
76 } CTrans;
77 
78 
79 void CalcEphem(glong date, gdouble UT, CTrans * c);
80 gdouble jd(gint ny, gint nm, gint nd, gdouble UT);
81 gdouble hour24(gdouble hour);
82 gdouble angle2pi(gdouble angle);
83 
84 #endif				/* CALC_EPHEM_H */
85