0
Hi, I have problem with sin(),cos(),when used them to find sin() of angle (90) the result not correct. what shuld i do?
2 Answers
+ 6
The angle likely needs to be in radians.
I assume you want the result to equal 1?
This is sin(PI / 2).
To convert an angle to radians you do:
R = (A * PI / 180)
Where A is the angle, R is radian, PI is the constant 3.14...
So,
R = 90 * PI / 180
R = PI / 2
+ 4
sin/cos/tan/etc work in radians, not degrees.
2Ï radians == 360 degrees.
So Math.Sin(90) wouldn't be 1, but Math.Sin(Math.PI/2), which is a right angle in radians, would.
To convert from radians to degrees, use
x * 360 / (2 * Math.PI)
or
x * 180 / Math.PI
I hope that makes sense!