-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAstronomicalAlgorithms.h
More file actions
170 lines (120 loc) · 5.38 KB
/
Copy pathAstronomicalAlgorithms.h
File metadata and controls
170 lines (120 loc) · 5.38 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/**************************************************************************
AstronomicalAlgorithms
A portable ANSI C implementation of some of the algorithms published in
Astronomical Algorithms
by Jean Meeus
2nd edition (December 1998)
Willmann-Bell
ISBN: 0943396638
by Christophe DAVID (christophe.david@christophedavid.org)
You may use parts of this source code as long as
- you mention clearly that its latest version can be obtained
free of charge at
http://www.christophedavid.org/
AND
- you send me a free copy of whatever you make using this code.
Comments and suggestions welcome.
**************************************************************************/
/*!
@mainpage ASTRONOMICAL ALGORITHMS
- <b>see http://www.christophedavid.org for details</b>
- email : christophe.david@christophedavid.org
*/
/*!
@file
@brief AstronomicalAlgorithms header file
@author Christophe DAVID \n
christophe.david@christophedavid.org \n
http://www.christophedavid.org
@since 01/07/1999
@version 1.0
@date 05/04/2001
@bug no known bug
@remarks
The screen output of this program is quite long.
It is easier to re-direct it to a file and then read this file with an editor
- AstronomicalAlgorithms > aa.txt
- edit aa.txt
@if logger
@image html http://www.mot.be/cgi-bin/logger.cgi?AstronomicalAlgorithms.h
@endif
*/
#ifndef ASTRONOMICAL_ALGORITHMS_H
#define ASTRONOMICAL_ALGORITHMS_H
/****************************************************************************/
#define PAGE_007_TEST
#define PAGE_008_TEST
#define PAGE_009_TEST
#define PAGE_013_TEST
#define PAGE_017_TEST
#define PAGE_018_TEST
#define PAGE_019_TEST
#define PAGE_020_TEST
#define PAGE_021_TEST
#define PAGE_024_TEST
#define PAGE_061_TEST
#define PAGE_062_TEST
#define PAGE_063_TEST
#define PAGE_064_TEST
#define PAGE_065_TEST
#define PAGE_066_TEST
#define PAGE_067_TEST
#define PAGE_082_TEST
#define PAGE_165_TEST
#define PAGE_169_TEST
#define PAGE_353_TEST
/****************************************************************************/
#define do_e (double) 2.71828182845904523536 /* p. 407 */
#define do_pi (double) 3.14159265358979323846 /* p. 407 */
#define DEGREES2RADIAN(x) ((double) x * (double) 0.017453292519943) /* p. 407 */
#define RADIAN2DEGREES(x) ((double) x * (double) 57.295779513082) /* p. 407 */
/****************************************************************************/
/* degrees, minutes, seconds to decimal degrees */
/* p009 */
#define DEGMINSEC2DECIMAL(sign, d, m, s) \
(((double) sign d) + (((double) sign m) / (double) 60) \
+ (((double) sign s) / (double) 3600))
/* p008 */
#define RIGHTASC2DECIMAL(d, m, s) ((double) 15 * DEGMINSEC2DECIMAL(+, d, m, s))
/* p021 */
#define ROUND(x) \
((double) x - floor((double) x) < (double) 0.5 ? floor(x) : ceil(x))
/****************************************************************************/
#define REDUCE360(x) \
(x >= 0 ? fmod(x, (double) 360) : (double) 360 + fmod(x, (double) 360))
/****************************************************************************/
/* geocentric rectangular coordinates of an observer */
/* p082 */
#define DO_EARTH_EQUATORIAL_RADIUS (double) 6378140 /* meters */ /*a*/
#define DO_EARTH_FLATTENING (double) ((double) 1 / (double) 298.257)/*f*/
/****************************************************************************/
#define DO_JULIAN_CENTURIES(x) \
(((double) x - (double) 2451545 ) / (double) 36525) /* p163 */
/****************************************************************************/
#define LO_DEFAULT_WORKSTRING_LENGTH 512
#define JULIAN 0
#define GREGORIAN 1
#define CHRISTIAN 1
/****************************************************************************/
int ShDateFromJulianDay(double doJD, double *pdoY, double *pdoMonth, double *pdoD,
double *pdoH, double *pdoMin, double *pdoS);
int ShDateFromYearDay(double doYD, short shYear, double *pdoM, double *pdoD);
int ShDayOfWeek(short *pshDOW, double doY, double doM, double doD);
int ShDayOfYear(short *pshDOY, double doY, double doM, double doD);
int ShEasterSunday(short shYear, short *pshM, short *pshD, short shCalendar, short shReligion);
int ShGreenwichMeanSideralTime(double *pdoGreenwichSideralTime, short shY,
short shM, short shD, short shH, short shm,
short shS, short shCalendar, short shMode);
short ShInterpolationDifferences(double * padoTableValues,
short shNumberOfTableValues,
double * padoDifferences,
size_t stSizeOfpadoDifferences,
short shDifferenceRank);
int ShIsLeapYear(short *pshResult, short shYear, short shCalendar);
int ShJulianDay(double *pdoJD, double doY, double doM, double doD, short shCalendar);
int ShMoonPhaseJDE(double *pdoResult, double doYear, short shPhase);
double DoRhoCosPhiTwo(double doPhi, double doHeight);
double DoRhoSinPhiTwo(double doPhi, double doHeight);
int ShSolarCoordinates(double doJD, double *pdoalpha, double *pdodelta, short shMethod);
#endif
/* eod of file */