tass17.c   tass17.c 
skipping to change at line 57 skipping to change at line 57
the previousely calculated elements if possible the previousely calculated elements if possible
****************************************************************/ ****************************************************************/
#include "tass17.h" #include "tass17.h"
#include "calc_interpolated_elements.h" #include "calc_interpolated_elements.h"
#include "elliptic_to_rectangular.h" #include "elliptic_to_rectangular.h"
#include <math.h> #include <math.h>
struct Tass17Term { struct Tass17Term
double s[3]; {
}; double s[3];
};
struct Tass17MultiTerm {
signed char i[8]; struct Tass17MultiTerm
int nr_of_terms; {
const struct Tass17Term *terms; signed char i[8];
}; int nr_of_terms;
const struct Tass17Term *terms;
struct Tass17Series { };
int nr_of_multi_terms;
const struct Tass17MultiTerm *multi_terms; struct Tass17Series
}; {
int nr_of_multi_terms;
struct Tass17Body { const struct Tass17MultiTerm *multi_terms;
const char *name; };
double mu;
double aam; struct Tass17Body
double s0[6]; {
struct Tass17Series series[4]; const char *name;
double mu;
double aam;
double s0[6];
struct Tass17Series series[4];
}; };
static const struct Tass17Term MIMAS_0_0[2] = { static const struct Tass17Term MIMAS_0_0[2] = {
{{ 2.760763800054540e-05, 6.863463000141887e-01, 2.437929552050393e-04}}, {{ 2.760763800054540e-05, 6.863463000141887e-01, 2.437929552050393e-04}},
{{ 9.347313993693880e-06, 2.209688858348459e+00, 2.791965241219151e-02}}, {{ 9.347313993693880e-06, 2.209688858348459e+00, 2.791965241219151e-02}},
}; };
static const struct Tass17Term MIMAS_0_1[5] = { static const struct Tass17Term MIMAS_0_1[5] = {
{{ 1.247132122206555e-04, 3.384553386830940e+00, 6.649590915041870e+00}}, {{ 1.247132122206555e-04, 3.384553386830940e+00, 6.649590915041870e+00}},
{{ 5.773002078925660e-05, 9.293070332553311e-01, 6.649834707997076e+00}}, {{ 5.773002078925660e-05, 9.293070332553311e-01, 6.649834707997076e+00}},
skipping to change at line 3039 skipping to change at line 3043
-3.958228521883369e-04}, -3.958228521883369e-04},
{ {
{1,HYPERION_0}, {1,HYPERION_0},
{1,HYPERION_1}, {1,HYPERION_1},
{1,HYPERION_2}, {1,HYPERION_2},
{1,HYPERION_3}, {1,HYPERION_3},
} }
}, },
}; };
static void static void CalcLon(double t,double lon[7])
CalcLon(double t,double lon[7]) { {
int i; int i;
for (i=0;i<7;i++,lon++) { for (i=0;i<7;i++,lon++)
const struct Tass17MultiTerm *const tmt_begin = {
tass17bodies[i].series[1].multi_terms; const struct Tass17MultiTerm *const tmt_begin = tass17bodies
const struct Tass17Term *const tt_begin = tmt_begin->terms; [i].series[1].multi_terms;
const struct Tass17Term *tt = tt_begin + tmt_begin->nr_of_terms; const struct Tass17Term *const tt_begin = tmt_begin->terms;
*lon = 0; const struct Tass17Term *tt = tt_begin + tmt_begin->nr_of_te
while (--tt >= tt_begin) { rms;
*lon += tt->s[0]*sin(tt->s[1]+tt->s[2]*t); *lon = 0;
} while (--tt >= tt_begin)
} {
*lon += tt->s[0]*sin(tt->s[1]+tt->s[2]*t);
}
}
} }
static void static void CalcTass17Elem(double t,const double lon[7],int body,double ele
CalcTass17Elem(double t,const double lon[7],int body,double elem[6]) { m[6])
const struct Tass17MultiTerm *tmt_begin,*tmt; {
int i; const struct Tass17MultiTerm *tmt_begin,*tmt;
for (i=0;i<6;i++) elem[i] = tass17bodies[body].s0[i]; int i;
for (i=0;i<6;i++) elem[i] = tass17bodies[body].s0[i];
tmt_begin = tass17bodies[body].series[0].multi_terms;
tmt = tmt_begin + tass17bodies[body].series[0].nr_of_multi_terms; tmt_begin = tass17bodies[body].series[0].multi_terms;
while (--tmt >= tmt_begin) { tmt = tmt_begin + tass17bodies[body].series[0].nr_of_multi_terms;
const struct Tass17Term *const tt_begin = tmt->terms; while (--tmt >= tmt_begin)
const struct Tass17Term *tt = tt_begin + tmt->nr_of_terms; {
double arg = 0; const struct Tass17Term *const tt_begin = tmt->terms;
for (i=0;i<7;i++) arg += tmt->i[i]*lon[i]; const struct Tass17Term *tt = tt_begin + tmt->nr_of_terms;
while (--tt >= tt_begin) elem[0] += tt->s[0]*cos(tt->s[1]+tt->s[2]*t+ar double arg = 0;
g); for (i=0;i<7;i++) arg += tmt->i[i]*lon[i];
} while (--tt >= tt_begin) elem[0] += tt->s[0]*cos(tt->s[1]+tt
elem[0] = tass17bodies[body].aam * (1.0 + elem[0]); ->s[2]*t+arg);
}
tmt_begin = tass17bodies[body].series[1].multi_terms; elem[0] = tass17bodies[body].aam * (1.0 + elem[0]);
tmt = tmt_begin + tass17bodies[body].series[1].nr_of_multi_terms;
if (body != 7) { /* first multiterm already calculated: lon[body];*/ tmt_begin = tass17bodies[body].series[1].multi_terms;
tmt_begin++; tmt = tmt_begin + tass17bodies[body].series[1].nr_of_multi_terms;
elem[1] += lon[body]; if (body != 7)
} { /* first multiterm already calculated: lon[body];*/
while (--tmt >= tmt_begin) { tmt_begin++;
const struct Tass17Term *const tt_begin = tmt->terms; elem[1] += lon[body];
const struct Tass17Term *tt = tt_begin + tmt->nr_of_terms; }
double arg = 0; while (--tmt >= tmt_begin)
for (i=0;i<7;i++) arg += tmt->i[i]*lon[i]; {
while (--tt >= tt_begin) elem[1] += tt->s[0]*sin(tt->s[1]+tt->s[2]*t+ar const struct Tass17Term *const tt_begin = tmt->terms;
g); const struct Tass17Term *tt = tt_begin + tmt->nr_of_terms;
} double arg = 0;
elem[1] += tass17bodies[body].aam * t; for (i=0;i<7;i++) arg += tmt->i[i]*lon[i];
while (--tt >= tt_begin) elem[1] += tt->s[0]*sin(tt->s[1]+tt
tmt_begin = tass17bodies[body].series[2].multi_terms; ->s[2]*t+arg);
tmt = tmt_begin + tass17bodies[body].series[2].nr_of_multi_terms; }
while (--tmt >= tmt_begin) { elem[1] += tass17bodies[body].aam * t;
const struct Tass17Term *const tt_begin = tmt->terms;
const struct Tass17Term *tt = tt_begin + tmt->nr_of_terms; tmt_begin = tass17bodies[body].series[2].multi_terms;
double arg = 0; tmt = tmt_begin + tass17bodies[body].series[2].nr_of_multi_terms;
for (i=0;i<7;i++) arg += tmt->i[i]*lon[i]; while (--tmt >= tmt_begin)
while (--tt >= tt_begin) { {
const double x = tt->s[1] + tt->s[2]*t + arg; const struct Tass17Term *const tt_begin = tmt->terms;
elem[2] += tt->s[0]*cos(x); const struct Tass17Term *tt = tt_begin + tmt->nr_of_terms;
elem[3] += tt->s[0]*sin(x); double arg = 0;
} for (i=0;i<7;i++) arg += tmt->i[i]*lon[i];
} while (--tt >= tt_begin)
{
tmt_begin = tass17bodies[body].series[3].multi_terms; const double x = tt->s[1] + tt->s[2]*t + arg;
tmt = tmt_begin + tass17bodies[body].series[3].nr_of_multi_terms; elem[2] += tt->s[0]*cos(x);
while (--tmt >= tmt_begin) { elem[3] += tt->s[0]*sin(x);
const struct Tass17Term *const tt_begin = tmt->terms; }
const struct Tass17Term *tt = tt_begin + tmt->nr_of_terms; }
double arg = 0;
for (i=0;i<7;i++) arg += tmt->i[i]*lon[i]; tmt_begin = tass17bodies[body].series[3].multi_terms;
while (--tt >= tt_begin) { tmt = tmt_begin + tass17bodies[body].series[3].nr_of_multi_terms;
const double x = tt->s[1] + tt->s[2]*t + arg; while (--tmt >= tmt_begin)
elem[4] += tt->s[0]*cos(x); {
elem[5] += tt->s[0]*sin(x); const struct Tass17Term *const tt_begin = tmt->terms;
} const struct Tass17Term *tt = tt_begin + tmt->nr_of_terms;
} double arg = 0;
for (i=0;i<7;i++) arg += tmt->i[i]*lon[i];
while (--tt >= tt_begin)
{
const double x = tt->s[1] + tt->s[2]*t + arg;
elem[4] += tt->s[0]*cos(x);
elem[5] += tt->s[0]*sin(x);
}
}
} }
static static
const double TASS17toVSOP87[9] = { const double TASS17toVSOP87[9] = {
-9.833473364922412278e-01,-1.603871593615649693e-01, 8.546329577978411975 e-02, -9.833473364922412278e-01,-1.603871593615649693e-01, 8.546329577978411975 e-02,
1.817361158757799129e-01,-8.678312794665074866e-01, 4.624292968291581735 e-01, 1.817361158757799129e-01,-8.678312794665074866e-01, 4.624292968291581735 e-01,
0.000000000000000000e+00, 4.702603847778936010e-01, 8.825277165667645230 e-01 0.000000000000000000e+00, 4.702603847778936010e-01, 8.825277165667645230 e-01
}; };
/* /*
skipping to change at line 3144 skipping to change at line 3156
static double t_2 = -1e100; static double t_2 = -1e100;
static double tass17_elem_0[TASS17_DIM]; static double tass17_elem_0[TASS17_DIM];
static double tass17_elem_1[TASS17_DIM]; static double tass17_elem_1[TASS17_DIM];
static double tass17_elem_2[TASS17_DIM]; static double tass17_elem_2[TASS17_DIM];
/* 1 day: */ /* 1 day: */
#define DELTA_T 1.0 #define DELTA_T 1.0
static double tass17_jd0 = -1e100; static double tass17_jd0 = -1e100;
static double tass17_elem[TASS17_DIM]; static double tass17_elem[TASS17_DIM];
void CalcAllTass17Elem(const double t,double elem[TASS17_DIM]) { void CalcAllTass17Elem(const double t,double elem[TASS17_DIM])
int body; {
double lon[7]; int body;
CalcLon(t,lon); double lon[8];
// FIXME: why here body<=7 and why body<7 broke drawing orbits? CalcLon(t,lon);
for (body=0;body<=7;body++) CalcTass17Elem(t,lon,body,elem+(body*6)); for (body=0;body<=7;body++) CalcTass17Elem(t,lon,body,elem+(body*6))
;
} }
void GetTass17Coor(double jd,int body,double *xyz) { void GetTass17Coor(double jd,int body,double *xyz)
GetTass17OsculatingCoor(jd,jd,body,xyz); {
GetTass17OsculatingCoor(jd,jd,body,xyz);
} }
void GetTass17OsculatingCoor(const double jd0,const double jd, void GetTass17OsculatingCoor(const double jd0,const double jd, const int bo
const int body,double *xyz) { dy,double *xyz)
double x[3]; {
if (jd0 != tass17_jd0) { double x[3];
const double t0 = jd0 - 2444240.0; if (jd0 != tass17_jd0)
tass17_jd0 = jd0; {
CalcInterpolatedElements(t0,tass17_elem, const double t0 = jd0 - 2444240.0;
TASS17_DIM, tass17_jd0 = jd0;
&CalcAllTass17Elem,DELTA_T, CalcInterpolatedElements(t0,tass17_elem,
&t_0,tass17_elem_0, TASS17_DIM,
&t_1,tass17_elem_1, &CalcAllTass17Elem,DELTA_T,
&t_2,tass17_elem_2); &t_0,tass17_elem_0,
/* &t_1,tass17_elem_1,
printf("GetTass17Coor(%d): %f %f %f %f %f %f\n", &t_2,tass17_elem_2);
body, /*
tass17_elem[body*6+0],tass17_elem[body*6+1],tass17_elem[body*6+2 printf("GetTass17Coor(%d): %f %f %f %f %f %f\n",
], body,
tass17_elem[body*6+3],tass17_elem[body*6+4],tass17_elem[body*6+5 tass17_elem[body*6+0],tass17_elem[body*6+1],tass17_e
]); lem[body*6+2],
*/ tass17_elem[body*6+3],tass17_elem[body*6+4],tass17_e
} lem[body*6+5]);
EllipticToRectangularN(tass17bodies[body].mu,tass17_elem+(body*6),jd-jd0, */
x); }
xyz[0] = TASS17toVSOP87[0]*x[0]+TASS17toVSOP87[1]*x[1]+TASS17toVSOP87[2]* EllipticToRectangularN(tass17bodies[body].mu,tass17_elem+(body*6),jd
x[2]; -jd0,x);
xyz[1] = TASS17toVSOP87[3]*x[0]+TASS17toVSOP87[4]*x[1]+TASS17toVSOP87[5]* xyz[0] = TASS17toVSOP87[0]*x[0]+TASS17toVSOP87[1]*x[1]+TASS17toVSOP8
x[2]; 7[2]*x[2];
xyz[2] = TASS17toVSOP87[6]*x[0]+TASS17toVSOP87[7]*x[1]+TASS17toVSOP87[8]* xyz[1] = TASS17toVSOP87[3]*x[0]+TASS17toVSOP87[4]*x[1]+TASS17toVSOP8
x[2]; 7[5]*x[2];
xyz[2] = TASS17toVSOP87[6]*x[0]+TASS17toVSOP87[7]*x[1]+TASS17toVSOP8
7[8]*x[2];
} }
 End of changes. 6 change blocks. 
132 lines changed or deleted 151 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/