open_landscape_math.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:open_landscape 作者: furti 项目源码 文件源码
def point_from_distance_and_angle(point: CoordinatePoint, distance_in_m: float,
                                  angle_in_degrees: int) -> CoordinatePoint:
    """Calculates a point with the given angle and distance meters away from the given point"""

    lat1 = math.radians(point.latitude)
    lon1 = math.radians(point.longitude)

    distance = distance_in_m / 1000 / 6371
    angle = math.radians(angle_in_degrees)

    lat2 = math.asin(math.sin(lat1) * math.cos(distance) +
                     math.cos(lat1) * math.sin(distance) * math.cos(angle))
    lon2 = lon1 + math.asin((math.sin(distance) /
                             math.cos(lat2)) * math.sin(angle))

    return CoordinatePoint(latitude=math.degrees(lat2), longitude=math.degrees(lon2))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号