#### Archived

This topic is now archived and is closed to further replies.

# Slope to angle?

This topic is 6135 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I feel bad asking this because it even seems easy to myself, but I can''t seem to come up with the solution. If I have the slope of a line, how do I get the angle for it? --Vic--

##### Share on other sites
Just throwing what I remember from HS math clases out (shouldn't having been sleeping so much). But I do remember the word "SoaCahToh". Basically its all the basic trig functions you need for a right angle triangle.

(Insert image of a right triangle with corners labeled A, B and C)

First think of what angle you want, the angel of A, B or C. Then label the three sides as (h)ypotenuse (the side opposite the right angle), (o)pposite (either the side opposite the point, or if that is the hypotenuse then pick a remaining side) and (a)djacent (the last side).

Now use SoaCahToh to make a formula and solve it for the unknown.

Tan(Angle)=opposite/hypotenuse

Edited by - Michalson on February 16, 2002 4:27:23 PM

##### Share on other sites
I'm an idiot. Forgive me for even posting this. I don't know why I didn't think of it before. I realized I just need the inverse sin and so on. Does Math.h have this function, and if so, what is it called?

--Vic--

Edited by - Roof Top Pew Wee on February 16, 2002 4:31:51 PM

##### Share on other sites
If I remember right, you could always use the inverse of tan. I''m sure math.h has that, instead of inverse sin..

Rather than using adj, hyp and inverse sin, you would use adj, opp and inverse tan.

Oh, and I believe it''s SohCahToa.

##### Share on other sites
JohnPC is right. To find the slope, you probably divide Y by X. That''s what Tan(angle) is. So to find the angle, you just need to do atan(slope).

##### Share on other sites
just in case someone does not know this:

Michalson is wrong with his formulas
its acutally "sohcahtoa"

sin(angle) = opposite/hypotenuse

##### Share on other sites
There''s a nice function in math.h called atan2. It takes two arguments - first deltaY, then deltaX, and returns the angle. If you just use atan, you need to then add a multiple of 90 degrees that corresponds to the quadrant indicated by the combination of signs. Also note that there are single-precision versions of most of the math functions. Just put an f at the end of each. Example: sinf() instead of sin().

##### Share on other sites
If you have both x and y, don''t do atan(x/y), but atan2(x,y).

##### Share on other sites
I found it a lot easier to memorise the unit circle than the "sohcahtoa" mnemonic.

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633660
• Total Posts
3013221
×