指向大圆段的距离

4

我希望能够计算从一个由经度和纬度给出的点到由两个点给出的线段(大圆的一部分)的距离。所有坐标都是以WGS84表示的。

enter image description here

我知道如何在笛卡尔坐标系中计算,但不知道如何在球面上计算。请问有人可以提供这个公式吗?


1
我认为你在mathematics.stackexchange上可能会更有好运。 - Timothy Groote
我投票关闭此问题,因为它与编程或软件开发无关,而是与[math.se]有关。 - Pang
距离d应该是穿过球体的直线,还是大圆弧线段? - hypehuman
@hypehuman:它也应该是一个大圆段。 - user2033412
2个回答

3
  1. spherical to 2D Cartesian

    if the distance is not too far and not around pole singularities you can convert both line segment and line emitting from your point and perpendicular to your segment to spherical coordinates (if they are not already) and use the 2 angles as Cartesian space (ignoring radius).

    1. compute intersection point

    2. convert back to spherical

    3. compute arclength between point and intersection

      hard to say if you're using sphere or WGS84 or what ....

  2. Cartesian 3D

    lets have arc segment AB, sphere of radius R and center C (ideally (0,0,0)) and point P then I see it like this:

    3D cartesian

    1. find intersection point P' between plane ABC and its normal going through point P in 3D Cartesian

    2. project it back on sphere surface

      For spherical surface is this easy as the projection means just to change the vector P'C length to R (if the sphere is centered around (0,0,0)).

      P'' = (R*(P'-C)/|P'-C|) + C
      
    3. compute arclength between the 2 points |P-P''|

      Also simple for spherical surface just compute the angle between vectors P-C and P''-C

      ang = acos(dot(P-C,P''-C)/(R*R)); // [radians]
      

      and convert to arclength

      d = ang*R; // [same Units as R]
      

我正在使用WGS84。 - user2033412
@user2033412,这个问题要复杂得多...投影是通过迭代来增加精度的...你只需要搜索 lat 直到它适合 x,y,z,你从球形投影开始,然后改变 lat 来最小化距离... - Spektre
@user2033412 请查看如何将球面速度坐标转换为笛卡尔坐标以及链接的答案,获取更多想法... - Spektre
@hypehuman +1 嗯,你说得对。我在第一步出现了一个错误...交点必须在法线和平面之间而不是直线上...我修复了答案并更新了图片。在你的情况下,点P,P',P''是相同的(所以距离为零),因为 P 已经位于弧 AB 上。 P' 不需要位于 AB 线上...那就是那个错误。 - Spektre

2
这是横向距离,这里有详细描述。
dxt = asin( sin(δ13) ⋅ sin(θ13−θ12) ) ⋅ R
    where
 δ13 is (angular) distance from start point to third point
     θ13 is (initial) bearing from start point to third point
     θ12 is (initial) bearing from start point to end point
     R is the earth’s radius

您可以使用给定页面上的公式计算所需的距离和方位角。

distance
a = sin²(Δφ/2) + cos φ1 ⋅ cos φ2 ⋅ sin²(Δλ/2)
c = 2 ⋅ atan2( √a, √(1−a) )
d = R ⋅ c
where   
 φ is latitude, λ is longitude, R is earth’s radius (mean radius = 6,371km);

bearing
θ = atan2( sin Δλ ⋅ cos φ2 , cos φ1 ⋅ sin φ2 − sin φ1 ⋅ cos φ2 ⋅ cos Δλ )
    where
φ11 is the start point, φ22 the end point (Δλ is the difference in longitude)

请注意,将角度传递给三角函数时需要使用弧度制。


非常抱歉,我会删除我的评论。 - Blindman67
5
为什么这被接受了?这是指一个点到大圆的距离,而不是 OP 所请求的大圆段。 - boycy

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接