ok, I am reading the chapter on transformations in "Mathematics for 3D Game Programming & Computer Graphics" and am having trouble figuring out which equations to use in rotating a camera vector.

equation 3.12

judging by how their is no "center" for this rotation equation, I gather it rotates around <0,0,0>(what i mean to say, is that it is no different than the basic glrotate3f?).Code:

// R is the rotated vector P, O is the angle of the rotation

R.x = P.x cos O - P.y sin O;

R.y = P.y cos O + P.x sin O;

now, then there is equation 3.19 which is rotating about an arbitrary axis represented by a unit vector

However, this is only for rotating in 90 degree increments from what I see.Code:

//again, R is the rotated vector, A is the axis, and P is the original Vector, and O is the angle which the vector is rotated

//through

R = P cos O + (A X P) sin O + A(A . P) (1 - cos O);

now my question is, how does game tutorials get this :

Do I need to do something as messed up looking as Gametutorial's method(I would like to know how they derived that equation), or can I make a better, simpler formula. I know I could do a simple "copy/paste" manuver and just rewrite it to use my classes, but I want to understand this fully as its alot easier to "re-derive" in case of losing the equation if I understand it and the math behind it.Code:

void CCamera::RotateView(float angle, float x, float y, float z)

{

CVector3 vNewView;

// Get the view vector (The direction we are facing)

CVector3 vView = m_vView - m_vPosition;

// Calculate the sine and cosine of the angle once

float cosTheta = (float)cos(angle);

float sinTheta = (float)sin(angle);

// Find the new x position for the new rotated point

vNewView.x = (cosTheta + (1 - cosTheta) * x * x) * vView.x;

vNewView.x += ((1 - cosTheta) * x * y - z * sinTheta) * vView.y;

vNewView.x += ((1 - cosTheta) * x * z + y * sinTheta) * vView.z;

// Find the new y position for the new rotated point

vNewView.y = ((1 - cosTheta) * x * y + z * sinTheta) * vView.x;

vNewView.y += (cosTheta + (1 - cosTheta) * y * y) * vView.y;

vNewView.y += ((1 - cosTheta) * y * z - x * sinTheta) * vView.z;

// Find the new z position for the new rotated point

vNewView.z = ((1 - cosTheta) * x * z - y * sinTheta) * vView.x;

vNewView.z += ((1 - cosTheta) * y * z + x * sinTheta) * vView.y;

vNewView.z += (cosTheta + (1 - cosTheta) * z * z) * vView.z;

// Now we just add the newly rotated vector to our position to set

// our new rotated view of our camera.

m_vView = m_vPosition + vNewView;

}