# Maths: Find points of a Parallel Line

I have a line with a slope of M. The start and end points of the line are (x1,y1) (x2,y2) .
How can I find the start and end points of a parallel line, to this line, which is at distance of BD.
Asked:
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

EngineerCommented:
Let the distance of first line be d = sqrt( (x2-x1)² + (y2-y1)² )

x1' = x1 + d * sin( arctan(M) )
x2' = x2 + d * sin( arctan(M) )
y1' = y1 + d * cos( arctan(M) )
y2' = y2 + d * cos( arctan(M) )

Author Commented:
what is arctan?
EngineerCommented:
arctan is nothing but TAN inverse
Commented:
(x1±(y2-y1)*BD/sqrt((x2-x1)²+(y2-y1)²),y1±(x1-x2)*BD/sqrt((x2-x1)²+(y2-y1)²))
(x2±(y2-y1)*BD/sqrt((x2-x1)²+(y2-y1)²),y2±(x1-x2)*BD/sqrt((x2-x1)²+(y2-y1)²))
EngineerCommented:
Sorry.. d = BD,

x1' = x1 + BD * sin( arctan(M) )
x2' = x2 + BD * sin( arctan(M) )
y1' = y1 + BD * cos( arctan(M) )
y2' = y2 + BD * cos( arctan(M) )
Commented:
if BD=sqrt((x2-x1)²+(y2-y1)²)
then it's just
(x1±(y2-y1),y1±(x1-x2))
(x2±(y2-y1),y2±(x1-x2))
EngineerCommented:
ozo, I don't know why you are addin x to y and y to x ??
Commented:
The there are 2  possible  lines

Line 1 passes through (x1',y1')  &  (x2',y2') where
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
(x1',y1') = (x1,y1) + BD* (y1-y2, x2-x1)/sqrt((x2-x1)²+(y2-y1)²)

(x2',y2') = (x2,y2) + BD* (y1-y2, x2-x1)/sqrt((x2-x1)²+(y2-y1)²)

