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。