File: CalcEphem.h

package info (click to toggle)
gkrellmoon 0.6-6
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 280 kB
  • sloc: ansic: 1,231; makefile: 52
file content (84 lines) | stat: -rw-r--r-- 2,934 bytes parent folder | download | duplicates (5)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#ifndef CALC_EPHEM_H
#define CALC_EPHEM_H
/* (C) Mike Henderson <mghenderson@lanl.gov>.
 *
 * I've added function prototypes, a couple of data to the CTrans
 * structure, converted standard data types to their glib counterparts
 * (as compared to original wmMoonClock code), and piped the whole
 * thing through indent.
 *
 * josh buhl <jbuhl@users.sourceforge.net> 
 */

#include <glib.h>

#include <stdio.h>
#include <math.h>

#define DegPerRad       57.29577951308232087680
#define RadPerDeg        0.01745329251994329576


typedef struct Vector {
	gdouble x;
	gdouble y;
	gdouble z;
} Vector;


typedef struct Position {
	gdouble x;
	gdouble y;
	gdouble z;
} Position;


typedef struct CTrans {
	gdouble UT;		/* Universal Time (in decimal hours) */
	gint year;		/* 2 digit year */
	gint month;		/* 2 digit month of year */
	gint day;		/* 2 digit day of month */
	gint doy;		/* 3 digit Day Of Year */
	gint dow;		/* 1 digit day of week */
	gchar dowstr[80];	/* Day of week String (e.g. "Sun") */
	gdouble gmst;		/* Greenwich Mean Sidereal Time */
	gdouble eccentricity;	/* Eccentricity of Earth-Sun orbit */
	gdouble epsilon;	/* Obliquity of the ecliptic (in radians) */
	gdouble lambda_sun;	/* Ecliptic Long. of Sun (in radians) */
	gdouble earth_sun_dist;	/* Earth-Sun distance (in units of earth radii) */
	gdouble RA_sun;		/* Right Ascention of Sun (in degrees) */
	gdouble DEC_sun;	/* Declination of Sun (in degrees) */
	Vector Sun;		/* direction of Sun in GEI system (unit vector) */
	Vector EcPole;		/* direction of Ecliptic Pole in GEI system (unit vector) */
	gdouble psi;		/* Geodipole tilt angle (in radians) */
	gdouble Dipole_Gcolat;	/* Geographic colat of centered dipole axis (deg.) */
	gdouble Dipole_Glon;	/* Geographic long. of centered dipole axis (deg.) */

	gdouble RA_moon;	/* Right Ascention of Moon (in degrees) */
	gdouble DEC_moon;	/* Declination of Moon (in degrees) */
	gdouble MoonPhase;	/* The Phase of the Moon (in days) */
	gdouble MoonAge;	/* Age of Moon in Days */
	gdouble EarthMoonDistance;	/* Distance between the Earth and Moon (in earth-radii) */
	gdouble Glat;		/* Geographic Latitude of Observer */
	gdouble Glon;		/* Geographic Longitude of Observer */
	gdouble h_moon;		/* Altitude of Moon (in degrees) */
	gdouble A_moon;		/* Azimuth of Moon (in degrees) */
	gint Visible;		/* Whether or not moon is above horizon */

	/* Additional Data for glunarclock */
	gdouble SinGlat;	/* data calc. in CalcEphem, used in MoonRise */
	gdouble CosGlat;	/* data calc. in CalcEphem, used in MoonRise */

	gdouble LAT;		/* Local Apparent Time (sundial time) */
	gdouble LMT;		/* Local Mean Time (eqn of time corrected LAT) */
	gdouble LST;		/* Local Standard Time */
	/* end additional data */
} CTrans;


void CalcEphem(glong date, gdouble UT, CTrans * c);
gdouble jd(gint ny, gint nm, gint nd, gdouble UT);
gdouble hour24(gdouble hour);
gdouble angle2pi(gdouble angle);

#endif				/* CALC_EPHEM_H */