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 module nova.ln_types;
20 
21 /* sidereal day length in seconds and days (for JD)*/
22 enum LN_SIDEREAL_DAY_SEC = 86164.09;
23 enum LN_SIDEREAL_DAY_DAY = (LN_SIDEREAL_DAY_SEC / 86400.0);
24 
25 /* 1.1.2000 Julian Day & others */
26 enum JD2000 =          2451545.0;
27 enum JD2050 =          2469807.50;
28 
29 enum B1900 =           2415020.3135;
30 enum B1950 =           2433282.4235;
31 
32 /*!
33 ** Date
34 * \struct ln_date
35 * \brief Human readable Date and time used by libnova
36 *
37 * This is the Human readable (easy printf) date format used
38 * by libnova. It's always in UTC. For local time, please use
39 * ln_zonedate.
40 */
41 
42 struct ln_date {
43     int years; 		/*!< Years. All values are valid */
44     int months;		/*!< Months. Valid values : 1 (January) - 12 (December) */
45     int days; 		/*!< Days. Valid values 1 - 28,29,30,31 Depends on month.*/
46     int hours; 		/*!< Hours. Valid values 0 - 23. */
47     int minutes; 	/*!< Minutes. Valid values 0 - 59. */
48     double seconds;	/*!< Seconds. Valid values 0 - 59.99999.... */
49 }
50 
51 /*!
52 ** Zone date
53 * \struct ln_zonedate
54 * \brief Human readable Date and time with timezone information used
55 * by libnova
56 *
57 * This is the Human readable (easy printf) date with timezone format
58 * used by libnova.
59 */
60 
61 struct ln_zonedate {
62     int years; 		/*!< Years. All values are valid */
63     int months;		/*!< Months. Valid values : 1 (January) - 12 (December) */
64     int days; 		/*!< Days. Valid values 1 - 28,29,30,31 Depends on month.*/
65     int hours; 		/*!< Hours. Valid values 0 - 23. */
66     int minutes; 	/*!< Minutes. Valid values 0 - 59. */
67     double seconds;	/*!< Seconds. Valid values 0 - 59.99999.... */
68     long gmtoff;        /*!< Timezone offset. Seconds east of UTC. Valid values 0..86400 */
69 }
70 
71 /*! \struct ln_dms
72 ** \brief Degrees, minutes and seconds.
73 *
74 * Human readable Angle in degrees, minutes and seconds
75 */
76 
77 struct ln_dms {
78     ushort neg;         /*!< Non zero if negative */
79     ushort degrees;   	/*!< Degrees. Valid 0 - 360 */
80     ushort minutes;   	/*!< Minutes. Valid 0 - 59 */
81     double seconds;		/*!< Seconds. Valid 0 - 59.9999... */
82 }
83 
84 /*! \struct ln_hms
85 ** \brief Hours, minutes and seconds.
86 *
87 * Human readable Angle in hours, minutes and seconds
88 */
89 
90 struct ln_hms {
91     ushort hours;		/*!< Hours. Valid 0 - 23 */
92     ushort minutes;		/*!< Minutes. Valid 0 - 59 */
93     double seconds;				/*!< Seconds. Valid 0 - 59.9999... */
94 }
95 
96 /*! \struct lnh_equ_posn
97 ** \brief Right Ascension and Declination.
98 *
99 * Human readable Equatorial Coordinates.
100 */
101 
102 struct lnh_equ_posn {
103     ln_hms ra;	/*!< RA. Object right ascension.*/
104     ln_dms dec;	/*!< DEC. Object declination */
105 }
106 
107 /*! \struct lnh_hrz_posn
108 ** \brief Azimuth and Altitude.
109 *
110 * Human readable Horizontal Coordinates.
111 */
112 
113 struct lnh_hrz_posn {
114     ln_dms az;	/*!< AZ. Object azimuth. */
115     ln_dms alt;	/*!< ALT. Object altitude. */
116 }
117 
118 
119 /*! \struct lnh_lnlat_posn
120 ** \brief Ecliptical (or celestial) Latitude and Longitude.
121 *
122 * Human readable Ecliptical (or celestial) Longitude and Latitude.
123 */
124 
125 struct lnh_lnlat_posn {
126     ln_dms lng; /*!< longitude. Object longitude.*/
127     ln_dms lat; /*!< latitude. Object latitude */
128 }
129 
130 
131 /*! \struct ln_equ_posn
132 ** \brief Equatorial Coordinates.
133 *
134 * The Right Ascension and Declination of an object.
135 *
136 * Angles are expressed in degrees.
137 */
138 
139 struct ln_equ_posn {
140     double ra;	/*!< RA. Object right ascension in degrees.*/
141     double dec;	/*!< DEC. Object declination */
142 }
143 
144 /*! \struct ln_hrz_posn
145 ** \brief Horizontal Coordinates.
146 *
147 * The Azimuth and Altitude of an object.
148 *
149 * Angles are expressed in degrees.
150 */
151 
152 struct ln_hrz_posn {
153     double az;	/*!< AZ. Object azimuth. <p>
154 		  0 deg = South, 90 deg = West, 180 deg = Nord, 270 deg = East */
155     double alt;	/*!< ALT. Object altitude. <p> 0 deg = horizon, 90 deg = zenit, -90 deg = nadir */
156 }
157 
158 
159 /*! \struct ln_lnlat_posn
160 ** \brief Ecliptical (or celestial) Longitude and Latitude.
161 *
162 * The Ecliptical (or celestial) Latitude and Longitude of and object.
163 *
164 * Angles are expressed in degrees. East is positive, West negative.
165 */
166 
167 struct ln_lnlat_posn {
168     double lng; /*!< longitude. Object longitude. */
169     double lat; /*!< latitude. Object latitude */
170 }
171 
172 
173 /*! \struct ln_helio_posn
174 * \brief Heliocentric position
175 *
176 * A heliocentric position is an objects position relative to the
177 * centre of the Sun.
178 *
179 * Angles are expressed in degrees.
180 * Radius vector is in AU.
181 */
182 struct ln_helio_posn {
183 	double L;	/*!< Heliocentric longitude */
184 	double B;	/*!< Heliocentric latitude */
185 	double R;	/*!< Heliocentric radius vector, AU */
186 }
187 
188 /*! \struct ln_rect_posn
189 * \brief Rectangular coordinates
190 *
191 * Rectangular Coordinates of a body. These coordinates can be either
192 * geocentric or heliocentric.
193 *
194 * A heliocentric position is an objects position relative to the
195 * centre of the Sun.
196 * A geocentric position is an objects position relative to the centre
197 * of the Earth.
198 *
199 * * X is toward the vernal equinox
200 * * Y is at 90° longitude on the ecliptic plane
201 * * Z is perpinducular to the ecliptic plane, in the northern direction
202 *
203 * Position is in units of AU for planets and in units of km
204 * for the Moon.
205 */
206 struct ln_rect_posn {
207 	double X;	/*!< Rectangular X coordinate, toward vernal equinox */
208 	double Y;	/*!< Rectangular Y coordinate, 90 degrees Longitude */
209 	double Z;	/*!< Rectangular Z coordinate, north */
210 }
211 
212 /*!
213 * \struct ln_gal_posn
214 * \brief Galactic coordinates
215 *
216 * The Galactic Latitude and Longitude of and object.
217 *
218 * Angles are expressed in degrees.
219 */
220 struct ln_gal_posn {
221 	double l;	/*!< Galactic longitude (degrees) */
222 	double b;	/*!< Galactic latitude (degrees) */
223 }
224 
225 /*!
226 * \struct ln_ell_orbit
227 * \brief Elliptic Orbital elements
228 *
229 *  TODO.
230 * Angles are expressed in degrees.
231 */
232 struct ln_ell_orbit {
233 	double a;	/*!< Semi major axis, in AU */
234 	double e;	/*!< Eccentricity */
235 	double i;	/*!< Inclination in degrees */
236 	double w;	/*!< Argument of perihelion in degrees */
237 	double omega;	/*!< Longitude of ascending node in degrees*/
238 	double n;	/*!< Mean motion, in degrees/day */
239 	double JD;	/*!< Time of last passage in Perihelion, in julian day*/
240 }
241 
242 /*!
243 * \struct ln_par_orbit
244 * \brief Parabolic Orbital elements
245 *
246 *  TODO.
247 * Angles are expressed in degrees.
248 */
249 struct ln_par_orbit {
250 	double q;	/*!< Perihelion distance in AU */
251 	double i;	/*!< Inclination in degrees */
252 	double w;	/*!< Argument of perihelion in degrees */
253 	double omega;	/*!< Longitude of ascending node in degrees*/
254 	double JD;	/*!< Time of last passage in Perihelion, in julian day */
255 }
256 
257 /*!
258 * \struct ln_hyp_orbit
259 * \brief Hyperbolic Orbital elements
260 *
261 *  TODO.
262 * Angles are expressed in degrees.
263 */
264 struct ln_hyp_orbit {
265 	double q;	/*!< Perihelion distance in AU */
266 	double e;	/*!< Eccentricity */
267 	double i;	/*!< Inclination in degrees */
268 	double w;	/*!< Argument of perihelion in degrees */
269 	double omega;	/*!< Longitude of ascending node in degrees*/
270 	double JD;	/*!< Time of last passage in Perihelion, in julian day*/
271 }
272 
273 /*!
274 * \struct ln_rst_time
275 * \brief Rise, Set and Transit times.
276 *
277 * Contains the Rise, Set and transit times for a body.
278 *
279 * Angles are expressed in degrees.
280 */
281 struct ln_rst_time {
282 	double rise;		/*!< Rise time in JD */
283 	double set;			/*!< Set time in JD */
284 	double transit;		/*!< Transit time in JD */
285 }
286 
287 /*!
288 * \struct ln_nutation
289 * \brief Nutation in longitude, ecliptic and obliquity.
290 *
291 * Contains Nutation in longitude, obliquity and ecliptic obliquity.
292 *
293 * Angles are expressed in degrees.
294 */
295 struct ln_nutation {
296 	double longitude;	/*!< Nutation in longitude, in degrees */
297 	double obliquity;	/*!< Nutation in obliquity, in degrees */
298 	double ecliptic;	/*!< Mean obliquity of the ecliptic, in degrees */
299 }