| 1 | #include <math.h>
 | 
|---|
| 2 | 
 | 
|---|
| 3 | #include "P_.h"
 | 
|---|
| 4 | #include "astro.h"
 | 
|---|
| 5 | 
 | 
|---|
| 6 | /* convert those orbital elements that change from epoch mjd0 to epoch mjd.
 | 
|---|
| 7 |  */
 | 
|---|
| 8 | void
 | 
|---|
| 9 | reduce_elements (mjd0, mjd, inc0, ap0, om0, inc, ap, om)
 | 
|---|
| 10 | double mjd0;    /* initial epoch */
 | 
|---|
| 11 | double mjd;     /* desired epoch */
 | 
|---|
| 12 | double inc0;    /* initial inclination, rads */
 | 
|---|
| 13 | double ap0;     /* initial argument of perihelion, as an mjd */
 | 
|---|
| 14 | double om0;     /* initial long of ascending node, rads */
 | 
|---|
| 15 | double *inc;    /* desired inclination, rads */
 | 
|---|
| 16 | double *ap;     /* desired epoch of perihelion, as an mjd */
 | 
|---|
| 17 | double *om;     /* desired long of ascending node, rads */
 | 
|---|
| 18 | {
 | 
|---|
| 19 |         double t0, t1;
 | 
|---|
| 20 |         double tt, tt2, t02, tt3;
 | 
|---|
| 21 |         double eta, th, th0;
 | 
|---|
| 22 |         double a, b;
 | 
|---|
| 23 |         double dap;
 | 
|---|
| 24 |         double cinc, sinc;
 | 
|---|
| 25 |         double ot, sot, cot, ot1;
 | 
|---|
| 26 |         double seta, ceta;
 | 
|---|
| 27 | 
 | 
|---|
| 28 |         if (fabs(mjd - mjd0) < 1e-5) {
 | 
|---|
| 29 |             /* sin(eta) blows for inc < 10 degrees -- anyway, no need */
 | 
|---|
| 30 |             *inc = inc0;
 | 
|---|
| 31 |             *ap = ap0;
 | 
|---|
| 32 |             *om = om0;
 | 
|---|
| 33 |             return;
 | 
|---|
| 34 |         }
 | 
|---|
| 35 | 
 | 
|---|
| 36 |         t0 = mjd0/365250.0;
 | 
|---|
| 37 |         t1 = mjd/365250.0;
 | 
|---|
| 38 | 
 | 
|---|
| 39 |         tt = t1-t0;
 | 
|---|
| 40 |         tt2 = tt*tt;
 | 
|---|
| 41 |         t02 = t0*t0;
 | 
|---|
| 42 |         tt3 = tt*tt2;
 | 
|---|
| 43 |         eta = (471.07-6.75*t0+.57*t02)*tt+(.57*t0-3.37)*tt2+.05*tt3;
 | 
|---|
| 44 |         th0 = 32869.0*t0+56*t02-(8694+55*t0)*tt+3*tt2;
 | 
|---|
| 45 |         eta = degrad(eta/3600.0);
 | 
|---|
| 46 |         th0 = degrad((th0/3600.0)+173.950833);
 | 
|---|
| 47 |         th = (50256.41+222.29*t0+.26*t02)*tt+(111.15+.26*t0)*tt2+.1*tt3;
 | 
|---|
| 48 |         th = th0+degrad(th/3600.0);
 | 
|---|
| 49 |         cinc = cos(inc0);
 | 
|---|
| 50 |         sinc = sin(inc0);
 | 
|---|
| 51 |         ot = om0-th0;
 | 
|---|
| 52 |         sot = sin(ot);
 | 
|---|
| 53 |         cot = cos(ot);
 | 
|---|
| 54 |         seta = sin(eta);
 | 
|---|
| 55 |         ceta = cos(eta);
 | 
|---|
| 56 |         a = sinc*sot;
 | 
|---|
| 57 |         b = ceta*sinc*cot-seta*cinc;
 | 
|---|
| 58 |         ot1 = atan(a/b);
 | 
|---|
| 59 |         if (b<0) ot1 += PI;
 | 
|---|
| 60 |         b = sinc*ceta-cinc*seta*cot;
 | 
|---|
| 61 |         a = -1*seta*sot;
 | 
|---|
| 62 |         dap = atan(a/b);
 | 
|---|
| 63 |         if (b<0) dap += PI;
 | 
|---|
| 64 | 
 | 
|---|
| 65 |         *ap = ap0+dap;
 | 
|---|
| 66 |         range (ap, 2*PI);
 | 
|---|
| 67 |         *om = ot1+th;
 | 
|---|
| 68 |         range (om, 2*PI);
 | 
|---|
| 69 | 
 | 
|---|
| 70 |         if (inc0<.175)
 | 
|---|
| 71 |             *inc = asin(a/sin(dap));
 | 
|---|
| 72 |         else
 | 
|---|
| 73 |             *inc = 1.570796327-asin((cinc*ceta)+(sinc*seta*cot));
 | 
|---|
| 74 | }
 | 
|---|
| 75 | 
 | 
|---|
| 76 | /* For RCS Only -- Do Not Edit */
 | 
|---|
| 77 | static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: reduce.c,v $ $Date: 2001-10-22 12:08:27 $ $Revision: 1.2 $ $Name: not supported by cvs2svn $"};
 | 
|---|