• ### What is your GameDev Story?

#### Archived

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

# Trig Question

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

## Recommended Posts

i noticed in the header file "math.h" there is sin , cos , and tan. The problem is that i couldn''t find an arctan,arcsin, and arccos. Anyone know where i can find these functions in either math.h, another header, or its algebraic equivilent? - Thanks JYoung

##### Share on other sites
The functions you want are asin, acos, and atan. They are also in math.h, at least according to my documentation.

##### Share on other sites
quote:
Original post by mmelson
The functions you want are asin, acos, and atan. They are also in math.h, at least according to my documentation.

i tried them, they aren''t working the way the are supposed to.

if i do:
acos(.672); // on my pc
//this = .80..etc

cos^-1(.672 // graphing calc
this = 47.77

Anyone know any other header file? Or why this is happening?

##### Share on other sites
remember they return radians not degrees..

=*=
If things seem bad, think that they can get a whole load worse, and they don''t seem so bad anymore

=*=

##### Share on other sites
I didn''t check the numbers, so I don''t know if this is your problem, but are you confusing degrees and radians? Most graphing calculators use degrees by default, but the math.h functions use radians.

If you were to take a circle with a radius of 1, and measured out an arc on that circle of length 1, then the angle that subtends that arc would be one radian. The radian is a more natural way of measuring angles than the arbitrary 360o degree system we''re accustomed to. Using the geometry you already know, you''ll find that there are 2*pi radians in a circle. So to convert from degrees to radians, divide by 180 and multiply by pi; to convert from radians to degrees divide by pi and multiply by 180.

Sorry if you already knew this.

##### Share on other sites
quote:
Original post by TerranFury
I didn''t check the numbers, so I don''t know if this is your problem, but are you confusing degrees and radians? Most graphing calculators use degrees by default, but the math.h functions use radians.

Bingo, thanks a bunch guys.

JYoung

##### Share on other sites
I dunno what math you''re in, but that gets even worse as you go up. In first year calc, and trig too even, constantly had to switch between radians and degrees, depending on the problem. It was confusing, but after a while of doing it, you kind of get the idea of what is wrong for a result (ie: you used the wrong mode) My teacher used to remind us to check our mode before taking any test

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 28
• 16
• 10
• 10
• 11
• ### Forum Statistics

• Total Topics
634111
• Total Posts
3015573
×