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