我正在尝试找到一种算法或一种方法来找到球体上两个圆之间的交点(在3d中)。例如,如果我有两个圆心位于两个点A(latitude1,longitude1) and B(latidude2,longitude2)
,假设它们相交,我怎样才能找到这两个圆之间的交点?有算法吗?
谢谢
答案 0 :(得分:2)
Convert from latitude/longitude to 3D Cartesian coordinates.
对于每个圆圈,找到方程nx x + ny y + nz z = d
与球体相交的平面是圆。假设
球体以原点为中心,即法线向量
(nx, ny, nz)
是圆心(cx, cy, cz)
(投影或
没有)正常化后。
(cx, cy, cz)
(nx, ny, nz) = -----------------
||(cx, cy, cz)||
2
使用毕达哥拉斯计算距离d
。设r
为半径
圆圈的R
是球体的半径。
2 2 2
R = d + r
_______ _______________
| 2 2 |
d = \|R - r = \|(R + r) (R - r)
第二个表达式是数值稳定性的首选。
如果我们只知道球体表面上的长度r'
将圆的投影中心放到圆上,然后计算
d = R cos(r'/R)
r = R sin(r'/R).
在这种情况下,我们实际上不需要r
。
Find the intersection of the line and the sphere, between zero and two points.