| [1457] | 1 | /* the Now and Obj typedefs. | 
|---|
|  | 2 | * also, a few miscellaneous constants and declarations. | 
|---|
|  | 3 | */ | 
|---|
|  | 4 | #ifndef _CIRCUM_H | 
|---|
|  | 5 | #define _CIRCUM_H | 
|---|
|  | 6 |  | 
|---|
|  | 7 | #define SPD     (24.0*3600.0)   /* seconds per day */ | 
|---|
|  | 8 | #define MAU     (1.4959787e11)  /* m / au */ | 
|---|
|  | 9 | #define LTAU    499.005         /* seconds light takes to travel 1 AU */ | 
|---|
|  | 10 | #define ERAD    (6.37816e6)     /* earth equitorial radius, m */ | 
|---|
|  | 11 | #define MRAD    (1.740e6)       /* moon equitorial radius, m */ | 
|---|
|  | 12 | #define SRAD    (6.95e8)        /* sun equitorial radius, m */ | 
|---|
|  | 13 | #define FTPM    3.28084         /* ft per m */ | 
|---|
|  | 14 | #define ESAT_MAG        2       /* default satellite magnitude */ | 
|---|
|  | 15 | #define FAST_SAT_RPD    0.25    /* max earth sat rev/day considered "fast" */ | 
|---|
|  | 16 |  | 
|---|
|  | 17 | #define EOD     (-9786)         /* special epoch flag: use epoch of date */ | 
|---|
|  | 18 |  | 
|---|
|  | 19 | /* info about the local observing circumstances and misc preferences */ | 
|---|
|  | 20 | typedef struct { | 
|---|
|  | 21 | double n_mjd;   /* modified Julian date, ie, days since | 
|---|
|  | 22 | * Jan 0.5 1900 (== 12 noon, Dec 30, 1899), utc. | 
|---|
|  | 23 | * enough precision to get well better than 1 second. | 
|---|
|  | 24 | * N.B. if not first member, must move NOMJD inits. | 
|---|
|  | 25 | */ | 
|---|
|  | 26 | double n_lat;   /* geographic (surface-normal) lat, >0 north, rads */ | 
|---|
|  | 27 | double n_lng;   /* longitude, >0 east, rads */ | 
|---|
|  | 28 | double n_tz;    /* time zone, hrs behind UTC */ | 
|---|
|  | 29 | double n_temp;  /* atmospheric temp, degrees C */ | 
|---|
|  | 30 | double n_pressure; /* atmospheric pressure, mBar */ | 
|---|
|  | 31 | double n_elev;  /* elevation above sea level, earth radii */ | 
|---|
|  | 32 | double n_dip;   /* dip of sun below hzn at twilight, >0 below, rads */ | 
|---|
|  | 33 | double n_epoch; /* desired precession display epoch as an mjd, or EOD */ | 
|---|
|  | 34 | char n_tznm[8]; /* time zone name; 7 chars or less, always 0 at end */ | 
|---|
|  | 35 | } Now; | 
|---|
|  | 36 |  | 
|---|
|  | 37 | /* handy shorthands for fields in a Now pointer, np */ | 
|---|
|  | 38 | #define mjd     np->n_mjd | 
|---|
|  | 39 | #define lat     np->n_lat | 
|---|
|  | 40 | #define lng     np->n_lng | 
|---|
|  | 41 | #define tz      np->n_tz | 
|---|
|  | 42 | #define temp    np->n_temp | 
|---|
|  | 43 | #define pressure np->n_pressure | 
|---|
|  | 44 | #define elev    np->n_elev | 
|---|
|  | 45 | #define dip     np->n_dip | 
|---|
|  | 46 | #define epoch   np->n_epoch | 
|---|
|  | 47 | #define tznm    np->n_tznm | 
|---|
|  | 48 | #define mjed    mm_mjed(np) | 
|---|
|  | 49 |  | 
|---|
|  | 50 | /* structures to describe objects of various types. | 
|---|
|  | 51 | */ | 
|---|
|  | 52 |  | 
|---|
|  | 53 | /* magnitude values in two different systems */ | 
|---|
|  | 54 | typedef struct { | 
|---|
|  | 55 | float m1, m2;       /* either g/k or H/G, depending on... */ | 
|---|
|  | 56 | int whichm;         /* one of MAG_gk or MAG_HG */ | 
|---|
|  | 57 | } Mag; | 
|---|
|  | 58 |  | 
|---|
|  | 59 | /* whichm */ | 
|---|
|  | 60 | #define MAG_HG          0       /* using 0 makes HG the initial default */ | 
|---|
|  | 61 | #define MAG_gk          1 | 
|---|
|  | 62 |  | 
|---|
|  | 63 | /* we actually store magnitudes times this scale factor in a short int */ | 
|---|
|  | 64 | #define MAGSCALE        100.0 | 
|---|
|  | 65 | #define set_smag(op,m)  ((op)->s_mag = (short)floor((m)*MAGSCALE + 0.5)) | 
|---|
|  | 66 | #define set_fmag(op,m)  ((op)->f_mag = (short)floor((m)*MAGSCALE + 0.5)) | 
|---|
|  | 67 | #define get_mag(op)     ((op)->s_mag / MAGSCALE) | 
|---|
|  | 68 |  | 
|---|
|  | 69 | /* longest object name, including trailing '\0' */ | 
|---|
| [1719] | 70 | #define MAXNM   22 | 
|---|
| [1457] | 71 |  | 
|---|
|  | 72 | /* Obj is a massive union. | 
|---|
|  | 73 | * many fields are in common so we use macros to make things a little easier. | 
|---|
|  | 74 | */ | 
|---|
|  | 75 |  | 
|---|
|  | 76 | typedef unsigned char ObjType_t; | 
|---|
|  | 77 | typedef unsigned char ObjAge_t; | 
|---|
|  | 78 |  | 
|---|
|  | 79 | /* fields common to *all* structs in the Obj union. | 
|---|
|  | 80 | */ | 
|---|
|  | 81 | #define OBJ_COMMON_FLDS                                                 \ | 
|---|
|  | 82 | ObjType_t co_type;  /* current object type; see flags, below */     \ | 
|---|
|  | 83 | unsigned char co_flags;/* FUSER*... used by others */               \ | 
|---|
|  | 84 | char co_name[MAXNM];/* name, including \0 */                        \ | 
|---|
|  | 85 | float co_ra;        /* geo/topo app/mean ra, rads */                \ | 
|---|
|  | 86 | float co_dec;       /* geo/topo app/mean dec, rads */               \ | 
|---|
|  | 87 | float co_gaera;     /* geo apparent ra, rads */                     \ | 
|---|
|  | 88 | float co_gaedec;    /* geo apparent dec, rads */                    \ | 
|---|
|  | 89 | double co_az;       /* azimuth, >0 e of n, rads */                  \ | 
|---|
|  | 90 | double co_alt;      /* altitude above topocentric horizon, rads */  \ | 
|---|
|  | 91 | float co_elong;     /* angular sep btwen obj and sun, >0 E, degs */ \ | 
|---|
|  | 92 | float co_size;      /* angular size, arc secs */                    \ | 
|---|
|  | 93 | short co_mag;       /* visual magnitude * MAGSCALE */               \ | 
|---|
|  | 94 | ObjAge_t co_age     /* update aging code; see db.c */ | 
|---|
|  | 95 |  | 
|---|
|  | 96 | /* fields common to all solar system objects in the Obj union */ | 
|---|
|  | 97 | #define OBJ_SOLSYS_FLDS                                                 \ | 
|---|
|  | 98 | OBJ_COMMON_FLDS;    /* all the fixed ones plus ... */               \ | 
|---|
|  | 99 | float so_sdist;     /* dist from object to sun, au */               \ | 
|---|
|  | 100 | float so_edist;     /* dist from object to earth, au */             \ | 
|---|
|  | 101 | float so_hlong;     /* heliocentric longitude, rads */              \ | 
|---|
|  | 102 | float so_hlat;      /* heliocentric latitude, rads */               \ | 
|---|
|  | 103 | float so_phase      /* phase, % */ | 
|---|
|  | 104 |  | 
|---|
|  | 105 |  | 
|---|
|  | 106 | /* a generic object */ | 
|---|
|  | 107 | typedef struct { | 
|---|
|  | 108 | OBJ_COMMON_FLDS; | 
|---|
|  | 109 | } ObjAny; | 
|---|
|  | 110 |  | 
|---|
|  | 111 | /* a generic sol system object */ | 
|---|
|  | 112 | typedef struct { | 
|---|
|  | 113 | OBJ_SOLSYS_FLDS; | 
|---|
|  | 114 | } ObjSS; | 
|---|
|  | 115 |  | 
|---|
|  | 116 | /* basic Fixed object info. | 
|---|
|  | 117 | */ | 
|---|
|  | 118 | typedef unsigned char byte; | 
|---|
|  | 119 | typedef struct { | 
|---|
|  | 120 | OBJ_COMMON_FLDS; | 
|---|
|  | 121 | char  fo_class;     /* object class --  see db.c:db_set_field() et al */ | 
|---|
|  | 122 | char  fo_spect[2];  /* spectral codes, if appropriate */ | 
|---|
|  | 123 | byte  fo_ratio;     /* minor/major diameter ratio. use s/get_ratio() */ | 
|---|
|  | 124 | byte  fo_pa;        /* position angle, E of N, rads. use s/get_pa() */ | 
|---|
|  | 125 | float fo_epoch;     /* epoch of f_RA/dec */ | 
|---|
|  | 126 | float fo_ra;        /* ra, rads, at given epoch */ | 
|---|
|  | 127 | float fo_dec;       /* dec, rads, at given epoch */ | 
|---|
|  | 128 | } ObjF; | 
|---|
|  | 129 |  | 
|---|
|  | 130 | #define fo_mag  co_mag  /* pseudonym for so_mag since it is not computed */ | 
|---|
|  | 131 | #define fo_size co_size /* pseudonym for so_size since it is not computed */ | 
|---|
|  | 132 |  | 
|---|
|  | 133 | /* macros to pack/unpack some fields */ | 
|---|
|  | 134 | #define SRSCALE         255.0           /* galaxy size ratio scale */ | 
|---|
|  | 135 | #define PASCALE         (255.0/(2*PI))  /* pos angle scale factor */ | 
|---|
|  | 136 | #define get_ratio(op)   ((int)(op)->f_ratio/SRSCALE) | 
|---|
|  | 137 | #define set_ratio(op,maj,min) ((op)->f_ratio = (byte)(((maj) > 0)           \ | 
|---|
|  | 138 | ? ((min)*SRSCALE/(double)(maj)+0.5) \ | 
|---|
|  | 139 | : 0)) | 
|---|
|  | 140 | #define get_pa(op)      ((double)(op)->f_pa/PASCALE) | 
|---|
|  | 141 | #define set_pa(op,s)    ((op)->f_pa = (byte)((s)*PASCALE + 0.5)) | 
|---|
|  | 142 |  | 
|---|
|  | 143 | #define NCLASSES        128 /* n potential fo_classes -- allow for all ASCII */ | 
|---|
|  | 144 |  | 
|---|
|  | 145 | /* basic planet object info */ | 
|---|
|  | 146 | typedef struct { | 
|---|
|  | 147 | OBJ_SOLSYS_FLDS; | 
|---|
|  | 148 | int pl_code;        /* one of the codes in astro.h */ | 
|---|
|  | 149 | } ObjPl; | 
|---|
|  | 150 |  | 
|---|
|  | 151 | /* basic info about an object in elliptical heliocentric orbit */ | 
|---|
|  | 152 | typedef struct { | 
|---|
|  | 153 | OBJ_SOLSYS_FLDS; | 
|---|
|  | 154 | float  eo_inc;      /* inclination, degrees */ | 
|---|
|  | 155 | float  eo_Om;       /* longitude of ascending node, degrees */ | 
|---|
|  | 156 | float  eo_om;       /* argument of perihelion, degress */ | 
|---|
|  | 157 | float  eo_a;        /* mean distance, aka,semi-maj axis,AU */ | 
|---|
|  | 158 | float  eo_M;        /* mean anomaly, ie, degrees from perihelion at cepoch*/ | 
|---|
|  | 159 | float  eo_size;     /* angular size, in arc seconds at 1 AU */ | 
|---|
| [1719] | 160 | double eo_e;        /* eccentricity (double for when near 1 computing q) */ | 
|---|
| [1457] | 161 | double eo_cepoch;   /* epoch date (M reference), as an mjd */ | 
|---|
|  | 162 | double eo_epoch;    /* equinox year (inc/Om/om reference), as an mjd. */ | 
|---|
|  | 163 | Mag    eo_mag;      /* magnitude */ | 
|---|
|  | 164 | } ObjE; | 
|---|
|  | 165 |  | 
|---|
|  | 166 | /* basic info about an object in hyperbolic heliocentric orbit */ | 
|---|
|  | 167 | typedef struct { | 
|---|
|  | 168 | OBJ_SOLSYS_FLDS; | 
|---|
|  | 169 | double ho_epoch;    /* equinox year (inc/Om/om reference), as an mjd */ | 
|---|
|  | 170 | double ho_ep;       /* epoch of perihelion, as an mjd */ | 
|---|
|  | 171 | float  ho_inc;      /* inclination, degs */ | 
|---|
|  | 172 | float  ho_Om;       /* longitude of ascending node, degs */ | 
|---|
|  | 173 | float  ho_om;       /* argument of perihelion, degs. */ | 
|---|
|  | 174 | float  ho_e;        /* eccentricity */ | 
|---|
|  | 175 | float  ho_qp;       /* perihelion distance, AU */ | 
|---|
|  | 176 | float  ho_g, ho_k;  /* magnitude model coefficients */ | 
|---|
|  | 177 | float  ho_size;     /* angular size, in arc seconds at 1 AU */ | 
|---|
|  | 178 | } ObjH; | 
|---|
|  | 179 |  | 
|---|
|  | 180 | /* basic info about an object in parabolic heliocentric orbit */ | 
|---|
|  | 181 | typedef struct { | 
|---|
|  | 182 | OBJ_SOLSYS_FLDS; | 
|---|
|  | 183 | double po_epoch;    /* reference epoch, as an mjd */ | 
|---|
|  | 184 | double po_ep;       /* epoch of perihelion, as an mjd */ | 
|---|
|  | 185 | float  po_inc;      /* inclination, degs */ | 
|---|
|  | 186 | float  po_qp;       /* perihelion distance, AU */ | 
|---|
|  | 187 | float  po_om;       /* argument of perihelion, degs. */ | 
|---|
|  | 188 | float  po_Om;       /* longitude of ascending node, degs */ | 
|---|
|  | 189 | float  po_g, po_k;  /* magnitude model coefficients */ | 
|---|
|  | 190 | float  po_size;     /* angular size, in arc seconds at 1 AU */ | 
|---|
|  | 191 | } ObjP; | 
|---|
|  | 192 |  | 
|---|
|  | 193 | /* basic earth satellite object info */ | 
|---|
|  | 194 | typedef struct { | 
|---|
|  | 195 | OBJ_COMMON_FLDS; | 
|---|
|  | 196 | double eso_epoch;   /* reference epoch, as an mjd */ | 
|---|
|  | 197 | double eso_n;       /* mean motion, rev/day | 
|---|
|  | 198 | * N.B. we need double due to a sensitive differencing | 
|---|
|  | 199 | * operation used to compute MeanAnomaly in | 
|---|
|  | 200 | * esat_main()/satellite.c. | 
|---|
|  | 201 | */ | 
|---|
|  | 202 | float  eso_inc;     /* inclination, degs */ | 
|---|
|  | 203 | float  eso_raan;    /* RA of ascending node, degs */ | 
|---|
|  | 204 | float  eso_e;       /* eccentricity */ | 
|---|
|  | 205 | float  eso_ap;      /* argument of perigee at epoch, degs */ | 
|---|
|  | 206 | float  eso_M;       /* mean anomaly, ie, degrees from perigee at epoch */ | 
|---|
|  | 207 | float  eso_decay;   /* orbit decay rate, rev/day^2 */ | 
|---|
|  | 208 | float  eso_drag;    /* object drag coefficient, (earth radii)^-1 */ | 
|---|
|  | 209 | int    eso_orbit;   /* integer orbit number of epoch */ | 
|---|
|  | 210 |  | 
|---|
|  | 211 | /* computed "sky" results unique to earth satellites */ | 
|---|
|  | 212 | float  ess_elev;    /* height of satellite above sea level, m */ | 
|---|
|  | 213 | float  ess_range;   /* line-of-site distance from observer to satellite, m*/ | 
|---|
|  | 214 | float  ess_rangev;  /* rate-of-change of range, m/s */ | 
|---|
|  | 215 | float  ess_sublat;  /* latitude below satellite, >0 north, rads */ | 
|---|
|  | 216 | float  ess_sublng;  /* longitude below satellite, >0 east, rads */ | 
|---|
|  | 217 | int    ess_eclipsed;/* 1 if satellite is in earth's shadow, else 0 */ | 
|---|
|  | 218 | } ObjES; | 
|---|
|  | 219 |  | 
|---|
|  | 220 | typedef union { | 
|---|
|  | 221 | ObjAny  any;        /* these fields valid for all types */ | 
|---|
|  | 222 | ObjSS   anyss;      /* these fields valid for all solar system types */ | 
|---|
|  | 223 | ObjPl   pl;         /* planet */ | 
|---|
|  | 224 | ObjF    f;          /* fixed object */ | 
|---|
|  | 225 | ObjE    e;          /* object in heliocentric elliptical orbit */ | 
|---|
|  | 226 | ObjH    h;          /* object in heliocentric hyperbolic trajectory */ | 
|---|
|  | 227 | ObjP    p;          /* object in heliocentric parabolic trajectory */ | 
|---|
|  | 228 | ObjES   es;         /* earth satellite */ | 
|---|
|  | 229 | } Obj; | 
|---|
|  | 230 |  | 
|---|
|  | 231 |  | 
|---|
|  | 232 | /* for o_flags -- everybody must agree */ | 
|---|
|  | 233 | #define FUSER0          0x01 | 
|---|
|  | 234 | #define FUSER1          0x02 | 
|---|
|  | 235 | #define FUSER2          0x04 | 
|---|
|  | 236 | #define FUSER3          0x08 | 
|---|
|  | 237 | #define FUSER4          0x10 | 
|---|
|  | 238 | #define FUSER5          0x20 | 
|---|
|  | 239 | #define FUSER6          0x40 | 
|---|
|  | 240 | #define FUSER7          0x80 | 
|---|
|  | 241 |  | 
|---|
|  | 242 | /* mark an object as being a "field star" */ | 
|---|
|  | 243 | #define FLDSTAR         FUSER3 | 
|---|
|  | 244 |  | 
|---|
|  | 245 | /* Obj shorthands: */ | 
|---|
|  | 246 | #define o_type  any.co_type | 
|---|
|  | 247 | #define o_name  any.co_name | 
|---|
|  | 248 | #define o_flags any.co_flags | 
|---|
|  | 249 | #define o_age   any.co_age | 
|---|
|  | 250 | #define s_ra    any.co_ra | 
|---|
|  | 251 | #define s_dec   any.co_dec | 
|---|
|  | 252 | #define s_gaera any.co_gaera | 
|---|
|  | 253 | #define s_gaedec any.co_gaedec | 
|---|
|  | 254 | #define s_az    any.co_az | 
|---|
|  | 255 | #define s_alt   any.co_alt | 
|---|
|  | 256 | #define s_elong any.co_elong | 
|---|
|  | 257 | #define s_size  any.co_size | 
|---|
|  | 258 | #define s_mag   any.co_mag | 
|---|
|  | 259 |  | 
|---|
|  | 260 | #define s_sdist anyss.so_sdist | 
|---|
|  | 261 | #define s_edist anyss.so_edist | 
|---|
|  | 262 | #define s_hlong anyss.so_hlong | 
|---|
|  | 263 | #define s_hlat  anyss.so_hlat | 
|---|
|  | 264 | #define s_phase anyss.so_phase | 
|---|
|  | 265 |  | 
|---|
|  | 266 | #define s_elev          es.ess_elev | 
|---|
|  | 267 | #define s_range         es.ess_range | 
|---|
|  | 268 | #define s_rangev        es.ess_rangev | 
|---|
|  | 269 | #define s_sublat        es.ess_sublat | 
|---|
|  | 270 | #define s_sublng        es.ess_sublng | 
|---|
|  | 271 | #define s_eclipsed      es.ess_eclipsed | 
|---|
|  | 272 |  | 
|---|
|  | 273 | #define f_class f.fo_class | 
|---|
|  | 274 | #define f_spect f.fo_spect | 
|---|
|  | 275 | #define f_ratio f.fo_ratio | 
|---|
|  | 276 | #define f_pa    f.fo_pa | 
|---|
|  | 277 | #define f_epoch f.fo_epoch | 
|---|
|  | 278 | #define f_RA    f.fo_ra | 
|---|
|  | 279 | #define f_dec   f.fo_dec | 
|---|
|  | 280 | #define f_mag   f.fo_mag | 
|---|
|  | 281 | #define f_size  f.fo_size | 
|---|
|  | 282 |  | 
|---|
|  | 283 | #define e_cepoch e.eo_cepoch | 
|---|
|  | 284 | #define e_epoch e.eo_epoch | 
|---|
|  | 285 | #define e_inc   e.eo_inc | 
|---|
|  | 286 | #define e_Om    e.eo_Om | 
|---|
|  | 287 | #define e_om    e.eo_om | 
|---|
|  | 288 | #define e_a     e.eo_a | 
|---|
|  | 289 | #define e_e     e.eo_e | 
|---|
|  | 290 | #define e_M     e.eo_M | 
|---|
|  | 291 | #define e_size  e.eo_size | 
|---|
|  | 292 | #define e_mag   e.eo_mag | 
|---|
|  | 293 |  | 
|---|
|  | 294 | #define h_epoch h.ho_epoch | 
|---|
|  | 295 | #define h_ep    h.ho_ep | 
|---|
|  | 296 | #define h_inc   h.ho_inc | 
|---|
|  | 297 | #define h_Om    h.ho_Om | 
|---|
|  | 298 | #define h_om    h.ho_om | 
|---|
|  | 299 | #define h_e     h.ho_e | 
|---|
|  | 300 | #define h_qp    h.ho_qp | 
|---|
|  | 301 | #define h_g     h.ho_g | 
|---|
|  | 302 | #define h_k     h.ho_k | 
|---|
|  | 303 | #define h_size  h.ho_size | 
|---|
|  | 304 |  | 
|---|
|  | 305 | #define p_epoch p.po_epoch | 
|---|
|  | 306 | #define p_ep    p.po_ep | 
|---|
|  | 307 | #define p_inc   p.po_inc | 
|---|
|  | 308 | #define p_qp    p.po_qp | 
|---|
|  | 309 | #define p_om    p.po_om | 
|---|
|  | 310 | #define p_Om    p.po_Om | 
|---|
|  | 311 | #define p_g     p.po_g | 
|---|
|  | 312 | #define p_k     p.po_k | 
|---|
|  | 313 | #define p_size  p.po_size | 
|---|
|  | 314 |  | 
|---|
|  | 315 | #define es_epoch        es.eso_epoch | 
|---|
|  | 316 | #define es_inc          es.eso_inc | 
|---|
|  | 317 | #define es_raan         es.eso_raan | 
|---|
|  | 318 | #define es_e            es.eso_e | 
|---|
|  | 319 | #define es_ap           es.eso_ap | 
|---|
|  | 320 | #define es_M            es.eso_M | 
|---|
|  | 321 | #define es_n            es.eso_n | 
|---|
|  | 322 | #define es_decay        es.eso_decay | 
|---|
|  | 323 | #define es_drag         es.eso_drag | 
|---|
|  | 324 | #define es_orbit        es.eso_orbit | 
|---|
|  | 325 |  | 
|---|
|  | 326 | /* insure we always refer to the fields and no monkey business */ | 
|---|
|  | 327 | #undef OBJ_COMMON_FLDS | 
|---|
|  | 328 | #undef OBJ_SOLSYS_FLDS | 
|---|
|  | 329 |  | 
|---|
|  | 330 | /* o_type code. | 
|---|
|  | 331 | * N.B. names are assigned in order in objmenu.c | 
|---|
|  | 332 | * N.B. if add one: update the size init in db_init(); switch in obj_cir(). | 
|---|
|  | 333 | * N.B. UNDEFOBJ must be zero so new objects are undefinied by being zeroed. | 
|---|
|  | 334 | * N.B. maintain the bitmasks too. | 
|---|
|  | 335 | * N.B. PLANET must be last -- see objmenu.c | 
|---|
|  | 336 | */ | 
|---|
|  | 337 | enum ObjType { | 
|---|
|  | 338 | UNDEFOBJ=0, | 
|---|
|  | 339 | FIXED, ELLIPTICAL, HYPERBOLIC, PARABOLIC, EARTHSAT, PLANET, | 
|---|
|  | 340 | NOBJTYPES | 
|---|
|  | 341 | }; | 
|---|
|  | 342 |  | 
|---|
|  | 343 | /* types as handy bitmasks too */ | 
|---|
|  | 344 | #define FIXEDM          (1<<FIXED) | 
|---|
|  | 345 | #define ELLIPTICALM     (1<<ELLIPTICAL) | 
|---|
|  | 346 | #define HYPERBOLICM     (1<<HYPERBOLIC) | 
|---|
|  | 347 | #define PARABOLICM      (1<<PARABOLIC) | 
|---|
|  | 348 | #define EARTHSATM       (1<<EARTHSAT) | 
|---|
|  | 349 | #define PLANETM         (1<<PLANET) | 
|---|
|  | 350 | #define ALLM            (FIXEDM | HYPERBOLICM | PARABOLICM | EARTHSATM \ | 
|---|
|  | 351 | | ELLIPTICALM | PLANETM) | 
|---|
|  | 352 |  | 
|---|
|  | 353 | /* define a code for each member in each object type struct. | 
|---|
|  | 354 | * making them globally unique avoids a nested switch in db_set_field() and | 
|---|
|  | 355 | * helps with dynamic prompting based on preferences. | 
|---|
|  | 356 | */ | 
|---|
|  | 357 | enum { | 
|---|
|  | 358 | O_TYPE, O_NAME, | 
|---|
|  | 359 | F_RA, F_DEC, F_EPOCH, F_MAG, F_SIZE, F_CLASS, F_SPECT, | 
|---|
|  | 360 | E_INC, E_LAN, E_AOP, E_A, E_N, E_E, E_M, E_CEPOCH, E_EPOCH,E_M1,E_M2,E_SIZE, | 
|---|
|  | 361 | H_EP, H_INC, H_LAN, H_AOP, H_E, H_QP, H_EPOCH, H_G, H_K, H_SIZE, | 
|---|
|  | 362 | P_EP, P_INC, P_AOP, P_QP, P_LAN, P_EPOCH, P_G, P_K, P_SIZE, | 
|---|
|  | 363 | ES_EPOCH,ES_INC,ES_RAAN,ES_E,ES_AP,ES_M,ES_N,ES_DECAY,ES_ORBIT,ES_DRAG | 
|---|
|  | 364 | }; | 
|---|
|  | 365 |  | 
|---|
|  | 366 | /* rise, set and transit information. | 
|---|
|  | 367 | */ | 
|---|
|  | 368 | typedef struct { | 
|---|
|  | 369 | int rs_flags;       /* info about what has been computed and any | 
|---|
|  | 370 | * special conditions; see flags, below. | 
|---|
|  | 371 | */ | 
|---|
|  | 372 | double rs_risetm;   /* mjd time of rise today */ | 
|---|
|  | 373 | double rs_riseaz;   /* azimuth of rise, rads E of N */ | 
|---|
|  | 374 | double rs_trantm;   /* mjd time of transit today */ | 
|---|
|  | 375 | double rs_tranalt;  /* altitude of transit, rads up from horizon */ | 
|---|
|  | 376 | double rs_settm;    /* mjd time of set today */ | 
|---|
|  | 377 | double rs_setaz;    /* azimuth of set, rads E of N */ | 
|---|
|  | 378 | } RiseSet; | 
|---|
|  | 379 |  | 
|---|
|  | 380 | /* RiseSet flags */ | 
|---|
|  | 381 | #define RS_NORISE       0x0001  /* object does not rise as such today */ | 
|---|
|  | 382 | #define RS_NOSET        0x0002  /* object does not set as such today */ | 
|---|
|  | 383 | #define RS_NOTRANS      0x0004  /* object does not transit as such today */ | 
|---|
|  | 384 | #define RS_CIRCUMPOLAR  0x0010  /* object stays up all day today */ | 
|---|
|  | 385 | #define RS_NEVERUP      0x0020  /* object never up at all today */ | 
|---|
|  | 386 | #define RS_ERROR        0x1000  /* can't figure out anything! */ | 
|---|
|  | 387 | #define RS_RISERR       (0x0100|RS_ERROR) /* error computing rise */ | 
|---|
|  | 388 | #define RS_SETERR       (0x0200|RS_ERROR) /* error computing set */ | 
|---|
|  | 389 | #define RS_TRANSERR     (0x0400|RS_ERROR) /* error computing transit */ | 
|---|
|  | 390 |  | 
|---|
|  | 391 | #define is_type(op,m)   ((1<<(op)->o_type) & (m)) | 
|---|
|  | 392 | #define is_planet(op,p) (is_type(op,PLANETM) && ((ObjPl *)op)->pl_code==(p)) | 
|---|
|  | 393 | #define is_ssobj(op)    is_type(op,PLANETM|HYPERBOLICM|PARABOLICM|ELLIPTICALM) | 
|---|
|  | 394 |  | 
|---|
|  | 395 | /* used to maintain progress state with db_scanint() and db_scan */ | 
|---|
|  | 396 | typedef struct { | 
|---|
|  | 397 | int m;      /* mask of *N types desired */ | 
|---|
|  | 398 | int t;      /* current Object type, as per ObjType */ | 
|---|
|  | 399 | int n;      /* number of objects "scanned" so far */ | 
|---|
|  | 400 | ObjF *op;   /* local list to also scan */ | 
|---|
|  | 401 | int nop;    /* number in op[] */ | 
|---|
|  | 402 | } DBScan; | 
|---|
|  | 403 |  | 
|---|
|  | 404 | #endif /* _CIRCUM_H */ | 
|---|
|  | 405 |  | 
|---|
|  | 406 |  | 
|---|
|  | 407 |  | 
|---|
|  | 408 | /* Some handy declarations */ | 
|---|
|  | 409 |  | 
|---|
|  | 410 | /* ap_as.c */ | 
|---|
|  | 411 | extern void ap_as P_(( Now *np, double Mjd, double *rap, double *decp)); | 
|---|
|  | 412 | extern void as_ap P_(( Now *np, double Mjd, double *rap, double *decp)); | 
|---|
|  | 413 |  | 
|---|
|  | 414 | /* aux.c */ | 
|---|
|  | 415 | extern double mm_mjed P_((Now *np)); | 
|---|
|  | 416 |  | 
|---|
|  | 417 | /* circum.c */ | 
|---|
|  | 418 | extern int obj_cir P_((Now *np, Obj *op)); | 
|---|
|  | 419 |  | 
|---|
|  | 420 | /* earthsat.c */ | 
|---|
|  | 421 | extern int obj_earthsat P_((Now *np, Obj *op)); | 
|---|
|  | 422 |  | 
|---|
|  | 423 | /* dbfmt.c */ | 
|---|
|  | 424 | extern int db_crack_line P_((char s[], Obj *op, char whynot[])); | 
|---|
|  | 425 | extern void db_write_line P_((Obj *op, char *lp)); | 
|---|
|  | 426 | extern int get_fields P_((char *s, int delim, char *fields[])); | 
|---|
|  | 427 | extern int db_chk_planet P_((char name[], Obj *op)); | 
|---|
|  | 428 | extern int db_tle P_((char *name, char *l1, char *l2, Obj *op)); | 
|---|
|  | 429 |  | 
|---|
|  | 430 | /* misc.c */ | 
|---|
|  | 431 | extern void now_lst P_((Now *np, double *lstp)); | 
|---|
|  | 432 | extern void radec2ha P_((Now *np, double ra, double dec, double *hap)); | 
|---|
|  | 433 | extern char *obj_description P_((Obj *op)); | 
|---|
|  | 434 | extern int is_deepsky P_((Obj *op)); | 
|---|
|  | 435 |  | 
|---|
|  | 436 | /* riset_cir.c */ | 
|---|
|  | 437 | extern void riset_cir P_((Now *np, Obj *op, double dis, RiseSet *rp)); | 
|---|
|  | 438 | extern void twilight_cir P_((Now *np, double dis, double *dawn, double *dusk, | 
|---|
|  | 439 | int *status)); | 
|---|
|  | 440 |  | 
|---|
| [1719] | 441 | /* For RCS Only -- Do Not Edit | 
|---|
| [1457] | 442 | * @(#) $RCSfile: circum.h,v $ $Date: 2001-10-22 12:08:26 $ $Revision: 1.2 $ $Name: not supported by cvs2svn $ | 
|---|
|  | 443 | */ | 
|---|