Ignore:
Timestamp:
Jun 15, 2004, 6:54:12 PM (21 years ago)
Author:
cmv
Message:

nouvelle version de xephem/libastro (3.6) cmv 15/6/04

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaExt/XephemAstroLib/astro.h

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