libnova  v 0.16.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 #if !defined(__WIN32__) && (defined(__WIN32) || defined(WIN32))
23 #define __WIN32__
24 #define ALIGN32
25 #else
26 #define ALIGN32 __attribute__((aligned(32)))
27 #endif
28 
29 /* add a specific macro for mingw */
30 #if defined(__MINGW32__) || defined(__MINGW64__)
31 #define __MINGW__
32 #endif
33 
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 #if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) || defined( __BCPLUSPLUS__) || defined( __MWERKS__)
40 # if defined( LIBNOVA_STATIC )
41 # define LIBNOVA_EXPORT
42 # elif defined( LIBNOVA_SHARED )
43 # define LIBNOVA_EXPORT __declspec(dllexport)
44 # else
45 # define LIBNOVA_EXPORT
46 # endif
47 #else
48 # define LIBNOVA_EXPORT
49 #endif
50 
51 /* define some useful constants if they are not already defined */
52 #if(!defined(M_PI_2) && (!defined(_MSC_VER) || !defined(_USE_MATH_DEFINES)))
53 #define M_PI_2 1.5707963267948966192313216916398
54 #define M_PI_4 0.78539816339744830961566084581988
55 #define M_PI 3.1415926535897932384626433832795
56 #endif
57 
58 /* sidereal day length in seconds and days (for JD)*/
59 #define LN_SIDEREAL_DAY_SEC 86164.09
60 #define LN_SIDEREAL_DAY_DAY (LN_SIDEREAL_DAY_SEC / 86400.0)
61 
62 /* 1.1.2000 Julian Day & others */
63 #define JD2000 2451545.0
64 #define JD2050 2469807.50
65 
66 #define B1900 2415020.3135
67 #define B1950 2433282.4235
68 
79 struct ln_date {
80  int years;
81  int months;
82  int days;
83  int hours;
84  int minutes;
85  double seconds;
86 };
87 
98 struct ln_zonedate {
99  int years;
100  int months;
101  int days;
102  int hours;
103  int minutes;
104  double seconds;
105  long gmtoff;
106 };
107 
114 struct ln_dms {
115  unsigned short neg;
116  unsigned short degrees;
117  unsigned short minutes;
118  double seconds;
119 };
120 
127 struct ln_hms {
128  unsigned short hours;
129  unsigned short minutes;
130  double seconds;
131 };
132 
139 struct lnh_equ_posn {
140  struct ln_hms ra;
141  struct ln_dms dec;
142 };
143 
150 struct lnh_hrz_posn {
151  struct ln_dms az;
152  struct ln_dms alt;
153 };
154 
155 
163  struct ln_dms lng;
164  struct ln_dms lat;
165 };
166 
167 
176 struct ln_equ_posn {
177  double ra;
178  double dec;
179 };
180 
189 struct ln_hrz_posn {
190  double az;
192  double alt;
193 };
194 
195 
205  double lng;
206  double lat;
207 };
208 
209 
220  double L;
221  double B;
222  double R;
223 };
224 
239 struct ln_rect_posn {
240  double X;
241  double Y;
242  double Z;
243 };
244 
253 struct ln_gal_posn {
254  double l;
255  double b;
256 };
257 
265 struct ln_ell_orbit {
266  double a;
267  double e;
268  double i;
269  double w;
270  double omega;
271  double n;
272  double JD;
273 };
274 
282 struct ln_par_orbit {
283  double q;
284  double i;
285  double w;
286  double omega;
287  double JD;
288 };
289 
297 struct ln_hyp_orbit {
298  double q;
299  double e;
300  double i;
301  double w;
302  double omega;
303  double JD;
304 };
305 
314 struct ln_rst_time {
315  double rise;
316  double set;
317  double transit;
318 };
319 
328 struct ln_nutation {
329  double longitude;
330  double obliquity;
331  double ecliptic;
332 };
333 
334 #if defined(__WIN32__) && !defined(__MINGW__)
335 
336 #include <time.h>
337 
338 struct timeval
339 {
340  time_t tv_sec; /* count of seconds since Jan. 1, 1970 */
341  long tv_usec; /* and microseconds */
342 };
343 
344 struct timezone
345 {
346  int tz_minuteswest; /* Minutes west of GMT */
347  int tz_dsttime; /* DST correction offset */
348 };
349 
350 #endif /* __WIN32__ */
351 
352 #ifdef __cplusplus
353 };
354 #endif
355 
356 #endif
357 
ln_ell_orbit::e
double e
Definition: ln_types.h:267
ln_ell_orbit::omega
double omega
Definition: ln_types.h:270
lnh_equ_posn::ra
struct ln_hms ra
Definition: ln_types.h:140
ln_zonedate::months
int months
Definition: ln_types.h:100
ln_hyp_orbit::q
double q
Definition: ln_types.h:298
ln_rect_posn::Z
double Z
Definition: ln_types.h:242
lnh_lnlat_posn::lat
struct ln_dms lat
Definition: ln_types.h:164
ln_zonedate::seconds
double seconds
Definition: ln_types.h:104
ln_date::years
int years
Definition: ln_types.h:80
ln_date::seconds
double seconds
Definition: ln_types.h:85
ln_lnlat_posn::lng
double lng
Definition: ln_types.h:205
ln_hrz_posn
Horizontal Coordinates.
Definition: ln_types.h:189
ln_rst_time
Rise, Set and Transit times.
Definition: ln_types.h:314
ln_rect_posn::X
double X
Definition: ln_types.h:240
ln_hyp_orbit::e
double e
Definition: ln_types.h:299
ln_hrz_posn::az
double az
Definition: ln_types.h:190
ln_rst_time::set
double set
Definition: ln_types.h:316
ln_hms::minutes
unsigned short minutes
Definition: ln_types.h:129
ln_equ_posn::ra
double ra
Definition: ln_types.h:177
ln_hyp_orbit::i
double i
Definition: ln_types.h:300
lnh_equ_posn::dec
struct ln_dms dec
Definition: ln_types.h:141
ln_nutation::obliquity
double obliquity
Definition: ln_types.h:330
ln_ell_orbit::a
double a
Definition: ln_types.h:266
ln_par_orbit::q
double q
Definition: ln_types.h:283
ln_ell_orbit
Elliptic Orbital elements.
Definition: ln_types.h:265
ln_nutation::ecliptic
double ecliptic
Definition: ln_types.h:331
ln_par_orbit
Parabolic Orbital elements.
Definition: ln_types.h:282
lnh_lnlat_posn
Ecliptical (or celestial) Latitude and Longitude.
Definition: ln_types.h:162
ln_date::days
int days
Definition: ln_types.h:82
ln_hms::seconds
double seconds
Definition: ln_types.h:130
ln_helio_posn
Heliocentric position.
Definition: ln_types.h:219
ln_ell_orbit::n
double n
Definition: ln_types.h:271
ln_dms::degrees
unsigned short degrees
Definition: ln_types.h:116
ln_hyp_orbit
Hyperbolic Orbital elements.
Definition: ln_types.h:297
lnh_lnlat_posn::lng
struct ln_dms lng
Definition: ln_types.h:163
ln_zonedate::days
int days
Definition: ln_types.h:101
ln_ell_orbit::i
double i
Definition: ln_types.h:268
ln_rst_time::transit
double transit
Definition: ln_types.h:317
ln_hyp_orbit::JD
double JD
Definition: ln_types.h:303
lnh_equ_posn
Right Ascension and Declination.
Definition: ln_types.h:139
ln_zonedate::gmtoff
long gmtoff
Definition: ln_types.h:105
ln_par_orbit::w
double w
Definition: ln_types.h:285
ln_gal_posn::b
double b
Definition: ln_types.h:255
ln_dms::minutes
unsigned short minutes
Definition: ln_types.h:117
ln_hms
Hours, minutes and seconds.
Definition: ln_types.h:127
ln_dms
Degrees, minutes and seconds.
Definition: ln_types.h:114
ln_hyp_orbit::omega
double omega
Definition: ln_types.h:302
ln_date
Human readable Date and time used by libnova.
Definition: ln_types.h:79
lnh_hrz_posn::alt
struct ln_dms alt
Definition: ln_types.h:152
ln_lnlat_posn::lat
double lat
Definition: ln_types.h:206
ln_date::hours
int hours
Definition: ln_types.h:83
ln_helio_posn::R
double R
Definition: ln_types.h:222
ln_gal_posn::l
double l
Definition: ln_types.h:254
lnh_hrz_posn
Azimuth and Altitude.
Definition: ln_types.h:150
ln_date::minutes
int minutes
Definition: ln_types.h:84
ln_hrz_posn::alt
double alt
Definition: ln_types.h:192
ln_nutation::longitude
double longitude
Definition: ln_types.h:329
ln_rect_posn::Y
double Y
Definition: ln_types.h:241
ln_nutation
Nutation in longitude, ecliptic and obliquity.
Definition: ln_types.h:328
ln_helio_posn::B
double B
Definition: ln_types.h:221
ln_gal_posn
Galactic coordinates.
Definition: ln_types.h:253
ln_dms::neg
unsigned short neg
Definition: ln_types.h:115
ln_par_orbit::i
double i
Definition: ln_types.h:284
ln_dms::seconds
double seconds
Definition: ln_types.h:118
lnh_hrz_posn::az
struct ln_dms az
Definition: ln_types.h:151
ln_zonedate::minutes
int minutes
Definition: ln_types.h:103
ln_par_orbit::JD
double JD
Definition: ln_types.h:287
ln_par_orbit::omega
double omega
Definition: ln_types.h:286
ln_rst_time::rise
double rise
Definition: ln_types.h:315
ln_helio_posn::L
double L
Definition: ln_types.h:220
ln_zonedate::years
int years
Definition: ln_types.h:99
ln_date::months
int months
Definition: ln_types.h:81
ln_ell_orbit::JD
double JD
Definition: ln_types.h:272
ln_lnlat_posn
Ecliptical (or celestial) Longitude and Latitude.
Definition: ln_types.h:204
ln_zonedate
Human readable Date and time with timezone information used by libnova.
Definition: ln_types.h:98
ln_equ_posn
Equatorial Coordinates.
Definition: ln_types.h:176
ln_ell_orbit::w
double w
Definition: ln_types.h:269
ln_equ_posn::dec
double dec
Definition: ln_types.h:178
ln_hms::hours
unsigned short hours
Definition: ln_types.h:128
ln_zonedate::hours
int hours
Definition: ln_types.h:102
ln_hyp_orbit::w
double w
Definition: ln_types.h:301
ln_rect_posn
Rectangular coordinates.
Definition: ln_types.h:239