2017-08-09 97 views
0

我想計算從經緯度給定的點到由兩點(大圓圈的一部分)給出的線段的距離。所有的座標都在WGS84中給出。指向大圓段距離

enter image description here

我知道如何在笛卡爾座標而不是球體上的計算此。有人可以提供這個公式嗎?

+1

我想你可能有更多的運氣與此有關mathematics.stackexchange –

+0

我投票關閉這一問題作爲題外話,因爲它是關於[math.se]而不是編程或軟件開發。 – Pang

回答

3

這是交叉軌道距離described here

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 
φ1,λ1 is the start point, φ2,λ2 the end point (Δλ is the difference in longitude) 

注意,角度需要採用弧度傳遞到三角函數

+0

因此對不起,我將刪除我的評論。 – Blindman67

2
  1. 球形至2D笛卡爾

    如果距離不是太遠,周圍沒有極奇點你既可以線段和線路從你的觀點,並垂直於你的段球面座標的發光轉換(如果它們還沒有)並且使用2個角度作爲笛卡爾空間(忽略半徑)。

    1. 計算交點
    2. 轉換回點和交叉點之間的球面
    3. 計算弧長

      很難說,如果你使用的球或WGS84還是什麼....

  2. 笛卡爾3D

    您可以將圓弧段作爲3D線處理,並在發現相交時將其投影到曲面上。事情是這樣的:在3D笛卡爾

  3. 項目回地表

    對於球面

    3D cartesian + projection

    1. 行查找與正常的交點就是這個簡單的投影意味着將矢量長度更改爲R(如果球體以(0,0,0)爲中心)。 2分

      爲球形表面也是簡單之間

    2. 計算弧長只是計算相交點和之間的角度...

      ang = acos(dot(intersection,point)); // [radians] 
      

      ,並轉換爲弧長

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

我正在使用WGS84。 – user2033412

+0

@ user2033412更復雜一點......投影迭代完成以提高精度...您只需搜索'lat'直到它適合'x,y,z'開始球面投影,然後更改'lat '以最小化距離... – Spektre

+0

@ user2033412請參閱[如何將球面速度座標轉換爲笛卡爾](https://stackoverflow.com/a/41161714/2521214)以及鏈接的答案,以獲得一些其他想法... – Spektre