平面上點到直線的距離(另證，非使用向量)
Author: 藍邦偉　老師
Date: 14 1 月 2013

$H$

$A$

$B$

P(x_0,y_0)

過P作水平線L_1:y=y_0\;與鉛直線\;x=x_0

點到直線距離公式的另證

L:ax+by+c=0與L_1,L_2\;分別交於A,B\;兩點

$⇒ax=-by_0-c⇒x=\frac{-by_0-c}{a}⇒A(\frac{-by_0-c}{a},y_0) $

$ ⇒by=-ax_0-c⇒y=\frac{-ax_0-x}{b}⇒B(x_0,\frac{-ax_0-c}{b}) $

$ ⇒\overline{PA}=\left\vert x_0-\frac{-by_0-c}{a} \right\vert=\left\vert  \frac{ax_0+by_0+c}{a}\right\vert   $

⇒\overline{PB}=\left\vert y_0-\frac{-ax_0-c}{b}  \right\vert=\left\vert \frac{ax_0+by_0+c}{b} \right\vert  

⇒\overline{AB}²=\left( x_0+\frac{by_0+c}{a}  \right)²+\left( \frac{-ax_0-c}{b}-y_0  \right)²  

$ =\left( \frac{ax_0+by_0+c}{a}  \right)² +\left(\frac{ax_0+by_0+c}{b}   \right)²  $

⇒\overline{AB}=\left\vert ax_0+by_0+c  \right\vert·\sqrt{\frac{1}{a²}+\frac{1}{b²}} 

$ =\frac{\left\vert  ax_0+by_0+c\right\vert }{\left\vert ab \right\vert } \sqrt{a²+b²}$

$ d(P,L)=\overline{PH}=\frac{\overline{PA}×\overline{PB}}{\overline{AB}} $

$ =\frac{\left\vert \frac{ax_0+by_0+c}{a} \right\vert ×\left\vert \frac{ax_0+by_o+c}{b} \right\vert  }{\frac{\left\vert ax_0+by_0+c \right\vert }{|ab|}\sqrt{a²+b²}} $

$ =\frac{|ax_0+by_0+c|}{\sqrt{a²+b²}} $

$Step=%v$

L:ax+by+c=0,ab≠0

1

2

$Step=%v$

$ 過P\;作水平線L_1:y=y_0交L\;於A\;點 $

故L\;的斜率為\;m=tanθ=-\frac{a}{b}

$ 設直線L的斜角為\;θ $

$ ∵0°<θ<180° $

∴sin∠PAH=\frac{|a|}{\sqrt{a²+b²}}

d(P,L)=\overline{PH}=\overline{PA}sin∠PAH

$ ⇒\overline{PA}=\left\vert x_0-\frac{-by_0-c}{a} \right\vert=\left\vert  \frac{ax_0+by_0+c}{a}\right\vert   $

$⇒ax=-by_0-c⇒x=\frac{-by_0-c}{a}⇒A(\frac{-by_0-c}{a},y_0) $

$ =\left\vert  \frac{ax_0+by_0+c}{a}\right\vert ×\frac{|a|}{\sqrt{a+b²}} $

$ =\frac{|ax_0+by_0+c|}{\sqrt{a²+b²}} $

θ

P_1 = (-2.7005873170731585, 6.884755804878036)
P_2 = (3.1758101463414725, -1.3767676878048771)
a = Line(P_1, P_2)
P = (3.6597487609756185, 5.363805873170722)
b = OrthogonalLine(P, a)
H = Intersect(b, a)
c: y = y(P)
d: x = x(P)
A = Intersect(a, c)
B = Intersect(a, d)
e = Segment(P, H)
n = 0 (slider from 0 to 14, step 1)
f = Segment(A, P)
g = Segment(P, B)
h = Segment(B, A)
L_a = Line(P_1, P_2)
i = false
j = false
k = 0 (slider from 0 to 11, step 1)
l = Segment(A, P)
H' = Mirror(H, A)
α = Angle(P, A, H')