libnova  v 0.15.0
ln_types.h
1 /*
2  * This library is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU Lesser General Public
4  * License as published by the Free Software Foundation; either
5  * version 2 of the License, or (at your option) any later version.
6  *
7  * This library is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10  * Lesser General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15  *
16  * Copyright (C) 2000 - 2005 Liam Girdwood
17  */
18 
19 #ifndef _LN_TYPES_H
20 #define _LN_TYPES_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__) || defined( __MWERKS__)
27 # if defined( LIBNOVA_STATIC )
28 # define LIBNOVA_EXPORT
29 # elif defined( LIBNOVA_SHARED )
30 # define LIBNOVA_EXPORT __declspec(dllexport)
31 # else
32 # define LIBNOVA_EXPORT
33 # endif
34 #else
35 # define LIBNOVA_EXPORT
36 #endif
37 
38 /* define some useful constants if they are not already defined */
39 #if(!defined(M_PI_2) && (!defined(_MSC_VER) || !defined(_USE_MATH_DEFINES)))
40 #define M_PI_2 1.5707963267948966192313216916398
41 #define M_PI_4 0.78539816339744830961566084581988
42 #define M_PI 3.1415926535897932384626433832795
43 #endif
44 
45 /* sideral day length in seconds and days (for JD)*/
46 #define LN_SIDEREAL_DAY_SEC 86164.09
47 #define LN_SIDEREAL_DAY_DAY LN_SIDEREAL_DAY_SEC/86400
48 
49 /* 1.1.2000 Julian Day & others */
50 #define JD2000 2451545.0
51 #define JD2050 2469807.50
52 
53 #define B1900 2415020.3135
54 #define B1950 2433282.4235
55 
66 struct ln_date
67 {
68  int years;
69  int months;
70  int days;
71  int hours;
72  int minutes;
73  double seconds;
74 };
75 
87 {
88  int years;
89  int months;
90  int days;
91  int hours;
92  int minutes;
93  double seconds;
94  long gmtoff;
95 };
96 
103 struct ln_dms
104 {
105  unsigned short neg;
106  unsigned short degrees;
107  unsigned short minutes;
108  double seconds;
109 };
110 
117 struct ln_hms
118 {
119  unsigned short hours;
120  unsigned short minutes;
121  double seconds;
122 };
123 
131 {
132  struct ln_hms ra;
133  struct ln_dms dec;
134 };
135 
143 {
144  struct ln_dms az;
145  struct ln_dms alt;
146 };
147 
148 
156 {
157  struct ln_dms lng;
158  struct ln_dms lat;
159 };
160 
161 
171 {
172  double ra;
173  double dec;
174 };
175 
185 {
186  double az;
188  double alt;
189 };
190 
191 
201 {
202  double lng;
203  double lat;
204 };
205 
206 
217 {
218  double L;
219  double B;
220  double R;
221 };
222 
238 {
239  double X;
240  double Y;
241  double Z;
242 };
243 
253 {
254  double l;
255  double b;
256 };
257 
266 {
267  double a;
268  double e;
269  double i;
270  double w;
271  double omega;
272  double n;
273  double JD;
274 };
275 
284 {
285  double q;
286  double i;
287  double w;
288  double omega;
289  double JD;
290 };
291 
300 {
301  double q;
302  double e;
303  double i;
304  double w;
305  double omega;
306  double JD;
307 };
308 
318 {
319  double rise;
320  double set;
321  double transit;
322 };
323 
333 {
334  double longitude;
335  double obliquity;
336  double ecliptic;
337 };
338 
339 /* Definitions of POSIX structures for Win32. */
340 #ifdef __WIN32__
341 
342 #include <time.h>
343 
344 struct timeval
345 {
346  time_t tv_sec; /* count of seconds since Jan. 1, 1970 */
347  long tv_usec; /* and microseconds */
348 };
349 
350 struct timezone
351 {
352  int tz_minuteswest; /* Minutes west of GMT */
353  int tz_dsttime; /* DST correction offset */
354 };
355 
356 #endif /* __WIN32__ */
357 
358 #ifdef __cplusplus
359 };
360 #endif
361 
362 #endif
363