def calc_user_look_at(pos_sat, lat, lon, alt, t):
pos = calc_pos(lat, lon, alt, t)
rx = pos_sat.x - pos.x
ry = pos_sat.y - pos.y
rz = pos_sat.z - pos.z
jd = julian_date(t)
theta = (theta_g_JD(jd) + lon) % TWO_PI
top_s = sin(lat) * cos(theta) * rx + \
sin(lat) * sin(theta) * ry - \
cos(lat) * rz
top_e = -sin(theta) * rx + \
cos(theta) * ry
top_z = cos(lat) * cos(theta) * rx + \
cos(lat) * sin(theta) * ry + \
sin(lat) * rz
az = atan(-top_e/top_s)
if top_s > 0:
az += pi
if az < 0:
az += TWO_PI
rg = (rx*rx + ry*ry + rz*rz)**0.5
el = asin(top_z/rg)
return (az, el, rg)
评论列表
文章目录