rotate a point

I have a 3d object wich I want rotate around the player (0,0,0).

1
2
    float rotate_x(int degrees){return(x*cos(degrees*PI/180)-z*sin(degrees*PI/180));}
    float rotate_z(int degrees){return(x*sin(degrees*PI/180)+z*cos(degrees*PI/180));}


This code doesn't seam to work. When x=0 and z=10
rotate_x(180, 0) = -2.65...

Could anyone explain what I'm doing wrong?
The functions are right. Debug it. Simply by printing x, z, PI, cos(degrees*PI/180) and sin(degrees*PI/180) before returning. By the way, why do you call rotate_x with two arguments?
I solved the problem. I had defined PI wrong.

why do you call rotate_x with two arguments?

In my program I rotate many points. The zero stands for the element of a array. I forgot to delete it.
Topic archived. No new replies allowed.