📏 Distance Calculator
Plane-coordinate forward and inverse: find the horizontal distance and azimuth from two points, or the other point from one point, distance and azimuth.
📐 計算公式
座標正反算(本頁程式碼口徑,雙模式):反算(兩點→距離方位)S=√(Δx²+Δy²)、方位角 α=atan2(Δx,Δy)×180÷π,負值加 360 歸 0–360°;正算(一點+距離方位→另一點)x₂=x₁+S×sin(α)、y₂=y₁+S×cos(α)(α 先化弧度代入)。校驗:當前模式對應輸入任一非數值即清空結果(無錯誤提示)。判據:無固定分級,方位名按 16 方位表取 round(α÷22.5)%16(正北、北偏東……北偏西)。
平面座標正算與反算:由兩點座標求距離與方位角,或由一點、距離、方位角求另一點
座標軸約定:x 軸向東、y 軸向北;方位角從正北順時針計,0—360°。反算公式:S=√(Δx²+Δy²),α=atan2(Δx,Δy);正算:x₂=x₁+S·sinα,y₂=y₁+S·cosα。兩點重合(S=0)時方位角未定義,不輸出確定方向;正算距離 S 須 ≥ 0,距離為 0 時終點即起點、方向未定義。
📚 深度解析:距離計算(平面正反算)
💡 常見使用場景
- 平面兩點反算距離與方位角。
- 由已知點、平距與方位角正算另一點。
- 控制網與放樣座標推算。
反算
A(0,0)、B(30,40) → Δx=30、Δy=40,平距 S=√(30²+40²)=50.000 m,方位角 α=atan2(Δx,Δy)=36.870°。
正算互檢
起點 (0,0)、平距 50.000 m、方位角 36.870° → 終點 x=50·sin36.870°=30.000,y=50·cos36.870°=40.000,與反算結果一致。
❓ 常見問題(FAQ)
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Inverse computation | D = sqrt( (x2 - x1)^2 + (y2 - y1)^2 ); alpha = atan2(Δx, Δy) | GB 50026-2020, Code for engineering surveying |
| Forward computation | x2 = x1 + D · sin(alpha); y2 = y1 + D · cos(alpha) | GB 50026-2020, Code for engineering surveying |
| Mutual check | A forward computation followed by an inverse one must reproduce the input | GB 50026-2020, Code for engineering surveying |
| Units and rounding | Round distances to mm or cm and angles to seconds, as the project precision requires | GB 50026-2020, Code for engineering surveying |
⚠️ 使用說明與注意事項
- 本工具純前端執行,資料不會上傳到伺服器
- 建議在主流瀏覽器(Chrome/Safari/Firefox/Edge)中使用
- 計算結果僅供參考,請以實際應用場景為準