兩平行直線的距離
Author: 藍邦偉  老師

觀念:在L_2上任取一點P(x_0,y_0)，求P到直線L_1的距離

兩平行直線的距離

L_1

P(x_0,y_0)

L_2

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

P(x_0,y_0)∈L_2

L_1:ax+by+c_1=0

L_2:ax+by+c_2=0

∵d(L_1,L_2)=d(P,L_2)

⇒ax_0+by_0+c_2=0

∴d(L_1,L_2)=\frac{|-c_1+c_2|}{\sqrt{a²+b²}}

=\frac{|c_1-c_2|}{\sqrt{a²+b²}}

Reset

Start

K_1: (x(Corner[1]), 0)
K_2: (x(Corner[2]), 0)
A = (4.808272144756602, -2.603841557918195)
B = (19.5752707430673, 4.970760076038822)
a = Line(A, B)
P = (11, 6)
b = OrthogonalLine(P, a)
H = Intersect(a, b)
L = Line(A, B)
d = 0 (slider from 0 to 6, step 1)
c = Line(P, a)
e = OrthogonalLine(P, a)
f = Segment(P, H)
T_1 = Corner(1)
T_4 = Corner(4)
T_2: (7 * Corner[1] + 3 * Corner[2]) / 10
T_3: (7 * Corner[4] + 3 * Corner[3]) / 10
多邊形1, t_1, t_2, t_3, t_4 = Polygon(T_1, T_2, T_3, T_4)
g = Segment(T_2, T_3)
t = 0 (slider from 0 to 1, step 0.01)
E: A + t * Vector[A, B]
h = Segment(P, E)