elliptic_to_rectangular.c   elliptic_to_rectangular.c 
skipping to change at line 46 skipping to change at line 46
#include "elliptic_to_rectangular.h" #include "elliptic_to_rectangular.h"
#include <math.h> #include <math.h>
#ifndef M_PI #ifndef M_PI
#define M_PI 3.14159265358979323846 #define M_PI 3.14159265358979323846
#endif #endif
static void static void
EllipticToRectangular(const double mu,const double a,const double n, EllipticToRectangular(const double a,const double n,
const double elem[6],const double dt,double xyz[]) { const double elem[6],const double dt,double xyz[]) {
const double L = fmod(elem[1]+n*dt,2.0*M_PI); const double L = fmod(elem[1]+n*dt,2.0*M_PI);
/* solve Keplers equation /* solve Keplers equation
x = L - elem[2]*sin(x) + elem[3]*cos(x) x = L - elem[2]*sin(x) + elem[3]*cos(x)
not by trivially iterating not by trivially iterating
x_0 = L x_0 = L
x_{j+1} = L - elem[2]*sin(x_j) + elem[3]*cos(x_j) x_{j+1} = L - elem[2]*sin(x_j) + elem[3]*cos(x_j)
but instead by Newton approximation: but instead by Newton approximation:
0 = f(x) = x - L - elem[2]*sin(x) + elem[3]*cos(x) 0 = f(x) = x - L - elem[2]*sin(x) + elem[3]*cos(x)
f'(x) = 1 - elem[2]*cos(x) - elem[3]*sin(x) f'(x) = 1 - elem[2]*cos(x) - elem[3]*sin(x)
skipping to change at line 115 skipping to change at line 115
void EllipticToRectangularN(double mu,const double elem[6],double dt, void EllipticToRectangularN(double mu,const double elem[6],double dt,
double xyz[]) { double xyz[]) {
const double n = elem[0]; const double n = elem[0];
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISO C99 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISO C99
/* linux math.h declares cbrt: */ /* linux math.h declares cbrt: */
const double a = cbrt(mu/(n*n)); const double a = cbrt(mu/(n*n));
#else #else
const double a = exp(log(mu/(n*n))/3.0); const double a = exp(log(mu/(n*n))/3.0);
#endif #endif
EllipticToRectangular(mu,a,n,elem,dt,xyz); EllipticToRectangular(a,n,elem,dt,xyz);
} }
void EllipticToRectangularA(double mu,const double elem[6],double dt, void EllipticToRectangularA(double mu,const double elem[6],double dt,
double xyz[]) { double xyz[]) {
const double a = elem[0]; const double a = elem[0];
const double n = sqrt(mu/(a*a*a)); const double n = sqrt(mu/(a*a*a));
EllipticToRectangular(mu,a,n,elem,dt,xyz); EllipticToRectangular(a,n,elem,dt,xyz);
} }
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 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/