Easy learning with example program codes

Straight Lines: Distance of a point from a line

The distance between point P= (x0, y0) and Line L: ax +by+c=0 is shown in the figure below.

For the general equation

L= ax + by +c =0

m = -a/b

The shortest distance between a point, P and a line is a perpendicular line segment. The slope of the perpendicular line formed from the point. (Negative reciprocal from the given line)

Now, to find the distance between point PP and line L,L, we can use a little geometry trick and have another line, parallel to L, that passes through P, let’s call it S. Likewise, we can have another line, this time parallel to T, that passes through the origin (0,0), let’s call it R.

since S passes through P and has the same slope as L, the equation of line S is:

The equation for line R is

Since line S intersects line R:

Making x as the subject in the equation

Therefore, the intersection point between S and R can be written as:

Consider the point where Line L and R intersect. This happens at the following line equations:

Therefore, the intersection point between line L and R can be written as:

For a line segment, the distance formula is as follows:

For a line segment between P1 and P2 :

Example 1: Find the distance of the point (3, -5) from the line 3x -4y -26 = 0

In the above equation, using the general form of line equation, A=3, B=-4 and C=-26

Substitute these values in the distance equation:

The distance is 3/5 units.

Distance between Two Parallel Lines

Two lines are considered parallel to each other when the distance between them at any point is the same. In other words, if the slopes of both lines are the same, they will be parallel to each other. Consider two parallel lines l1 and l2 in XY-plane with equal slope = m.

The equations of the parallel lines:

Y = mx + b1

Y = mx +b2

The distance between two parallel lines is deduced by the distance of a point from a line. The distance of this pointis equal to the length of the perpendicular distance from any point to each line. Let N be the point through which the perpendicular to L1 from point M (− c2/m, 0). From the previous derivation, we know that the distance between two lines is:

Compare y = mx + b1 and Ax + By + C = 0, in this case, A=m, B=1 and C = b1 .Also x1=-c2/m and y1=0

Therefore, substituting the values in equation for d:

Generalized equation :


Please follow and like us:
Posted in A2   

Copyright © 2020 CodesJava Protection Status