Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Math.Cos returning the wrong value?

Tags:

c#

math

xna

In my code:

Vector2 colCircle = new Vector2();

colCircle = new Vector2((R * Math.Sin(D)), -(R * Math.Cos(D)));

While:

R = 22.627
D = 89.214

When checked on my calculator, the X value is correct, but the Y value should be -0.310 but in program it is -7.134.

Any ideas why?

like image 245
Bloodyaugust Avatar asked Nov 12 '10 19:11

Bloodyaugust


People also ask

Does Math Cos return radians or degrees?

The Math. cos() function returns the cosine of a number in radians.

What is the value of Cos value?

Cos θ = sin θ/tan θ Sec θ = tan θ/sin θ

Does Math cos use radians?

The cosine is equal to the ratio of the side adjacent to the angle and the hypotenuse of the right-angled triangle they define. The angle must be measured in radians.


1 Answers

The trigonometric functions expect radians, not degrees.

like image 139
James McNellis Avatar answered Oct 11 '22 11:10

James McNellis