點到直線的距離
Author: 藍邦偉  老師
Date: 15 1 月 2013

移動A,B兩點決定直線L:ax+by+c=0，計算點P(x_0,y_0)到直線L的距離

$B$

$A$

P(x_0,y_0)

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

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

=\frac{|(ax+by)-ax_0-by_0|}{\sqrt{a²+b²}}

=\frac{|(x-x_0,y-y_0)·(a,b)|}{\sqrt{a²+b²}}

=\frac{|\overrightarrow{u}·\overrightarrow{n}|}{|\overrightarrow{n}|}

d(P,L)=\overline{PH}=|\overrightarrow{u}|·|cosθ|

Reset

Start

$ =\frac{|a(x-x_0)+b(y-y_0)|}{\sqrt{a²+b²}} $

P(x_0,y_0)

$ 點到直線的距離公式 $

$H$

B = (9.707441091490265, 2.9207532118027566)
A = (14.919322949717584, 0.14108288741485475)
L_1 = Line(A, B)
D = Point(L_1)
C = Point(L_1)
K_1: (x(Corner[1]), 0)
K_2: (x(Corner[2]), 0)
P = (13.04304548075575, 5.040251834148531)
b = OrthogonalLine(P, L_1)
H_1 = Intersect(L_1, b)
c = Segment(P, H_1)
n_1: 5 / c * Vector[P, H_1]
s = 7 (slider from 0 to 7, step 1)
T_1 = Corner(1)
T_4 = Corner(4)
T_2: (6.9 * Corner[1] + 3.1 * Corner[2]) / 10
T_3: (6.9 * Corner[4] + 3.1 * Corner[3]) / 10
多邊形1, t_1, t_2, t_3, t_4 = Polygon(T_1, T_2, T_3, T_4)
f = Circle(H_1, 0.6)
F = Intersect(f, c)
G, I = Intersect(f, L_1)
J: F + I - H_1
t1 = 1 (slider from 0 to 1, step 0.01)
t2 = 0 (slider from 0 to 1, step 0.01)
t3 = 1 (slider from 0 to 1, step 0.01)
A_1: A + 3 * t1 * Vector[A, B]
B_1: B - 3 * t1 * Vector[A, B]
u_1 = Vector(A, A_1)
u_2 = Vector(B, B_1)
L_2 = OrthogonalLine(P, u_1)
H = Intersect(L_1, L_2)
P_2: P + 5 * t2 * Vector[P, H]
H_2: H - 5 * t2 * Vector[P, H]
v_1 = Vector(P, P_2)
v_2 = Vector(H, H_2)
a: s - 1