Skip to main content
GameDev.net gamedev.net
🔒 Locked

[C#]Math.Sin() is wrong?

Started by Portishead Nov 29, 2008 at 10:04 AM 6 replies 13.9k views
Original Post
Portishead
Portishead
Math.Sin(30) suppose to give 0.5, but when I did it, it gave me a negative number. What's wrong with it? Math.Sinh() is the same as SHIFT SinX in a caculator?
SiCrane
SiCrane
Sin() uses radians, not degrees.
Portishead
Portishead
How can I change it to degrees?
AlfredR
AlfredR
Since there are Pi radians per 180 degrees, you need to multiply the argument of sin by Math.PI/180.

e.g. Math.Sin(30 * Math.PI/180) is sin of 30 degrees.

edit: I just saw your question about Math.Sinh: sinh is hyperbolic sin. Just like sin gives the y-component of the angle parameterization of the curve x^2+y^2=1, sinh gives the y-component corresponding to an angle-like parameterization of the hyperbolic curve x^2-y^2=1

You can find more on wikipedia if you're interested: Hyperbolic Sin
Portishead
Portishead
Thanks.

What about Math.Sinh()?
AlfredR
AlfredR
Wow you're quick. You replied while I was editing. See the bottom of my other post for info on Math.Sinh.
Portishead
Portishead
Oh, wow, haven't got there in math yet.

Is there a function to get X from SinX? [Like doing SHIFT SinX in a calculator(not the computer one)]
Omid Ghavami
Omid Ghavami
Quote:
Original post by Portishead
Oh, wow, haven't got there in math yet.

Is there a function to get X from SinX? [Like doing SHIFT SinX in a calculator(not the computer one)]


Math.Asin, if I understood your question correctly.

You have b = Sin(X), and you want to know what X is, right?
Then X = Math.Asin(b), it's the inverse sine function (sin-1)
Best regards, Omid

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.