I THINK that the single shooter is ok. I can always improve it later

This commit is contained in:
rconnorjohnstone
2021-06-17 23:36:50 -06:00
parent 2c39c34f01
commit 966f954528
13 changed files with 170 additions and 61 deletions

View File

@@ -41,32 +41,24 @@ function xyz_to_oe(cart_vec::Vector,μ::Real)
e = norm(e_xyz)
if h_xyz[3]/h < 1.
i = acos(h_xyz[3]/h) #rad
elseif h_xyz[3]/h < 1.000001
i = acos(1.)
else
error("bad i")
i = acos(1.)
end
n_xyz = cross([0,0,1],h_xyz)
if dot(n_xyz,[1,0,0])/norm(n_xyz) < 1.
Ω = acos(dot(n_xyz,[1,0,0])/norm(n_xyz))
elseif dot(n_xyz,[1,0,0])/norm(n_xyz) < 1.0001
Ω = acos(1.)
else
error("bad Ω")
Ω = acos(1.)
end
if dot(n_xyz,e_xyz)/(norm(n_xyz)*e) < 1.
ω = acos(dot(n_xyz,e_xyz)/(norm(n_xyz)*e))
elseif dot(n_xyz,e_xyz)/(norm(n_xyz)*e) < 1.0001
ω = acos(1.)
else
error("bad ω: $(e_xyz)")
ω = acos(1.)
end
if abs((dot(r_xyz,e_xyz))/(r*norm(e_xyz))) < 1.
ν = acos((dot(r_xyz,e_xyz))/(r*norm(e_xyz)))
elseif (dot(r_xyz,e_xyz))/(r*norm(e_xyz)) < 1.0001
ν = acos(1.)
else
error("bad ν")
ν = acos(1.)
end
Ω = dot(n_xyz,[0,1,0]) > 0. ? Ω : -Ω
ω = dot(e_xyz,[0,0,1]) > 0. ? ω : -ω