d = √((x₂−x₁)² + (y₂−y₁)²)
Compute the distance between two points in the plane from their coordinates.
📐 计算公式
平面两点距离(二维欧氏距离):d=Math.hypot(x₂−x₁, y₂−y₁);联动量:Δx=x₂−x₁、Δy=y₂−y₁。校验:四个坐标必填且为有限数值,空值、非数字或无穷直接报错并清空辅助表。判据:无固定分级;用 Math.hypot 做缩放稳定计算,避免坐标极大时平方中间值溢出 Infinity,结果保留四位小数。
计算二维平面上两点的距离。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Euclidean distance | d = sqrt( (x2 - x1)^2 + (y2 - y1)^2 ) | Euclid, Elements, Book I, Proposition 47 |
| Manhattan distance (contrast) | d1 = |x2 - x1| + |y2 - y1|, suited to grid-like paths | Krause EF, Taxicab Geometry: An Adventure in Non-Euclidean Geometry (1986) |
| Midpoint | M = ( (x1 + x2)/2, (y1 + y2)/2 ) | Euclid, Elements |
| Higher dimensions | In n dimensions, d = sqrt( sum (a_i - b_i)^2 ) | ISO 80000-2:2019, Quantities and units - Part 2: Mathematics |
📌 计算说明
- (0,0)→(3,4) 距离 5。
- 勾股数 3-4-5。