k = (y₂ − y₁) / (x₂ − x₁)
Compute a line slope, inclination angle and intercept from two points.
📐 計算公式
兩點連線斜率與傾角(本頁程式碼口徑):斜率 k=(y₂−y₁)÷(x₂−x₁);標準傾角 θ=arctan(k)×180÷π,負值加 180°,落在 0°–180°。校驗:四個座標必須填寫且為有限數值,非數字或無窮不按 0 兜底;只有 x₂ 與 x₁ 嚴格相等才分豎直線/重合點,不用 |dx| 閾值判豎直。判據:無固定分級;k>0 上行、k<0 下行、k=0 水平(0°),豎直線傾角 90°,兩點重合則斜率與傾角不唯一。
由兩點座標求直線斜率。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Slope | k = (y2 - y1)/(x2 - x1), provided x1 ≠ x2 | ISO 80000-2:2019, Quantities and units - Part 2: Mathematics |
| Relation to the inclination angle | k = tan(theta), where theta is the inclination from the positive x-axis | ISO 80000-2:2019, Quantities and units - Part 2: Mathematics |
| Parallel and perpendicular | Parallel lines have k1 = k2; perpendicular lines have k1 · k2 = -1 | Descartes R., La Geometrie (1637) |
| Point-slope form | y - y1 = k · (x - x1) | ISO 80000-2:2019, Quantities and units - Part 2: Mathematics |
📌 計算說明
- (1,2)→(4,8) 斜率 2。
- 分母為零為豎直線。