Extending a line from a point given slope?

294 views

Matt Kimmel

Dec 17, 1998, 3:00:00 AM12/17/98
to
Hi all,

This is kind of an embarrassing question to ask, since I *know* I learned
this in high school. But then, that was a long time ago. So here goes:

On a 2D plane, given a point (x,y) and a slope (m), how can I extend a line
with a length of (n) units along the slope, and find the endpoints (x1,y1)
of that line?

-Matt

Lynn R Davis

Dec 17, 1998, 3:00:00 AM12/17/98
to

Matt:

I am assuming that you want to find the OTHER endpoint which is N units
away from X1,Y1 at a slope M.

(x-x1)^2 + (y-y1)^2 = N^2 => N squared equals the X distance squared
plus the Y distance squared.

(y-y1)/(x-x1)=M => The change in Y over the change in X equals the
slope.

or

(y-y1)=(x-x1)*M => This can then be substituted into the first
equation to solve for X:

(x-x1)^2 * (1+m^2) = N^2

Solve for X, plug into the slope equation, and get Y.

Hope this helps.

EggyDee

Dec 17, 1998, 3:00:00 AM12/17/98
to
Hi,
The simplest way, in my opinion, is to take the slope, we'll use 4/3 for
example, and start at the given point, and go up 4, since that is the top
number (if it were -4/3 you would go down instead of up) and right 3, since
that is the bottom number (It won't be negetive.) Hope this helps.

EggyDee
Matt Kimmel wrote in message <75b9vk\$3se\$1...@winter.news.rcn.net>...

Ken Starks

Dec 17, 1998, 3:00:00 AM12/17/98
to
"Matt Kimmel" <mki...@cyberlore-studios.com> wrote:

> On a 2D plane, given a point (x,y) and a slope (m), how can I extend a
> line with a length of (n) units along the slope, and find the endpoints
> (x1,y1) of that line?

If you find a unit vector ( a, b ) in the right direction, the solution
will be:
( x, y ) + n ( a, b )
in other words:
( x + n*a , y + n*b )

In fact a,b are not difficult to find if you have _any_ vector in the
right direction. For example
( 1, m ) with length sqrt(1 + m^2)

==> a = 1/(sqrt(1 + m^2)) and b = m/(sqrt(1 + m^2))

Ken, __O
_-\<,_
(_)/ (_)
Virtuale Saluton.

Stan Brown

Dec 18, 1998, 3:00:00 AM12/18/98
to
In newsgroup alt.algebra.help, article
<75b9vk\$3se\$1...@winter.news.rcn.net>, the lovely and talented
mki...@cyberlore-studios.com wrote:

> On a 2D plane, given a point (x,y) and a slope (m), how can I extend a line
> with a length of (n) units along the slope, and find the endpoints (x1,y1)
> of that line?

This is a vector problem. The solution is a vector of length n, at slope
m. The slope is the tangent of the angle from the x-axis, so the vector's
direction angle is arctan(m). But the problem can be solved without
trigonometry.

Draw a little picture, which will make the next bit easier. You have a
right triangle. The x-axis is parallel to one leg; the point (x,y) is one
vertex, the desired line (the vector) is the hypotenuse, and therefore
(x1,y1) is the other end of the hypotenuse. Drop a perpendicular to where
it meets the other leg.

Now the hypotenuse measures n. The legs measure (x1-x) and (y1-y), and
you know (given the slope) that (y1-y) = m(x1-x) or y1 = m(x1-x)+y. Now
how to solve for x1? Well, you also know that (x1-x)^2+(y1-y)^2=n^2
(theorem of Pythagoras), so you can solve that way. It's a bit messy, but
that's an artifact of the way the problem was stated.

In trig terms, it's a lot easier. Using the same picture, define angle A
such that tan(A) = m. Then x1 = x+n*cos(A), y1 = y+n*sin(A).