I don't want anything overly complicated nor a 500 page web site to read.

I want a mathmatical equation(s) to rotate a given vertex at (x,y,z) with a current angle Theta to the X axis, Phi to the Y axis, and Omega to the Z axis. The defined rotation is about all three axis defined by a rotation of Theta + Theta' about the X axis, Phi + Phi' to the Y axis, and Omega + Omega' to the Z axis. Where Theta', Phi' and Omega' are the user defined rotation to rotate beyond the current rotation about each axis.

The equation should work with no exceptions such as 90 degree rotation about the Z axis. I've been looking at this complex matrix rotation stuff for a while now and honestly do not feel like figuring out the derrived rotation matrix for a rotation on all three axis. Answer should be in the form:

x = something

y = something

z = something

Another question that is not required to be answered is given an arbitrary vector to rotate about how to calculate rotation about that axis. So say given vector (v.x, v.y. v.z) and a rotation about that vector with a measure of the current angle of the point given by the dot product of the y axis and the line (giving a perpendicular line to the Y axis and the given vector) how could I rotate a point in 3D space about that arbitrary line.

Thank you!

~Aqua

x' = x*cos(omega) - y*sin(omega)

y' = x*sin(omega) + y*cos(omega)

z' = z

corresponds to this matrix-vector multiplication:

[x'] [ cos(omega) -sin(omega) 0 ] [ x ]

[y'] = [ sin(omega) cos(omega) 0 ] [ y ]

[z'] = [ 0 0 1 ] [ z ]

But doing the transforms involves more than matrix-vector multiplication. You have to do matrix-matrix multiplication to string several transforms together, and you also have to do a matrix inversion to reverse a transform.

To rotate points around an arbitrary line L0, using quaternions, this is the general process:

1. Find a translation matrix T that moves L0 so that it crosses the origin. Let L1 be the transformed line from this.

2. Find a rotation matrix R1 that rotates L1 around the Z-axis so that the transformed line L2 rests in the X-Z plane.

3. Find another rotation matrix R2 that rotates around the Y-axis so that L2 comes to be aligned with the Z-axis.

Now the transform matrix (R2 * R1 * T) takes points along the original L0 line and aligns them with the Z-axis.

4. Create a rotation matrix R3 that rotates everything around the Z-axis by your desired rotation angle.

Let X = (R2 * R1 * T)

Let X' = the matrix inverse of X

Let Q = (X' * R3 * X)

The matrix Q will perform the transform you want. X pulls everything in to surround the Z-axis, R3 rotates everything around the Z axis, then X' moves everything back.