39 #include "Astro_Functions.h"
40 #include "propagateKEP.h"
41 #include "time2distance.h"
45 double time2distance(
const double *r0,
const double *v0,
const double &rtarget)
49 double r0norm = norm2(r0);
50 double a, e, E0, p, ni, Et;
66 double ra = a * (1+e);
71 ni = acos((p/rtarget-1)/e);
72 Et = 2*atan(sqrt((1-e)/(1+e))*tan(ni/2));
75 return sqrt(pow(a,3))*(Et-e*sin(Et)-E0 + e*sin(E0));
79 return sqrt(pow(a,3))*(Et-e*sin(Et)+E0 - e*sin(E0));
85 ni = acos((p/rtarget-1)/e);
86 Et = 2*atan(sqrt((e-1)/(e+1))*tan(ni/2));
89 return sqrt(pow((-a),3))*(e*tan(Et)-log(tan(Et/2+M_PI/4))-e*tan(E0)+log(tan(E0/2+M_PI/4)));
93 return sqrt(pow((-a),3))*(e*tan(Et)-log(tan(Et/2+M_PI/4))+e*tan(E0)-log(tan(E0/2+M_PI/4)));