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.
praveenuniAsked:
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.

Harisha M GEngineerCommented:
   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) )

praveenuniAuthor Commented:
what is arctan?
Harisha M GEngineerCommented:
arctan is nothing but TAN inverse
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

ozoCommented:
(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)²))
Harisha M GEngineerCommented:
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) )
ozoCommented:
if BD=sqrt((x2-x1)²+(y2-y1)²)
then it's just
(x1±(y2-y1),y1±(x1-x2))
(x2±(y2-y1),y2±(x1-x2))
Harisha M GEngineerCommented:
ozo, I don't know why you are addin x to y and y to x ??
ozoCommented:
To make a right angle.
GwynforWebCommented:
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

GwynforWebCommented:
for clarity:-  I mean
 
      Y=  ((y1-y2)/(x1-x2))*( X -x1') + y1'
Harisha M GEngineerCommented:
See here for the explanation:
http://geocities.com/mgh_mgharish/praveenuni.PNG
ozoCommented:
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
Harisha M GEngineerCommented:
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 ?
Harisha M GEngineerCommented:
Are you talking about ± instead of + in the formula ?? I thought, that is understood
ozoCommented:
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) )
Harisha M GEngineerCommented:
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 ?
Kermit_RoseCommented:
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



praveenuniAuthor 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
ozoCommented:
(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
Harisha M GEngineerCommented:
>> 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.

Start your 7-day free trial
praveenuniAuthor 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.