Finding the coordinates of a parallel line given line coordinates and a distance

2k Views Asked by At

I have a path defined by a list of (x, y) coordinates and I want to create two additional paths, one offset by a distance of 0.25, the other by -0.25.

I think that could be done by finding parallel lines for each coordinate pair in the path. I don't know where to start, however.

Thank you for any help.

2

There are 2 best solutions below

0
On

The equation of a straight line is y = mx + c. You can work out m and c for the first line because you have pairs of x's and y's. The two parallel lines will have the same m's and different c's which you must find. The two new c's will differ from the originally c by the same value but in different directions - one up and one down.

This is easier to see with a diagram: 1. Draw two parallel equally spaced lines with positive slopes. 2. Draw a right angle triangle between the two lines with the hypoteneuse along the upper one and horizontal (b) and vertical (a) lines for the other two sides joining on the lower line. 3. Divide that triangle into two right angle triangles (the dividing line will be 0.25 long).

Now m = a/b which equals the tangent of the lower left angle q. Therefore q = tan^-1 m, but this is also the lower angle in the triangle with a vertical side. So cos(tan^-1 m) = 0.25/a, which can easily be rearranged for a. So just add it to c for one of the lines and subtract it for the other.

0
On

I assume that the definition of the distance is by using perpendicular lines to the original path.

If you have the equation of the path as a polynomial = 0, than it will divide the plane into two parts where the points on one side when inserted in the equation will result a positive value, and on the other side negative values.

In the case of lines it is well defined and I assume you know how to find distance between two lines.