ie
Y =  (y1-y2)/(x1-x2)( X -x1') + y1'

where (x1',y1') is defined as above

Line 2 passes through (x1',y1')  &  (x2',y2') where
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
(x1',y1') = (x1,y1) - BD* (y1-y2, x2-x1)/sqrt((x2-x1)²+(y2-y1)²)

(x2',y2') = (x2,y2) - BD* (y1-y2, x2-x1)/sqrt((x2-x1)²+(y2-y1)²)

ie
Y=  (y1-y2)/(x1-x2)( X -x1') + y1'

where (x1',y1') is defined as above

Commented:
for clarity:-  I mean

Y=  ((y1-y2)/(x1-x2))*( X -x1') + y1'
EngineerCommented:
See here for the explanation:
http://geocities.com/mgh_mgharish/praveenuni.PNG
Commented:
Which differs from your http:#14351942
If
x1' = x1 + BD * sin( arctan(M) )
then y2'
y1' = y1 - BD * cos( arctan(M) )
and if
x1' = x1 - BD * sin( arctan(M) )
then y2'
y1' = y1 + BD * cos( arctan(M) )
as GwynforWeb and I stated
EngineerCommented:
A = arctan M

because M is the slope => tan A

Where is the difference ?
Am I missing something ?

By the way, ozo & Gwyn, where are you from ?
EngineerCommented:
Are you talking about ± instead of + in the formula ?? I thought, that is understood
Commented:
No, I'm talking about using
x1' = x1 + BD * sin( arctan(M) )
y1' = y1 - BD * cos( arctan(M) )
instead of
x1' = x1 + BD * sin( arctan(M) )
y1' = y1 + BD * cos( arctan(M) )
EngineerCommented:
Good point ozo.. that's right !!

That should be
x1' = x1 +/- BD * sin( arctan(M) )
x2' = x2 +/- BD * sin( arctan(M) )
y1' = y1 -/+ BD * cos( arctan(M) )
y2' = y2 -/+ BD * cos( arctan(M) )
Right ?

You didn't tell... where are you from ?
Commented:
Question from Author:

I have a line with a slope of M. The start and end points of the line are (x1,y1) (x2,y2) .
How can I find the start and end points of a parallel line, to this line, which is at distance of BD.

You know that the slope is M.  Since you also know the two end points, (x1,y1) and the (x2,y2)
you could have calculated

M = (y2-y1)/(x2-x1)

Now you ask for the end points of a parallel line segment a distance BDd away.

However, you don't say which side of the parallel line you want to find the points on.

Lets replace the name BD by the name q.

If q is positive,  we will locate the parallel line segment end points above the given line segment.

if q is negative we will the parallel line segment end points below the givenline segment.

The given parallel line has slope M.

If M is positive, the the line rizes as we scan it from left to right.

If M is negative, the the line drops as we scan it from left to right.

We can find the end points of the line segment parallel to the given line segment by constructing lines perpendicular to the given line segment at the endpoints

So I construct a perpendicular line at (x1,y1) and travel along it a distance q.

And I construct a peerpendicular line at (x2,y2) and travel along it a distance q

The slope of the perpendicular line is -1/M

The equation of the perpendicular line going through (x1,y1) is

(y-y1) = -(x-x1)/M

The distance from (x1,y1) to a general point (x,y) on this perpendicular line is

sqrt((x-x1)^2 + (y-y1)^2 )

= sqrt(  (x-x1)^2 + (x-x1)^/M^2  )

= (x-x1) sqrt(1+1/M^2)

The distance between the parallel lines is q.

q = (x-x1) sqrt(1 + 1/M^2)

(x-x1) = q/sqrt(1+1/M^2)

x = x1 + q/(1 + 1/M^2)

y = y1 - (x-x1)/M

Sso your new points are,

for (x1,y1),

(x1 + q/sqrt(1+1/M^2)  ,   y1 - q M / sqrt(1 + 1/M^2)   )

and for

(x2,y2)

(x2 + q/sqrt(1+1/M^2)   , y2  - qM / sqrt(1 + M^2)   )

The minus sign appears in the calculation for the y coordinate because the slope of the perpendicular

is - 1/M

Author Commented:
Thank you all for giving me such a wonderful solutions. Right now, I'm using this to calculate the parallel line points:
x1' = x1 +/- BD * sin( arctan(M) )
x2' = x2 +/- BD * sin( arctan(M) )
y1' = y1 -/+ BD * cos( arctan(M) )
y2' = y2 -/+ BD * cos( arctan(M) )
This will give me the points of one parallel line. As you know any line can have 2 parallel lines at a particular distance. How can I find the other parallel line points?

Thanks
Commented:
(x1+(y2-y1)*BD/sqrt((x2-x1)²+(y2-y1)²),y1+(x1-x2)*BD/sqrt((x2-x1)²+(y2-y1)²))
(x2+(y2-y1)*BD/sqrt((x2-x1)²+(y2-y1)²),y2+(x1-x2)*BD/sqrt((x2-x1)²+(y2-y1)²))
are points on one line
(x1-(y2-y1)*BD/sqrt((x2-x1)²+(y2-y1)²),y1-(x1-x2)*BD/sqrt((x2-x1)²+(y2-y1)²))
(x2-(y2-y1)*BD/sqrt((x2-x1)²+(y2-y1)²),y2-(x1-x2)*BD/sqrt((x2-x1)²+(y2-y1)²))
Are points on the other
EngineerCommented:
>> As you know any line can have 2 parallel lines at a particular distance. How can I find the other parallel line points?

In the formula itself, if you replace +/- as once + and another time as - you will get both the lines :)

First line:
x1' = x1 + BD * sin( arctan(M) )
x2' = x2 + BD * sin( arctan(M) )
y1' = y1 - BD * cos( arctan(M) )
y2' = y2 - BD * cos( arctan(M) )

Second line:
x1' = x1 - BD * sin( arctan(M) )
x2' = x2 - BD * sin( arctan(M) )
y1' = y1 + BD * cos( arctan(M) )
y2' = y2 + BD * cos( arctan(M) )

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
All of u guys gave very good solutions for this. And all the solutions are working fine. So I'm splitting the points.

Thanks
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Math / Science

From novice to tech pro — start learning today.