python怎么计算圆_Python计算两个大圆的交点

我试图计算两个大圆的交点(纬度和经度),这两个大圆都是由圆上的两点定义的。我一直在尝试遵循概述的方法here。

但是我得到的答案是不正确的,我的代码在下面有人知道我哪里出错了吗?在################################################

#### Intersection of two great circles.

# Points on great circle 1.

glat1 = 54.8639587

glon1 = -8.177818

glat2 = 52.65297082

glon2 = -10.78064876

# Points on great circle 2.

cglat1 = 51.5641564

cglon1 = -9.2754284

cglat2 = 53.35422063

cglon2 = -12.5767799

# 1. Put in polar coords.

x1 = cos(glat1) * sin(glon1)

y1 = cos(glat1) * cos(glon1)

z1 = sin(glat1)

x2 = cos(glat2) * sin(glon2)

y2 = cos(glat2) * cos(glon2)

z2 = sin(glat2)

cx1 = cos(cglat1) * sin(cglon1)

cy1 = cos(cglat1) * cos(cglon1)

cz1 = sin(cglat1)

cx2 = cos(cglat2) * sin(cglon2)

cy2 = cos(cglat2) * cos(cglon2)

cz2 = sin(cglat2)

# 2. Get normal to planes containing great circles.

# It's the cross product of vector to each point from the origin.

N1 = cross([x1, y1, z1], [x2, y2, z2])

N2 = cross([cx1, cy1, cz1], [cx2, cy2, cz2])

# 3. Find line of intersection between two planes.

# It is normal to the poles of each plane.

L = cross(N1, N2)

# 4. Find intersection points.

X1 = L / abs(L)

X2 = -X1

ilat = asin(X1[2]) * 180./np.pi

ilon = atan2(X1[1], X1[0]) * 180./np.pi

我还应该提到这是在地球表面(假设是一个球体)。在

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值