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