Calculate Slope with only three points?

Started by
11 comments, last by MARS_999 11 years, 11 months ago
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
Advertisement
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.

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
Refer to the old high school rule of SOH CAH TOA, which relates the trigonometric functions relative to a right triangle:

JjD9i.png

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
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.
I know point A(x,y) and I need to know point B(x, unknown need to find y)
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.
The slope m for a line going through the points A (x[sub]1[/sub], y[sub]1[/sub]), and B (x[sub]2[/sub], R), where R is unknown, is simply:

m = (R - y[sub]1[/sub]) / (x[sub]2[/sub] - x[sub]1[/sub])

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 x[sub]2[/sub] (or in other words, it's a vertical line at x[sub]2[/sub]). 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.
[size=2][ 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 ]
So point being is you need to know at least 4 points then... e.g. 3 points define a line, 4 define slope then...

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.

This topic is closed to new replies.

Advertisement