Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Parallel to line through point without slope calculation

Subject: Parallel to line through point without slope calculation

From: K

Date: 27 Mar, 2013 20:55:06

Message: 1 of 5

Hello,

I have two points (a,b) that make up a line, and a third point (c). I'd like to draw a line (length x) that is parallel to (a,b) but passes through c (at its midpoint).

Thank you for any direction,
KP

Subject: Parallel to line through point without slope calculation

From: Steven_Lord

Date: 27 Mar, 2013 21:23:27

Message: 2 of 5



"K " <palanski@ymail.com> wrote in message
news:kivmba$jnh$1@newscl01ah.mathworks.com...
> Hello,
>
> I have two points (a,b) that make up a line, and a third point (c). I'd
> like to draw a line (length x) that is parallel to (a,b) but passes
> through c (at its midpoint).

Determine the equation of the line. There's a formula for the equation of a
line given a point and the slope of the line.
Generate x coordinates for your region of interest.
Use the equation to generate the corresponding y coordinates.
Plot the generated coordinates.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: Parallel to line through point without slope calculation

From: K

Date: 27 Mar, 2013 21:27:06

Message: 3 of 5

"Steven_Lord" <slord@mathworks.com> wrote in message <kivo0f$ord$1@newscl01ah.mathworks.com>...
>
>
> "K " <palanski@ymail.com> wrote in message
> news:kivmba$jnh$1@newscl01ah.mathworks.com...
> > Hello,
> >
> > I have two points (a,b) that make up a line, and a third point (c). I'd
> > like to draw a line (length x) that is parallel to (a,b) but passes
> > through c (at its midpoint).
>
> Determine the equation of the line. There's a formula for the equation of a
> line given a point and the slope of the line.
> Generate x coordinates for your region of interest.
> Use the equation to generate the corresponding y coordinates.
> Plot the generated coordinates.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Hi Steve,

Thank you for your input, I forgot to mention in the post itself (as I did in the title of it) that I'd like to avoid calculating slopes, etc. as some of my data may fall in the undefined region. I have seen methods that allow for the calculation of orthogonal lines based on two points, but have not been able to adapt these to a parallel line.

KP

Subject: Parallel to line through point without slope calculation

From: Roger Stafford

Date: 28 Mar, 2013 06:57:19

Message: 4 of 5

"K" wrote in message <kivmba$jnh$1@newscl01ah.mathworks.com>...
> I have two points (a,b) that make up a line, and a third point (c). I'd like to draw a line (length x) that is parallel to (a,b) but passes through c (at its midpoint).
- - - - - - - - -
  Let a, b, and c be vectors of the three given points, each consisting of their respective cartesian coordinates. The two vectors, d and e, of the endpoints of the desired line segment parallel to the line through a and b with c as its midpoint and of length x can be calculated as follows:

 t = x/2*(b-a)/norm(b-a);
 d = c + t;
 e = c - t;

No slope computation is involved.

Roger Stafford

Subject: Parallel to line through point without slope calculation

From: K

Date: 28 Mar, 2013 15:18:06

Message: 5 of 5

"Roger Stafford" wrote in message <kj0pkf$o9r$1@newscl01ah.mathworks.com>...
> "K" wrote in message <kivmba$jnh$1@newscl01ah.mathworks.com>...
> > I have two points (a,b) that make up a line, and a third point (c). I'd like to draw a line (length x) that is parallel to (a,b) but passes through c (at its midpoint).
> - - - - - - - - -
> Let a, b, and c be vectors of the three given points, each consisting of their respective cartesian coordinates. The two vectors, d and e, of the endpoints of the desired line segment parallel to the line through a and b with c as its midpoint and of length x can be calculated as follows:
>
> t = x/2*(b-a)/norm(b-a);
> d = c + t;
> e = c - t;
>
> No slope computation is involved.
>
> Roger Stafford

This is magnificent! Thank you so very much, Mr. Stafford.

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us