def cvt_v2v3_using_body2inertial_Q_to_c1c2pa_tuple(Q,v2,v3):
"""Given Q and v2,v3 gives pos on sky and V3 PA """
Vp_body = Vector(0.,0.,0.)
Vp_body.set_xyz_from_angs(v2,v3)
Vp_eci_pt = Q.cnvrt(Vp_body)
coord1 = atan2(Vp_eci_pt.y,Vp_eci_pt.x)
if coord1 < 0. : coord1 += PI2
coord2 = asin(unit_limit(Vp_eci_pt.z))
V3_body = Vector(0.,0.,1.)
V3_eci_pt = Q.cnvrt(V3_body)
NP_eci = Vector(0.,0.,1.)
V_left = cross(NP_eci,Vp_eci_pt)
if V_left.length()>0.:
V_left = V_left/V_left.length()
NP_in_plane = cross(Vp_eci_pt,V_left)
x = dot(V3_eci_pt,NP_in_plane)
y = dot(V3_eci_pt,V_left)
pa = atan2(y,x)
if pa < 0. : pa += PI2
return (coord1,coord2,pa)
评论列表
文章目录