Let the equation of line L be Ax+By+C=0, and the coordinate of point P be (x0, y0), then the distance from point P to line L is:
Similarly, when the analytical formula of P(x0, y0) and straight line L is y=kx+b, the distance from point P to straight line L is:
Consider the point (x0, y0, z0) and the spatial straight line x-x1/l = y-Y 1- 0//m = z-z1/n, where d = | (X 1-x0, y/kloc). +m? +n? )。
Proof method:
Definition forensics: According to the definition, point P(x? ,y? ) Distance to straight line L: ax+by+c = 0 is the vertical length from point P to straight line L. Let the vertical line from point P to straight line L be L' and the vertical foot be Q, then the slope of L' is B/A, and the analytical formula of L' is y-y? =(B/A)(x-x? The coordinates of the intersection q of l and l' are ((B^2x? Abby? -AC)/(A^2+B^2),(A^2y? -ABx? -BC)/(A 2+B 2)) From the distance formula between two points:
PQ^2=[(B^2x? Abby? -AC)/(A^2+B^2)-x0]^2
+[(A^2y? -ABx? -BC)/(A^2+B^2)-y0]^2
=[(-A^2x? Abby? -AC)/(A^2+B^2)]^2
+[(-ABx? -B^2y? -BC)/(A^2+B^2)]^2
=[A(-By? -C-Ax? )/(A^2+B^2)]^2
+[B(-Ax? -C-By? )/(A^2+B^2)]^2
=A^2(Ax? +By? +C)^2/(A^2+B^2)^2
+B^2(Ax? +By? +C)^2/(A^2+B^2)^2
=(A^2+B^2)(Ax? +By? +C)^2/(A^2+B^2)^2
=(Ax? +By? +C)^2/(A^2+B^2)
So pq = | ax+by+c |/√ (a 2+b 2), and the formula is proved.