📏 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)中使用
- 计算结果仅供参考,请以实际应用场景为准