专业距离计算器

使用半正弦公式计算 2D、3D、曼哈顿距离、Minkowski 距离和地理距离中点之间的距离。

对于学习和作业帮助 - 独立验证关键计算。

审阅者 CalculatorDrive Math 编辑委员会 · 最后更新

计算器

输入两点的坐标以计算它们之间的距离。

简短的回答

The right distance formula depends on how you're allowed to travel between two points. Straight-line ("as the crow flies") distance uses the Euclidean formula, d = √[(x₂−x₁)² + (y₂−y₁)²]. Grid-based movement, like city blocks, uses Manhattan distance instead: d = |x₂−x₁| + |y₂−y₁|. For places on Earth, geographic distance accounts for the planet's curvature using the Haversine formula.

要点

  • 欧氏距离始终是两点之间可能的最短路径;曼哈顿距离总是等于或更长,因为它不能对角切割。
  • 仅当两点共享 x 或 y 坐标(沿单个轴移动)时,欧几里得距离和曼哈顿距离才相等。
  • 闵可夫斯基距离是一种概括:p = 1 给出曼哈顿距离,p = 2 给出欧几里德距离,p = ∞ 给出切比雪夫距离(最大单轴差)。
  • 坐标之间的地理距离需要半正弦公式,而不是平面距离公式,因为地球表面是弯曲的。

选择正确的距离公式

设想 公式 为什么
平面上的直线距离欧几里得最短路径
沿城市街区/网格的距离曼哈顿无法对角切割方块
两个地球坐标之间的距离地理(半正矢)考虑行星的曲率
一般可调距离度量明科夫斯基涵盖欧几里得、曼哈顿和切比雪夫的系列

工作示例:三个距离,一对点

Take the points (0, 0) and (3, 4). Depending on the metric, "the distance" between them isn't a single number:

公制 计算 结果
欧几里得 (p=2)√(3² + 4²) = √255
曼哈顿 (p=1)|3| + |4|7
切比雪夫 (p=∞)max(3, 4)4

All three answers are correct — for their own definition of "distance." Euclidean gives the shortest path (a straight line), Manhattan gives the longest (grid-only movement), and Chebyshev gives the shortest of all, since it only counts the larger of the two axis differences.

闵可夫斯基距离家庭

d = (Σ|x − y|v)^(1/p)

Minkowski distance is a single formula with a tunable parameter p. Setting p = 1 reduces it to Manhattan distance, p = 2 reduces it to Euclidean distance, and as p approaches infinity, it converges to Chebyshev distance — the largest single-axis gap between the two points. This makes Minkowski distance a useful way to sweep between "grid movement" and "straight-line movement" behavior for the same pair of points.

要避免的常见错误

  • 使用欧几里得距离来估计城市网格中的实际行驶距离 - 它低估了实际的步行或驾驶距离,而曼哈顿距离的模型更真实。
  • 将平面距离公式直接应用于纬度/经度坐标 - 根据纬度,经度覆盖的现实世界距离非常不同,因此需要使用半正弦公式。
  • 使用小于 1 的 Minkowski 参数 p 并期望正常距离行为(低于 p = 1),该公式不再满足三角不等式并且不再表现得像真正的距离度量。
  • 担心负坐标会产生负距离 - 平方(欧几里得)和绝对值(曼哈顿)都删除符号,因此距离永远不会是负数,点顺序也无关紧要。

常见问题解答

如何找到两点之间的距离?

在平面中,使用从毕达哥拉斯定理导出的距离公式:d = √[(x2 − x₁)2 + (y2 − y1)2]。

点的顺序重要吗?

不会。无论从 A 点到 B 点还是从 B 点到 A 点,距离都是相同的,因为平方消除了符号差异。

二维距离与毕达哥拉斯定理有何关系?

水平和垂直的间隔形成直角三角形的边;距离是斜边。

这可以在三个维度上发挥作用吗?

是的。对于空间中的点,扩展公式: d = √[(x2 − x1)2 + (y2 − y1)2 + (z2 − z1)2]。

如何使用这个距离计算器?

输入 2D 或 3D 中两点的坐标,然后单击计算以查看直线距离和使用的步长。

欧几里得距离和曼哈顿距离有什么区别?

欧氏距离衡量两点之间的直线路径;曼哈顿距离测量沿着网格的路径,就像城市街区一样,不能对角切割。对于点 (0,0) 和 (3,4),欧几里德距离为 5,但曼哈顿距离为 7 — 始终等于或长于直线路径。

More math calculators