def vector_direction_re_north(s, d):
"""
Make the source as the reference of the plan. Then compute atan2 of the resulting destination point
:param s: source point
:param d: destination point
:return: angle!
"""
# find the new coordinates of the destination point in a plan originated at source.
new_d_lon = d.lon - s.lon
new_d_lat = d.lat - s.lat
angle = -math.degrees(math.atan2(new_d_lat, new_d_lon)) + 90
# the following is required to move the degrees from -180, 180 to 0, 360
if angle < 0:
angle = angle + 360
return angle
评论列表
文章目录