• Create Account

# Calculate Slope with only three points?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

12 replies to this topic

### #1MARS_999  Members   -  Reputation: 1514

Like
0Likes
Like

Posted 13 June 2012 - 09:37 PM

Is it possible to calculate the slope of a line with x1,x2, y1 and no y2?

I thought I read somewhere you could use tan() to get the slope of a line?

What I am looking for is the end point on this line. the Y value.

Thanks

### #2JTippetts  Moderators   -  Reputation: 11843

Like
1Likes
Like

Posted 13 June 2012 - 09:48 PM

Nope. There are an infinite number of lines that run through point (x1,y1) and cross the axis x=x2. tan() won't help you here, since tan() is a ratio of rise/run (slope), but the numerator includes an unknown. If you know the angle of the line you could calculate it, otherwise you need more information.

### #3MARS_999  Members   -  Reputation: 1514

Like
0Likes
Like

Posted 13 June 2012 - 09:49 PM

Nope. There are an infinite number of lines that run through point (x1,y1) and cross the axis x=x2. tan() won't help you here, since tan() is a ratio of rise/run (slope), but the numerator includes an unknown. If you know the angle of the line you could calculate it, otherwise you need more information.

say the angle is 27.5 degrees... How would I use that with the 3 coordinates?

Thanks

### #4JTippetts  Moderators   -  Reputation: 11843

Like
2Likes
Like

Posted 13 June 2012 - 10:02 PM

Refer to the old high school rule of SOH CAH TOA, which relates the trigonometric functions relative to a right triangle:

the sin() of Angle is calculated as Opposite/Hypotenuse (S=O/H)
the cos() of Angle is calculated as Adjacent/Hypotenuse (C=A/H)
the tan() of Angle is calculated as Opposite/Adjacent (T=O/A)

If your line is the hypotenuse in the above triangle, and the Angle=27.5 degrees, then it follows that tan(27.5) = O/A. Side A represents the length of the distance between x1 and x2, side O represents the distance between y1 and y2. So:

tan(27.5) = (y2-y1) / (x2-x1)

Rearrange and solve for y2 (the unknown):

tan(27.5)*(x2-x1)+y1=y2

### #5jefferytitan  Crossbones+   -  Reputation: 2460

Like
0Likes
Like

Posted 14 June 2012 - 12:34 AM

Just to clarify, the concept you're referring to seems unclear. The title of your post says "Calculate Slope with only three points". It's totally possible if you use the conventional meaning of a point, e.g. an x and y co-ordinate. That would mean you have (x1, y1), (x2, y2) and (x3, y3). That's more than you need, you only need two points to get a slope.

If you're talking about two x co-ordinates and one y co-ordinate... that's 1.5 points. Not possible at all. It's not really a situation which comes up often. You can see it by trying to sketch it on paper. To have a slope you need a line. How do you draw a line with less than two points?

If you indeed have a situation where this is a valid question, we need more background on how you ended up in this situation. Sometimes an assumption can be made, or other known data can be used.

### #6MARS_999  Members   -  Reputation: 1514

Like
0Likes
Like

Posted 14 June 2012 - 03:47 AM

I know point A(x,y) and I need to know point B(x, unknown need to find y)

### #7WarAmp  Members   -  Reputation: 750

Like
0Likes
Like

Posted 14 June 2012 - 03:42 PM

If all you have is A(x, y) and B(x, ?) you simply don't have enough data. There are an infinite number of lines that pass through A(x,y) and the boundary B(x, ?).

You can set ? to any value and create a line, but there is no single specific line.
If you have an angle already, then JTippets post explains how to solve for ?.
Waramp.Before you insult a man, walk a mile in his shoes.That way, when you do insult him, you'll be a mile away, and you'll have his shoes.

### #8Cornstalks  Crossbones+   -  Reputation: 7020

Like
0Likes
Like

Posted 14 June 2012 - 03:59 PM

The slope m for a line going through the points A (x1, y1), and B (x2, R), where R is unknown, is simply:

m = (R - y1) / (x2 - x1)

If you don't know R, you cannot find m, as others have said. It's like if I tell you j = k, and ask you to find j. You can't. Not without knowing k first.

Think of it like this: B is a line in the form x2 (or in other words, it's a vertical line at x2). Start at point A. Now look at your vertical line B. There are an infinite number of ways to draw a line from A to B, seeing as B is infinitely long.

Edited by Cornstalks, 14 June 2012 - 04:00 PM.

[ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

### #9MARS_999  Members   -  Reputation: 1514

Like
0Likes
Like

Posted 14 June 2012 - 06:14 PM

So point being is you need to know at least 4 points then... e.g. 3 points define a line, 4 define slope then...

### #10jefferytitan  Crossbones+   -  Reputation: 2460

Like
0Likes
Like

Posted 14 June 2012 - 06:32 PM

So point being is you need to know at least 4 points then... e.g. 3 points define a line, 4 define slope then...

No, your terminology is wrong. A point is two co-ordinates (x and y). You need two points to make a line. A line has a slope. When you have one point plus a single co-ordinate it is impossible to draw a line, so you can't have a slope. Or to be more accurate you could draw an infinite number of lines. Seriously, sketch it on paper and you'll get it.

### #11Cornstalks  Crossbones+   -  Reputation: 7020

Like
0Likes
Like

Posted 14 June 2012 - 06:34 PM

@MARS_999: uhhh... no. Let's clarify something: when you have (x, y) = P, x and y are not points. Together, they make up a single point, P. You need both of them to have one point.

2 points make up a line (in 2D our case, this requires 4 values). Once you have a line, you can find the slope (no additional points required).

If you do not have two points, you do not have a line. If you are missing one of the coordinate values, it is not a point (i.e. (x, ?) is not a point). You need two values to have a point, and you need two points (four values) to have a line, and you need a line to have a slope.

Edited by Cornstalks, 14 June 2012 - 06:37 PM.

[ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

### #12japro  Members   -  Reputation: 887

Like
0Likes
Like

Posted 14 June 2012 - 06:34 PM

Your definition of "point" is off. A point in a 2d plane consists of two coordinates. Two such points define a line.

### #13MARS_999  Members   -  Reputation: 1514

Like
0Likes
Like

Posted 14 June 2012 - 06:43 PM

Thanks guys. I see now, yeah I was a bit loose on my wording, saying 4 points should have said elements or coordinates... Axes something...

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

PARTNERS