In java, I’m trying to operate on numbers with cos and sin, yet I keep getting negative variables, can anybody explain why?
This is my code:
double velocity_x=22*Math.sin(10);
double velocity_y=22*Math.cos(10);
They both respectively return velocity_x=-11.968464439566135
and velocity_y=-18.459573639681953
What am I doing wrong?
The argument to
sin()andcos()is in radians, not degrees. To convert, multiply by π/180: