Рет қаралды 183
This video will teach you a simple formula that you can use to find the distance between a point and a line. It's quick and easy, and it works every time!
Case 1: The line is in slope-intercept form.
p = (x0, y0)
y = mx + b
d = |-m*x0 + y0 - b| / sqrt(m^2 + 1)
Case 2: The line is in general form.
p = (x0, y0)
Ax + By + C = 0
d = |A*x0 + B*y0 + C| / sqrt(A^2 + B^2)
Case 3: The line is defined by two points.
p = (x0, y0)
p1 = (x1, y1), p2 = (x2, y2)
d = |(x2-x1)*(y1-y0) - (x1-x0)*(y2-y1)| / sqrt((x2-x1)^2 + (y2-y1)^2)