Hi, I ahve run into a minor problem programming a simple asteroid game in open gl.

I have an Object class (in C++) that holds vectors for acceleration, velocity, position and a double for rotation.

What I would like to do is have the object rotate to its velocity.

For instance, if velocity is v(1,1) the ship would be rotated 45 degrees (the game is 2d so rotation happens on the z axis).

The rotation and translation is defined as follows:

glTranslated(position.x, position.y, 0.0);

glRotated(rotation, 0.0, 0.0, 1.0);

There's also a limit on the velocity and when player presses a button, the acceleration increases, and then is decreased a bit each frame (causing acceleration and drag to the ship movement).

The problem I ran into is extracting the rotation value...

If I set theta = the angle between x axis and velocity vector, I could extract it as follows (correct me if I'm wrong):

tan theta = opposite/adjacent // these are lenths of the x, y components of the vector.

The problem is that I can't find a cotangent function is c or c++ that would take the invesre of tangent to get me the theta...

I guess I could also get the angles by using angle cosines, but if I have cos theta = x/ |velocity| but then I have to have a cosecant (spelling?) csc? function... which I also can't find it.... reverses for sin,cos,tan are in my calculator... aren't there any in C++ ?

Thank you for the help....