View Single Post
  #1  
Old April 8th 04, 06:23 PM
james
external usenet poster
 
Posts: n/a
Default Orbital elements

Hello

Ok this is a difficult one (well for me any way)

How do you calculate an objects heilocentric co-ordinates (x,y,z with
the sun at the center) of an object given its Epoch,a,e,i,w,Node,M
values ?

Any pointers will help even if its just a weblink


This is what I have so far in c++

double T,au,e,i,omega,n,w,M,F,G,H,P,Q,R,A,B,C,a,b,c = 0.0;

CString temp;
m_a.GetWindowText(temp);
au = atof(temp);
m_t.GetWindowText(temp);
T = atof(temp);
m_e.GetWindowText(temp);
e = atof(temp);
m_i.GetWindowText(temp);
i = atof(temp);
m_omega.GetWindowText(temp);
omega = atof(temp);
m_w.GetWindowText(temp);
w = atof(temp);
m_n.GetWindowText(temp);
n = atof(temp);

F = cos(omega * DegRad);
G = (sin(omega * DegRad) * 0.917482062);
H = (sin(omega * DegRad) * 0.397777156);

P = -sin(omega * DegRad) * cos(i * DegRad);
Q = (cos(omega * DegRad) * cos(i * DegRad) * 0.917482062) - (sin(i *
DegRad) * 0.397777156);
R = (cos(omega * DegRad) * cos(i * DegRad) * 0.397777156) + (sin(i *
DegRad) * 0.917482062);

A = rev(atan2(F,P) * RadDeg);
B = rev(atan2(G,Q) * RadDeg);
C = rev(atan2(H,R) * RadDeg);

a = sqrt(F*F + P*P);
b = sqrt(G*G + Q*Q);
c = sqrt(H*H + R*R);

n = 0.9856076696 / (au * sqrt(au));

M = T * n;

double E0 = M;
double E1 = E0 + ((M + (e * RadDeg) * sin(E0 * DegRad) - E0) / (1 - e
* cos(E0 * DegRad)));
double E2 = E1 + ((M + (e * RadDeg) * sin(E1 * DegRad) - E1) / (1 - e
* cos(E1 * DegRad)));
double E3 = E2 + ((M + (e * RadDeg) * sin(E2 * DegRad) - E2) / (1 - e
* cos(E2 * DegRad)));
double E4 = E3 + ((M + (e * RadDeg) * sin(E3 * DegRad) - E3) / (1 - e
* cos(E3 * DegRad)));

double x = au * (cos(E4 * DegRad) - e);
double y = au * sqrt(1 - e*e) * sin(E4 *DegRad);
double v = atan2(y,x);
v = v * RadDeg;

double r = au * ( 1 - e * cos(E4 * DegRad) );

double X = r * a * sin((A + w + v) * DegRad);
double Y = r * b * sin((B + w + v) * DegRad);
double Z = r * c * sin((C + w + v) * DegRad);

temp.Format("%f",X);
m_x.SetWindowText(temp);
temp.Format("%f",Y);
m_y.SetWindowText(temp);
temp.Format("%f",Z);
m_z.SetWindowText(temp);