1 | #ifndef _ASTRO_H
|
---|
2 | #define _ASTRO_H
|
---|
3 |
|
---|
4 | #include <stdio.h>
|
---|
5 |
|
---|
6 | #ifndef PI
|
---|
7 | #define PI 3.141592653589793
|
---|
8 | #endif
|
---|
9 |
|
---|
10 | /* conversions among hours (of ra), degrees and radians. */
|
---|
11 | #define degrad(x) ((x)*PI/180.)
|
---|
12 | #define raddeg(x) ((x)*180./PI)
|
---|
13 | #define hrdeg(x) ((x)*15.)
|
---|
14 | #define deghr(x) ((x)/15.)
|
---|
15 | #define hrrad(x) degrad(hrdeg(x))
|
---|
16 | #define radhr(x) deghr(raddeg(x))
|
---|
17 |
|
---|
18 | /* ratio of from synodic (solar) to sidereal (stellar) rate */
|
---|
19 | #define SIDRATE .9972695677
|
---|
20 |
|
---|
21 | /* manifest names for planets.
|
---|
22 | * N.B. must coincide with usage in pelement.c and plans.c.
|
---|
23 | * N.B. only the first 8 are valid for use with plans().
|
---|
24 | */
|
---|
25 | typedef enum {
|
---|
26 | MERCURY,
|
---|
27 | VENUS,
|
---|
28 | MARS,
|
---|
29 | JUPITER,
|
---|
30 | SATURN,
|
---|
31 | URANUS,
|
---|
32 | NEPTUNE,
|
---|
33 | PLUTO,
|
---|
34 | SUN,
|
---|
35 | MOON,
|
---|
36 | NOBJ /* total number of basic objects */
|
---|
37 | } PLCode;
|
---|
38 |
|
---|
39 | /* moon constants for pl_moon */
|
---|
40 | typedef enum {
|
---|
41 | X_PLANET = 0, /* use to mean planet itself */
|
---|
42 | PHOBOS = NOBJ, DEIMOS,
|
---|
43 | IO, EUROPA, GANYMEDE, CALLISTO,
|
---|
44 | MIMAS, ENCELADUS, TETHYS, DIONE, RHEA, TITAN, HYPERION, IAPETUS,
|
---|
45 | ARIEL, UMBRIEL, TITANIA, OBERON, MIRANDA,
|
---|
46 | NBUILTIN
|
---|
47 | } MCode;
|
---|
48 |
|
---|
49 | /* starting point for MJD calculations
|
---|
50 | */
|
---|
51 | #define MJD0 2415020.0
|
---|
52 | #define J2000 (2451545.0 - MJD0) /* yes, 2000 January 1 at 12h */
|
---|
53 |
|
---|
54 | /* the Now and Obj typedefs.
|
---|
55 | * also, a few miscellaneous constants and declarations.
|
---|
56 | */
|
---|
57 |
|
---|
58 | #define SPD (24.0*3600.0) /* seconds per day */
|
---|
59 | #define MAU (1.4959787e11) /* m / au */
|
---|
60 | #define LTAU 499.005 /* seconds light takes to travel 1 AU */
|
---|
61 | #define ERAD (6.37816e6) /* earth equitorial radius, m */
|
---|
62 | #define MRAD (1.740e6) /* moon equitorial radius, m */
|
---|
63 | #define SRAD (6.95e8) /* sun equitorial radius, m */
|
---|
64 | #define FTPM 3.28084 /* ft per m */
|
---|
65 | #define ESAT_MAG 2 /* default satellite magnitude */
|
---|
66 | #define FAST_SAT_RPD 0.25 /* max earth sat rev/day considered "fast" */
|
---|
67 |
|
---|
68 | #define EOD (-9786) /* special epoch flag: use epoch of date */
|
---|
69 |
|
---|
70 | /* info about the local observing circumstances and misc preferences */
|
---|
71 | typedef struct {
|
---|
72 | double n_mjd; /* modified Julian date, ie, days since
|
---|
73 | * Jan 0.5 1900 (== 12 noon, Dec 30, 1899), utc.
|
---|
74 | * enough precision to get well better than 1 second.
|
---|
75 | * N.B. if not first member, must move NOMJD inits.
|
---|
76 | */
|
---|
77 | double n_lat; /* geographic (surface-normal) lt, >0 north, rads */
|
---|
78 | double n_lng; /* longitude, >0 east, rads */
|
---|
79 | double n_tz; /* time zone, hrs behind UTC */
|
---|
80 | double n_temp; /* atmospheric temp, degrees C */
|
---|
81 | double n_pressure; /* atmospheric pressure, mBar */
|
---|
82 | double n_elev; /* elevation above sea level, earth radii */
|
---|
83 | double n_dip; /* dip of sun below hzn at twilight, >0 below, rads */
|
---|
84 | double n_epoch; /* desired precession display ep as an mjd, or EOD */
|
---|
85 | char n_tznm[8]; /* time zone name; 7 chars or less, always 0 at end */
|
---|
86 | } Now;
|
---|
87 |
|
---|
88 | /* handy shorthands for fields in a Now pointer, np */
|
---|
89 | #define mjd np->n_mjd
|
---|
90 | #define lat np->n_lat
|
---|
91 | #define lng np->n_lng
|
---|
92 | #define tz np->n_tz
|
---|
93 | #define temp np->n_temp
|
---|
94 | #define pressure np->n_pressure
|
---|
95 | #define elev np->n_elev
|
---|
96 | #define dip np->n_dip
|
---|
97 | #define epoch np->n_epoch
|
---|
98 | #define tznm np->n_tznm
|
---|
99 | #define mjed mm_mjed(np)
|
---|
100 |
|
---|
101 | /* structures to describe objects of various types.
|
---|
102 | */
|
---|
103 |
|
---|
104 | /* magnitude values in two different systems */
|
---|
105 | typedef struct {
|
---|
106 | float m1, m2; /* either g/k or H/G, depending on... */
|
---|
107 | int whichm; /* one of MAG_gk or MAG_HG */
|
---|
108 | } Mag;
|
---|
109 |
|
---|
110 | /* whichm */
|
---|
111 | #define MAG_HG 0 /* using 0 makes HG the initial default */
|
---|
112 | #define MAG_gk 1
|
---|
113 |
|
---|
114 | /* we actually store magnitudes times this scale factor in a short int */
|
---|
115 | #define MAGSCALE 100.0
|
---|
116 | #define set_smag(op,m) ((op)->s_mag = (short)floor((m)*MAGSCALE + 0.5))
|
---|
117 | #define set_fmag(op,m) ((op)->f_mag = (short)floor((m)*MAGSCALE + 0.5))
|
---|
118 | #define get_mag(op) ((op)->s_mag / MAGSCALE)
|
---|
119 | #define get_fmag(op) ((op)->f_mag / MAGSCALE)
|
---|
120 |
|
---|
121 | /* longest object name, including trailing '\0' */
|
---|
122 | #define MAXNM 21
|
---|
123 |
|
---|
124 | typedef unsigned char ObjType_t;
|
---|
125 | typedef unsigned char ObjAge_t;
|
---|
126 | typedef unsigned char byte;
|
---|
127 |
|
---|
128 | /* Obj is a massive union.
|
---|
129 | * many fields are in common so we use macros to make things a little easier.
|
---|
130 | */
|
---|
131 |
|
---|
132 | /* fields common to *all* structs in the Obj union */
|
---|
133 | #define OBJ_COMMON_FLDS \
|
---|
134 | ObjType_t co_type; /* current object type; see flags, below */ \
|
---|
135 | byte co_flags; /* FUSER*... used by others */ \
|
---|
136 | ObjAge_t co_age; /* update aging code; see db.c */ \
|
---|
137 | char co_name[MAXNM];/* name, including \0 */ \
|
---|
138 | float co_ra; /* geo/topo app/mean ra, rads */ \
|
---|
139 | float co_dec; /* geo/topo app/mean dec, rads */ \
|
---|
140 | float co_gaera; /* geo apparent ra, rads */ \
|
---|
141 | float co_gaedec; /* geo apparent dec, rads */ \
|
---|
142 | float co_az; /* azimuth, >0 e of n, rads */ \
|
---|
143 | float co_alt; /* altitude above topocentric horizon, rads */ \
|
---|
144 | float co_elong; /* angular sep btwen obj and sun, >0 E, degs */ \
|
---|
145 | float co_size; /* angular size, arc secs */ \
|
---|
146 | short co_mag /* visual magnitude * MAGSCALE */
|
---|
147 |
|
---|
148 | /* fields common to all solar system objects in the Obj union */
|
---|
149 | #define OBJ_SOLSYS_FLDS \
|
---|
150 | OBJ_COMMON_FLDS; /* all the fixed ones plus ... */ \
|
---|
151 | float so_sdist; /* dist from object to sun, au */ \
|
---|
152 | float so_edist; /* dist from object to earth, au */ \
|
---|
153 | float so_hlong; /* heliocentric longitude, rads */ \
|
---|
154 | float so_hlat; /* heliocentric latitude, rads */ \
|
---|
155 | float so_phase /* phase, % */
|
---|
156 |
|
---|
157 | /* fields common to all fixed objects in the Obj union */
|
---|
158 | #define OBJ_FIXED_FLDS \
|
---|
159 | char fo_spect[2]; /* spectral codes, if appropriate */ \
|
---|
160 | float fo_epoch; /* eq of ra/dec and time when pm=0; mjd */ \
|
---|
161 | float fo_ra; /* ra, rads, in epoch frame */ \
|
---|
162 | float fo_dec; /* dec, rads, in epoch frame */ \
|
---|
163 | float fo_pmra; /* ra proper motion, rads/day/cos(dec) */ \
|
---|
164 | float fo_pmdec; /* dec proper motion, rads/day */ \
|
---|
165 | char fo_class /* object class */
|
---|
166 |
|
---|
167 | /* a generic object */
|
---|
168 | typedef struct {
|
---|
169 | OBJ_COMMON_FLDS;
|
---|
170 | } ObjAny;
|
---|
171 |
|
---|
172 | /* a generic sol system object */
|
---|
173 | typedef struct {
|
---|
174 | OBJ_SOLSYS_FLDS;
|
---|
175 | } ObjSS;
|
---|
176 |
|
---|
177 | /* basic Fixed object info.
|
---|
178 | */
|
---|
179 | typedef struct {
|
---|
180 | OBJ_COMMON_FLDS;
|
---|
181 | OBJ_FIXED_FLDS;
|
---|
182 |
|
---|
183 | /* following are for galaxies */
|
---|
184 | byte fo_ratio; /* minor/major diameter ratio. use s/get_ratio() */
|
---|
185 | byte fo_pa; /* position angle, E of N, rads. use s/get_pa() */
|
---|
186 | } ObjF;
|
---|
187 |
|
---|
188 | /* true-orbit parameters of binary-star object type */
|
---|
189 | typedef struct {
|
---|
190 | float bo_T; /* epoch of periastron, years */
|
---|
191 | float bo_e; /* eccentricity */
|
---|
192 | float bo_o; /* argument of periastron, degress */
|
---|
193 | float bo_O; /* longitude of node, degrees */
|
---|
194 | float bo_i; /* inclination to plane of sky, degrees */
|
---|
195 | float bo_a; /* semi major axis, arc secs */
|
---|
196 | float bo_P; /* period, years */
|
---|
197 |
|
---|
198 | /* companion position, computed by obj_cir() iff b_2compute */
|
---|
199 | float bo_pa; /* position angle @ ep, rads E of N */
|
---|
200 | float bo_sep; /* separation @ ep, arc secs */
|
---|
201 | float bo_ra; /* geo/topo app/mean ra, rads */
|
---|
202 | float bo_dec; /* geo/topo app/mean dec, rads */
|
---|
203 | } BinOrbit;
|
---|
204 | typedef struct {
|
---|
205 | float bp_ep; /* epoch of pa/sep, year */
|
---|
206 | float bp_pa; /* position angle @ ep, rads E of N */
|
---|
207 | float bp_sep; /* separation @ ep, arc secs */
|
---|
208 |
|
---|
209 | /* companion position, computed by obj_cir() iff b_2compute */
|
---|
210 | float bp_ra; /* geo/topo app/mean ra, rads */
|
---|
211 | float bp_dec; /* geo/topo app/mean dec, rads */
|
---|
212 | } BinPos;
|
---|
213 | #define MAXBINPOS 2 /* max discrete epochs to store when no elements */
|
---|
214 | typedef struct {
|
---|
215 | OBJ_COMMON_FLDS;
|
---|
216 | OBJ_FIXED_FLDS;
|
---|
217 |
|
---|
218 | byte b_2compute; /* whether to compute secondary positions */
|
---|
219 | byte b_nbp; /* number of b_bp[] or 0 to use b_bo */
|
---|
220 | short b_2mag; /* secondary's magnitude * MAGSCALE */
|
---|
221 | char b_2spect[2]; /* secondary's spectrum */
|
---|
222 |
|
---|
223 | /* either a real orbit or a set of discrete pa/sep */
|
---|
224 | union {
|
---|
225 | BinOrbit b_bo; /* orbital elements */
|
---|
226 | BinPos b_bp[MAXBINPOS]; /* table of discrete positions */
|
---|
227 | } u;
|
---|
228 | } ObjB;
|
---|
229 |
|
---|
230 | #define fo_mag co_mag /* pseudonym for so_mag since it is not computed */
|
---|
231 | #define fo_size co_size /* pseudonym for so_size since it is not computed */
|
---|
232 |
|
---|
233 | /* macros to pack/unpack some fields */
|
---|
234 | #define SRSCALE 255.0 /* galaxy size ratio scale */
|
---|
235 | #define PASCALE (255.0/(2*PI)) /* pos angle scale factor */
|
---|
236 | #define get_ratio(op) (((int)(op)->f_ratio)/SRSCALE)
|
---|
237 | #define set_ratio(op,maj,min) ((op)->f_ratio = (byte)(((maj) > 0) \
|
---|
238 | ? ((min)*SRSCALE/(double)(maj)+0.5) \
|
---|
239 | : 0))
|
---|
240 | #define get_pa(op) ((double)(op)->f_pa/PASCALE)
|
---|
241 | #define set_pa(op,s) ((op)->f_pa = (byte)((s)*PASCALE + 0.5))
|
---|
242 |
|
---|
243 | #define NCLASSES 128 /* n potential fo_classes -- allow for all ASCII */
|
---|
244 |
|
---|
245 | /* basic planet object info */
|
---|
246 | typedef struct {
|
---|
247 | OBJ_SOLSYS_FLDS;
|
---|
248 | PLCode plo_code; /* which planet */
|
---|
249 | MCode plo_moon; /* which moon, or X_PLANET if planet */
|
---|
250 | char plo_evis, plo_svis; /* if moon: whether visible from earth, sun */
|
---|
251 | double plo_x, plo_y, plo_z; /* if moon: eq dist from center, planet radii */
|
---|
252 | double plo_aux1, plo_aux2; /* various values, depending on type */
|
---|
253 | } ObjPl;
|
---|
254 |
|
---|
255 | /* basic info about an object in elliptical heliocentric orbit */
|
---|
256 | typedef struct {
|
---|
257 | OBJ_SOLSYS_FLDS;
|
---|
258 | float eo_inc; /* inclination, degrees */
|
---|
259 | float eo_Om; /* longitude of ascending node, degrees */
|
---|
260 | float eo_om; /* argument of perihelion, degress */
|
---|
261 | float eo_a; /* mean distance, aka,semi-maj axis,AU */
|
---|
262 | float eo_M; /* mean anomaly, ie, degrees from perihelion at cepoch*/
|
---|
263 | float eo_size; /* angular size, in arc seconds at 1 AU */
|
---|
264 | float eo_startok; /* nominal first mjd this set is ok, else 0 */
|
---|
265 | float eo_endok; /* nominal last mjd this set is ok, else 0 */
|
---|
266 | double eo_e; /* eccentricity (double for when near 1 computing q) */
|
---|
267 | double eo_cepoch; /* epoch date (M reference), as an mjd */
|
---|
268 | double eo_epoch; /* equinox year (inc/Om/om reference), as an mjd. */
|
---|
269 | Mag eo_mag; /* magnitude */
|
---|
270 | } ObjE;
|
---|
271 |
|
---|
272 | /* basic info about an object in hyperbolic heliocentric orbit */
|
---|
273 | typedef struct {
|
---|
274 | OBJ_SOLSYS_FLDS;
|
---|
275 | double ho_epoch; /* equinox year (inc/Om/om reference), as an mjd */
|
---|
276 | double ho_ep; /* epoch of perihelion, as an mjd */
|
---|
277 | float ho_startok; /* nominal first mjd this set is ok, else 0 */
|
---|
278 | float ho_endok; /* nominal last mjd this set is ok, else 0 */
|
---|
279 | float ho_inc; /* inclination, degs */
|
---|
280 | float ho_Om; /* longitude of ascending node, degs */
|
---|
281 | float ho_om; /* argument of perihelion, degs. */
|
---|
282 | float ho_e; /* eccentricity */
|
---|
283 | float ho_qp; /* perihelion distance, AU */
|
---|
284 | float ho_g, ho_k; /* magnitude model coefficients */
|
---|
285 | float ho_size; /* angular size, in arc seconds at 1 AU */
|
---|
286 | } ObjH;
|
---|
287 |
|
---|
288 | /* basic info about an object in parabolic heliocentric orbit */
|
---|
289 | typedef struct {
|
---|
290 | OBJ_SOLSYS_FLDS;
|
---|
291 | double po_epoch; /* reference epoch, as an mjd */
|
---|
292 | double po_ep; /* epoch of perihelion, as an mjd */
|
---|
293 | float po_startok; /* nominal first mjd this set is ok, else 0 */
|
---|
294 | float po_endok; /* nominal last mjd this set is ok, else 0 */
|
---|
295 | float po_inc; /* inclination, degs */
|
---|
296 | float po_qp; /* perihelion distance, AU */
|
---|
297 | float po_om; /* argument of perihelion, degs. */
|
---|
298 | float po_Om; /* longitude of ascending node, degs */
|
---|
299 | float po_g, po_k; /* magnitude model coefficients */
|
---|
300 | float po_size; /* angular size, in arc seconds at 1 AU */
|
---|
301 | } ObjP;
|
---|
302 |
|
---|
303 | /* basic earth satellite object info */
|
---|
304 | typedef struct {
|
---|
305 | OBJ_COMMON_FLDS;
|
---|
306 | double eso_epoch; /* reference epoch, as an mjd */
|
---|
307 | double eso_n; /* mean motion, rev/day
|
---|
308 | * N.B. we need double due to a sensitive differencing
|
---|
309 | * operation used to compute MeanAnomaly in
|
---|
310 | * esat_main()/satellite.c.
|
---|
311 | */
|
---|
312 | float eso_startok; /* nominal first mjd this set is ok, else 0 */
|
---|
313 | float eso_endok; /* nominal last mjd this set is ok, else 0 */
|
---|
314 | float eso_inc; /* inclination, degs */
|
---|
315 | float eso_raan; /* RA of ascending node, degs */
|
---|
316 | float eso_e; /* eccentricity */
|
---|
317 | float eso_ap; /* argument of perigee at epoch, degs */
|
---|
318 | float eso_M; /* mean anomaly, ie, degrees from perigee at epoch */
|
---|
319 | float eso_decay; /* orbit decay rate, rev/day^2 */
|
---|
320 | float eso_drag; /* object drag coefficient, (earth radii)^-1 */
|
---|
321 | int eso_orbit; /* integer orbit number of epoch */
|
---|
322 |
|
---|
323 | /* computed "sky" results unique to earth satellites */
|
---|
324 | float ess_elev; /* height of satellite above sea level, m */
|
---|
325 | float ess_range; /* line-of-site distance from observer to satellite, m*/
|
---|
326 | float ess_rangev; /* rate-of-change of range, m/s */
|
---|
327 | float ess_sublat; /* latitude below satellite, >0 north, rads */
|
---|
328 | float ess_sublng; /* longitude below satellite, >0 east, rads */
|
---|
329 | int ess_eclipsed;/* 1 if satellite is in earth's shadow, else 0 */
|
---|
330 | } ObjES;
|
---|
331 |
|
---|
332 | typedef union {
|
---|
333 | ObjAny any; /* these fields valid for all types */
|
---|
334 | ObjSS anyss; /* these fields valid for all solar system types */
|
---|
335 | ObjPl pl; /* planet */
|
---|
336 | ObjF f; /* fixed object, plus proper motion */
|
---|
337 | ObjB b; /* bona fide binary stars (doubles are stored in f) */
|
---|
338 | ObjE e; /* object in heliocentric elliptical orbit */
|
---|
339 | ObjH h; /* object in heliocentric hyperbolic trajectory */
|
---|
340 | ObjP p; /* object in heliocentric parabolic trajectory */
|
---|
341 | ObjES es; /* earth satellite */
|
---|
342 | } Obj;
|
---|
343 |
|
---|
344 |
|
---|
345 | /* for o_flags -- everybody must agree */
|
---|
346 | #define FUSER0 0x01
|
---|
347 | #define FUSER1 0x02
|
---|
348 | #define FUSER2 0x04
|
---|
349 | #define FUSER3 0x08
|
---|
350 | #define FUSER4 0x10
|
---|
351 | #define FUSER5 0x20
|
---|
352 | #define FUSER6 0x40
|
---|
353 | #define FUSER7 0x80
|
---|
354 |
|
---|
355 | /* mark an object as being a "field star" */
|
---|
356 | #define FLDSTAR FUSER3
|
---|
357 | /* mark an object as circum calculation failed */
|
---|
358 | #define NOCIRCUM FUSER7
|
---|
359 |
|
---|
360 | /* Obj shorthands: */
|
---|
361 | #define o_type any.co_type
|
---|
362 | #define o_name any.co_name
|
---|
363 | #define o_flags any.co_flags
|
---|
364 | #define o_age any.co_age
|
---|
365 | #define s_ra any.co_ra
|
---|
366 | #define s_dec any.co_dec
|
---|
367 | #define s_gaera any.co_gaera
|
---|
368 | #define s_gaedec any.co_gaedec
|
---|
369 | #define s_az any.co_az
|
---|
370 | #define s_alt any.co_alt
|
---|
371 | #define s_elong any.co_elong
|
---|
372 | #define s_size any.co_size
|
---|
373 | #define s_mag any.co_mag
|
---|
374 |
|
---|
375 | #define s_sdist anyss.so_sdist
|
---|
376 | #define s_edist anyss.so_edist
|
---|
377 | #define s_hlong anyss.so_hlong
|
---|
378 | #define s_hlat anyss.so_hlat
|
---|
379 | #define s_phase anyss.so_phase
|
---|
380 |
|
---|
381 | #define s_elev es.ess_elev
|
---|
382 | #define s_range es.ess_range
|
---|
383 | #define s_rangev es.ess_rangev
|
---|
384 | #define s_sublat es.ess_sublat
|
---|
385 | #define s_sublng es.ess_sublng
|
---|
386 | #define s_eclipsed es.ess_eclipsed
|
---|
387 |
|
---|
388 | #define f_class f.fo_class
|
---|
389 | #define f_spect f.fo_spect
|
---|
390 | #define f_ratio f.fo_ratio
|
---|
391 | #define f_pa f.fo_pa
|
---|
392 | #define f_epoch f.fo_epoch
|
---|
393 | #define f_RA f.fo_ra
|
---|
394 | #define f_pmRA f.fo_pmra
|
---|
395 | #define f_dec f.fo_dec
|
---|
396 | #define f_pmdec f.fo_pmdec
|
---|
397 | #define f_mag f.fo_mag
|
---|
398 | #define f_size f.fo_size
|
---|
399 |
|
---|
400 | #define e_cepoch e.eo_cepoch
|
---|
401 | #define e_epoch e.eo_epoch
|
---|
402 | #define e_startok e.eo_startok
|
---|
403 | #define e_endok e.eo_endok
|
---|
404 | #define e_inc e.eo_inc
|
---|
405 | #define e_Om e.eo_Om
|
---|
406 | #define e_om e.eo_om
|
---|
407 | #define e_a e.eo_a
|
---|
408 | #define e_e e.eo_e
|
---|
409 | #define e_M e.eo_M
|
---|
410 | #define e_size e.eo_size
|
---|
411 | #define e_mag e.eo_mag
|
---|
412 |
|
---|
413 | #define h_epoch h.ho_epoch
|
---|
414 | #define h_startok h.ho_startok
|
---|
415 | #define h_endok h.ho_endok
|
---|
416 | #define h_ep h.ho_ep
|
---|
417 | #define h_inc h.ho_inc
|
---|
418 | #define h_Om h.ho_Om
|
---|
419 | #define h_om h.ho_om
|
---|
420 | #define h_e h.ho_e
|
---|
421 | #define h_qp h.ho_qp
|
---|
422 | #define h_g h.ho_g
|
---|
423 | #define h_k h.ho_k
|
---|
424 | #define h_size h.ho_size
|
---|
425 |
|
---|
426 | #define p_epoch p.po_epoch
|
---|
427 | #define p_startok p.po_startok
|
---|
428 | #define p_endok p.po_endok
|
---|
429 | #define p_ep p.po_ep
|
---|
430 | #define p_inc p.po_inc
|
---|
431 | #define p_qp p.po_qp
|
---|
432 | #define p_om p.po_om
|
---|
433 | #define p_Om p.po_Om
|
---|
434 | #define p_g p.po_g
|
---|
435 | #define p_k p.po_k
|
---|
436 | #define p_size p.po_size
|
---|
437 |
|
---|
438 | #define es_epoch es.eso_epoch
|
---|
439 | #define es_startok es.eso_startok
|
---|
440 | #define es_endok es.eso_endok
|
---|
441 | #define es_inc es.eso_inc
|
---|
442 | #define es_raan es.eso_raan
|
---|
443 | #define es_e es.eso_e
|
---|
444 | #define es_ap es.eso_ap
|
---|
445 | #define es_M es.eso_M
|
---|
446 | #define es_n es.eso_n
|
---|
447 | #define es_decay es.eso_decay
|
---|
448 | #define es_drag es.eso_drag
|
---|
449 | #define es_orbit es.eso_orbit
|
---|
450 |
|
---|
451 | #define pl_code pl.plo_code
|
---|
452 | #define pl_moon pl.plo_moon
|
---|
453 | #define pl_evis pl.plo_evis
|
---|
454 | #define pl_svis pl.plo_svis
|
---|
455 | #define pl_x pl.plo_x
|
---|
456 | #define pl_y pl.plo_y
|
---|
457 | #define pl_z pl.plo_z
|
---|
458 | #define pl_aux1 pl.plo_aux1
|
---|
459 | #define pl_aux2 pl.plo_aux2
|
---|
460 |
|
---|
461 | #define b_2compute b.b_2compute
|
---|
462 | #define b_2spect b.b_2spect
|
---|
463 | #define b_2mag b.b_2mag
|
---|
464 | #define b_bo b.u.b_bo
|
---|
465 | #define b_bp b.u.b_bp
|
---|
466 | #define b_nbp b.b_nbp
|
---|
467 |
|
---|
468 | /* insure we always refer to the fields and no monkey business */
|
---|
469 | #undef OBJ_COMMON_FLDS
|
---|
470 | #undef OBJ_SOLSYS_FLDS
|
---|
471 |
|
---|
472 | /* o_type code.
|
---|
473 | * N.B. names are assigned in order in objmenu.c
|
---|
474 | * N.B. if add one add switch in obj_cir().
|
---|
475 | * N.B. UNDEFOBJ must be zero so new objects are undefinied by being zeroed.
|
---|
476 | * N.B. maintain the bitmasks too.
|
---|
477 | */
|
---|
478 | enum ObjType {
|
---|
479 | UNDEFOBJ=0,
|
---|
480 | FIXED, BINARYSTAR, ELLIPTICAL, HYPERBOLIC, PARABOLIC, EARTHSAT, PLANET,
|
---|
481 | NOBJTYPES
|
---|
482 | };
|
---|
483 |
|
---|
484 | /* types as handy bitmasks too */
|
---|
485 | #define OBJTYPE2MASK(t) (1<<(t))
|
---|
486 | #define FIXEDM OBJTYPE2MASK(FIXED)
|
---|
487 | #define BINARYSTARM OBJTYPE2MASK(BINARYSTAR)
|
---|
488 | #define ELLIPTICALM OBJTYPE2MASK(ELLIPTICAL)
|
---|
489 | #define HYPERBOLICM OBJTYPE2MASK(HYPERBOLIC)
|
---|
490 | #define PARABOLICM OBJTYPE2MASK(PARABOLIC)
|
---|
491 | #define EARTHSATM OBJTYPE2MASK(EARTHSAT)
|
---|
492 | #define PLANETM OBJTYPE2MASK(PLANET)
|
---|
493 | #define ALLM (~0)
|
---|
494 |
|
---|
495 | /* rise, set and transit information.
|
---|
496 | */
|
---|
497 | typedef struct {
|
---|
498 | int rs_flags; /* info about what has been computed and any
|
---|
499 | * special conditions; see flags, below.
|
---|
500 | */
|
---|
501 | double rs_risetm; /* mjd time of rise today */
|
---|
502 | double rs_riseaz; /* azimuth of rise, rads E of N */
|
---|
503 | double rs_trantm; /* mjd time of transit today */
|
---|
504 | double rs_tranalt; /* altitude of transit, rads up from horizon */
|
---|
505 | double rs_settm; /* mjd time of set today */
|
---|
506 | double rs_setaz; /* azimuth of set, rads E of N */
|
---|
507 | } RiseSet;
|
---|
508 |
|
---|
509 | /* RiseSet flags */
|
---|
510 | #define RS_NORISE 0x0001 /* object does not rise as such today */
|
---|
511 | #define RS_NOSET 0x0002 /* object does not set as such today */
|
---|
512 | #define RS_NOTRANS 0x0004 /* object does not transit as such today */
|
---|
513 | #define RS_CIRCUMPOLAR 0x0010 /* object stays up all day today */
|
---|
514 | #define RS_NEVERUP 0x0020 /* object never up at all today */
|
---|
515 | #define RS_ERROR 0x1000 /* can't figure out anything! */
|
---|
516 | #define RS_RISERR (0x0100|RS_ERROR) /* error computing rise */
|
---|
517 | #define RS_SETERR (0x0200|RS_ERROR) /* error computing set */
|
---|
518 | #define RS_TRANSERR (0x0400|RS_ERROR) /* error computing transit */
|
---|
519 |
|
---|
520 | #define is_type(op,m) (OBJTYPE2MASK((op)->o_type) & (m))
|
---|
521 |
|
---|
522 | /* any planet or its moons */
|
---|
523 | #define is_planet(op,p) (is_type(op,PLANETM) && op->pl_code == (p))
|
---|
524 |
|
---|
525 | /* any solar system object */
|
---|
526 | #define is_ssobj(op) is_type(op,PLANETM|HYPERBOLICM|PARABOLICM|ELLIPTICALM)
|
---|
527 |
|
---|
528 | |
---|
529 |
|
---|
530 | /* natural satellite support */
|
---|
531 |
|
---|
532 | typedef struct {
|
---|
533 | char *full; /* full name */
|
---|
534 | char *tag; /* Roman numeral tag */
|
---|
535 | float x, y, z; /* sky loc in planet radii: +x:east +y:south +z:front */
|
---|
536 | float ra, dec; /* sky location in ra/dec */
|
---|
537 | float mag; /* magnitude */
|
---|
538 | int evis; /* whether geometrically visible from earth */
|
---|
539 | int svis; /* whether in sun light */
|
---|
540 | int pshad; /* whether moon is casting shadow on planet */
|
---|
541 | int trans; /* whether moon is transiting */
|
---|
542 | float sx, sy; /* shadow sky loc in planet radii: +x:east +y:south */
|
---|
543 | } MoonData;
|
---|
544 |
|
---|
545 | /* separate set for each planet -- use in pl_moon */
|
---|
546 |
|
---|
547 |
|
---|
548 | enum _marsmoons {
|
---|
549 | M_MARS = 0, /* == X_PLANET */
|
---|
550 | M_PHOBOS, M_DEIMOS,
|
---|
551 | M_NMOONS /* including planet at 0 */
|
---|
552 | };
|
---|
553 |
|
---|
554 | enum _jupmoons {
|
---|
555 | J_JUPITER = 0, /* == X_PLANET */
|
---|
556 | J_IO, J_EUROPA, J_GANYMEDE, J_CALLISTO,
|
---|
557 | J_NMOONS /* including planet */
|
---|
558 | };
|
---|
559 |
|
---|
560 | enum _satmoons {
|
---|
561 | S_SATURN = 0, /* == X_PLANET */
|
---|
562 | S_MIMAS, S_ENCELADUS, S_TETHYS, S_DIONE,
|
---|
563 | S_RHEA, S_TITAN, S_HYPERION, S_IAPETUS,
|
---|
564 | S_NMOONS /* including planet */
|
---|
565 | };
|
---|
566 |
|
---|
567 | enum _uramoons {
|
---|
568 | U_URANUS = 0, /* == X_PLANET */
|
---|
569 | U_ARIEL, U_UMBRIEL, U_TITANIA, U_OBERON, U_MIRANDA,
|
---|
570 | U_NMOONS /* including planet */
|
---|
571 | };
|
---|
572 |
|
---|
573 | #define X_MAXNMOONS S_NMOONS /* N.B. chosen by hand */
|
---|
574 |
|
---|
575 | |
---|
576 |
|
---|
577 | /* global function declarations */
|
---|
578 |
|
---|
579 |
|
---|
580 | /* aa_hadec.c */
|
---|
581 | extern void aa_hadec (double lt, double alt, double az, double *ha,
|
---|
582 | double *dec);
|
---|
583 | extern void hadec_aa (double lt, double ha, double dec, double *alt,
|
---|
584 | double *az);
|
---|
585 |
|
---|
586 | /* aberration.c */
|
---|
587 | extern void ab_ecl (double m, double lsn, double *lam, double *bet);
|
---|
588 | extern void ab_eq (double m, double lsn, double *ra, double *dec);
|
---|
589 |
|
---|
590 | /* airmass.c */
|
---|
591 | extern void airmass (double aa, double *Xp);
|
---|
592 |
|
---|
593 | /* anomaly.c */
|
---|
594 | extern void anomaly (double ma, double s, double *nu, double *ea);
|
---|
595 |
|
---|
596 | /* ap_as.c */
|
---|
597 | extern void ap_as ( Now *np, double Mjd, double *rap, double *decp);
|
---|
598 | extern void as_ap ( Now *np, double Mjd, double *rap, double *decp);
|
---|
599 |
|
---|
600 | /* atlas.c */
|
---|
601 | extern char *um_atlas (double ra, double dec);
|
---|
602 | extern char *u2k_atlas (double ra, double dec);
|
---|
603 | extern char *msa_atlas (double ra, double dec);
|
---|
604 |
|
---|
605 | /* aux.c */
|
---|
606 | extern double mm_mjed (Now *np);
|
---|
607 |
|
---|
608 | /* chap95.c */
|
---|
609 | extern int chap95 (double m, int obj, double prec, double *ret);
|
---|
610 |
|
---|
611 | /* chap95_data.c */
|
---|
612 |
|
---|
613 | /* circum.c */
|
---|
614 | extern int obj_cir (Now *np, Obj *op);
|
---|
615 |
|
---|
616 | /* comet.c */
|
---|
617 | extern void comet (double m, double ep, double inc, double ap, double qp,
|
---|
618 | double om, double *lpd, double *psi, double *rp, double *rho, double *lam,
|
---|
619 | double *bet);
|
---|
620 |
|
---|
621 | /* constel.c */
|
---|
622 | #define NCNS 89
|
---|
623 | extern int cns_pick (double r, double d, double e);
|
---|
624 | extern int cns_id (char *abbrev);
|
---|
625 | extern char *cns_name (int id);
|
---|
626 | extern int cns_edges (double e, double **ra0p, double **dec0p, double **ra1p,
|
---|
627 | double **dec1p);
|
---|
628 | extern int cns_list (double ra, double dec, double e, double rad, int ids[]);
|
---|
629 | extern int cns_figure (int id, double e, double ra[],double dec[],int dcodes[]);
|
---|
630 | extern int cns_loadfigs (FILE *fp, char msg[]);
|
---|
631 |
|
---|
632 | /* dbfmt.c */
|
---|
633 | extern int db_crack_line (char s[], Obj *op, char nm[][MAXNM], int nnm,
|
---|
634 | char whynot[]);
|
---|
635 | extern void db_write_line (Obj *op, char *lp);
|
---|
636 | extern int dbline_candidate (char line[]);
|
---|
637 | extern int get_fields (char *s, int delim, char *fields[]);
|
---|
638 | extern int db_tle (char *name, char *l1, char *l2, Obj *op);
|
---|
639 | extern int dateRangeOK (Now *np, Obj *op);
|
---|
640 |
|
---|
641 | /* deltat.c */
|
---|
642 | extern double deltat (double m);
|
---|
643 |
|
---|
644 | /* earthsat.c */
|
---|
645 | extern int obj_earthsat (Now *np, Obj *op);
|
---|
646 |
|
---|
647 | /* eq_ecl.c */
|
---|
648 | extern void eq_ecl (double m, double ra, double dec, double *lt,double *lg);
|
---|
649 | extern void ecl_eq (double m, double lt, double lg, double *ra,double *dec);
|
---|
650 |
|
---|
651 | /* eq_gal.c */
|
---|
652 | extern void eq_gal (double m, double ra, double dec, double *lt,double *lg);
|
---|
653 | extern void gal_eq (double m, double lt, double lg, double *ra,double *dec);
|
---|
654 |
|
---|
655 | /* formats.c */
|
---|
656 | extern int fs_sexa (char *out, double a, int w, int fracbase);
|
---|
657 | extern int fs_date (char out[], int format, double jd);
|
---|
658 | extern int f_scansexa (const char *str, double *dp);
|
---|
659 | extern void f_sscandate (char *bp, int pref, int *m, double *d, int *y);
|
---|
660 |
|
---|
661 | /* helio.c */
|
---|
662 | extern void heliocorr (double jd, double ra, double dec, double *hcp);
|
---|
663 |
|
---|
664 | /* jupmoon.c */
|
---|
665 | extern void jupiter_data (double Mjd, char dir[], Obj *sop, Obj *jop,
|
---|
666 | double *jupsize, double *cmlI, double *cmlII, double *polera,
|
---|
667 | double *poledec, MoonData md[J_NMOONS]);
|
---|
668 |
|
---|
669 | /* libration.c */
|
---|
670 | extern void llibration (double JD, double *llatp, double *llonp);
|
---|
671 |
|
---|
672 | /* magdecl.c */
|
---|
673 | extern int magdecl (double l, double L, double e, double y, char *dir,
|
---|
674 | double *dp, char *err);
|
---|
675 |
|
---|
676 | /* marsmoon.c */
|
---|
677 | extern void marsm_data (double Mjd, char dir[], Obj *sop, Obj *mop,
|
---|
678 | double *marssize, double *polera, double *poledec, MoonData md[M_NMOONS]);
|
---|
679 |
|
---|
680 | /* misc.c */
|
---|
681 | extern void zero_mem (void *loc, unsigned len);
|
---|
682 | extern int tickmarks (double min, double max, int numdiv, double ticks[]);
|
---|
683 | extern int lc (int cx, int cy, int cw, int x1, int y1, int x2, int y2,
|
---|
684 | int *sx1, int *sy1, int *sx2, int *sy2);
|
---|
685 | extern void hg_mag (double h, double g, double rp, double rho, double rsn,
|
---|
686 | double *mp);
|
---|
687 | extern int magdiam (int fmag, int magstp, double scale, double mag,
|
---|
688 | double size);
|
---|
689 | extern void gk_mag (double g, double k, double rp, double rho, double *mp);
|
---|
690 | extern double atod (char *buf);
|
---|
691 | extern void solve_sphere (double A, double b, double cc, double sc,
|
---|
692 | double *cap, double *Bp);
|
---|
693 | extern double delra (double dra);
|
---|
694 | extern void now_lst (Now *np, double *lstp);
|
---|
695 | extern void radec2ha (Now *np, double ra, double dec, double *hap);
|
---|
696 | extern void gha (Now *np, Obj *op, double *ghap);
|
---|
697 | extern char *obj_description (Obj *op);
|
---|
698 | extern int is_deepsky (Obj *op);
|
---|
699 |
|
---|
700 | /* mjd.c */
|
---|
701 | extern void cal_mjd (int mn, double dy, int yr, double *m);
|
---|
702 | extern void mjd_cal (double m, int *mn, double *dy, int *yr);
|
---|
703 | extern int mjd_dow (double m, int *dow);
|
---|
704 | extern int isleapyear (int year);
|
---|
705 | extern void mjd_dpm (double m, int *ndays);
|
---|
706 | extern void mjd_year (double m, double *yr);
|
---|
707 | extern void year_mjd (double y, double *m);
|
---|
708 | extern void rnd_second (double *t);
|
---|
709 | extern void mjd_dayno (double jd, int *yr, double *dy);
|
---|
710 | extern double mjd_day (double jd);
|
---|
711 | extern double mjd_hr (double jd);
|
---|
712 | extern void range (double *v, double r);
|
---|
713 | extern void radecrange (double *ra, double *dec);
|
---|
714 |
|
---|
715 | /* moon.c */
|
---|
716 | extern void moon (double m, double *lam, double *bet, double *rho,
|
---|
717 | double *msp, double *mdp);
|
---|
718 |
|
---|
719 | /* mooncolong.c */
|
---|
720 | extern void moon_colong (double jd, double lt, double lg, double *cp,
|
---|
721 | double *kp, double *ap, double *sp);
|
---|
722 |
|
---|
723 | /* moonnf.c */
|
---|
724 | extern void moonnf (double mj, double *mjn, double *mjf);
|
---|
725 |
|
---|
726 | /* nutation.c */
|
---|
727 | extern void nutation (double m, double *deps, double *dpsi);
|
---|
728 | extern void nut_eq (double m, double *ra, double *dec);
|
---|
729 |
|
---|
730 | /* obliq.c */
|
---|
731 | extern void obliquity (double m, double *eps);
|
---|
732 |
|
---|
733 | /* parallax.c */
|
---|
734 | extern void ta_par (double tha, double tdec, double phi, double ht,
|
---|
735 | double *rho, double *aha, double *adec);
|
---|
736 |
|
---|
737 | /* parallactic.c */
|
---|
738 | extern double parallacticLDA (double lt, double dec, double alt);
|
---|
739 | extern double parallacticLHD (double lt, double ha, double dec);
|
---|
740 |
|
---|
741 | /* plans.c */
|
---|
742 | extern void plans (double m, PLCode p, double *lpd0, double *psi0,
|
---|
743 | double *rp0, double *rho0, double *lam, double *bet, double *dia,
|
---|
744 | double *mag);
|
---|
745 |
|
---|
746 | /* plshadow.c */
|
---|
747 | extern int plshadow (Obj *op, Obj *sop, double polera,
|
---|
748 | double poledec, double x, double y, double z, float *sxp, float *syp);
|
---|
749 |
|
---|
750 | /* plmoon_cir.c */
|
---|
751 | extern int plmoon_cir (Now *np, Obj *moonop);
|
---|
752 | extern int getBuiltInObjs (Obj **opp);
|
---|
753 | extern void setMoonDir (char *dir);
|
---|
754 |
|
---|
755 | /* precess.c */
|
---|
756 | extern void precess (double mjd1, double mjd2, double *ra, double *dec);
|
---|
757 |
|
---|
758 | /* reduce.c */
|
---|
759 | extern void reduce_elements (double mjd0, double m, double inc0,
|
---|
760 | double ap0, double om0, double *inc, double *ap, double *om);
|
---|
761 |
|
---|
762 | /* refract.c */
|
---|
763 | extern void unrefract (double pr, double tr, double aa, double *ta);
|
---|
764 | extern void refract (double pr, double tr, double ta, double *aa);
|
---|
765 |
|
---|
766 | /* rings.c */
|
---|
767 | extern void satrings (double sb, double sl, double sr, double el, double er,
|
---|
768 | double JD, double *etiltp, double *stiltp);
|
---|
769 |
|
---|
770 | /* riset.c */
|
---|
771 | extern void riset (double ra, double dec, double lt, double dis,
|
---|
772 | double *lstr, double *lsts, double *azr, double *azs, int *status);
|
---|
773 |
|
---|
774 | /* riset_cir.c */
|
---|
775 | extern void riset_cir (Now *np, Obj *op, double dis, RiseSet *rp);
|
---|
776 | extern void twilight_cir (Now *np, double dis, double *dawn, double *dusk,
|
---|
777 | int *status);
|
---|
778 |
|
---|
779 | /* satmoon.c */
|
---|
780 | extern void saturn_data (double Mjd, char dir[], Obj *eop, Obj *sop,
|
---|
781 | double *satsize, double *etilt, double *stlit, double *polera,
|
---|
782 | double *poledec, MoonData md[S_NMOONS]);
|
---|
783 |
|
---|
784 | /* sphcart.c */
|
---|
785 | extern void sphcart (double l, double b, double r, double *x, double *y,
|
---|
786 | double *z);
|
---|
787 | extern void cartsph (double x, double y, double z, double *l, double *b,
|
---|
788 | double *r);
|
---|
789 |
|
---|
790 | /* sun.c */
|
---|
791 | extern void sunpos (double m, double *lsn, double *rsn, double *bsn);
|
---|
792 |
|
---|
793 | /* twobody.c */
|
---|
794 | extern int vrc (double *v, double *r, double tp, double e, double q);
|
---|
795 |
|
---|
796 | /* umoon.c */
|
---|
797 | extern void uranus_data (double Mjd, char dir[], Obj *sop, Obj *uop,
|
---|
798 | double *usize, double *polera, double *poledec, MoonData md[U_NMOONS]);
|
---|
799 |
|
---|
800 | /* utc_gst.c */
|
---|
801 | extern void utc_gst (double m, double utc, double *gst);
|
---|
802 | extern void gst_utc (double m, double gst, double *utc);
|
---|
803 |
|
---|
804 | /* vsop87.c */
|
---|
805 | extern int vsop87 (double m, int obj, double prec, double *ret);
|
---|
806 |
|
---|
807 | #endif /* _ASTRO_H */
|
---|
808 |
|
---|
809 | /* For RCS Only -- Do Not Edit
|
---|
810 | * @(#) $RCSfile: astro.h,v $ $Date: 2009-07-16 10:34:35 $ $Revision: 1.8 $ $Name: not supported by cvs2svn $
|
---|
811 | */
|
---|