My linear algebra skills are rusty. I need to write a bunch of computer code to do some matrix operations. For the most part, I've succeeded in doing things on my own, but I'm stuck with one operation.
Given an angle in radians, how could I calculate a 4x4 rotation matrix about the x, y, z axes? I need three matrices.
this: http://www.fastgraph.com/makegames/3drotation/
is probably what you're talking about.
But if you're talking about a rotation about the three axes; then these are what you want:
$$X = \left(\begin{matrix} 1 & 0 & 0 \\ 0 & \cos(\theta) & -\sin(\theta) \\ 0 & \sin(\theta) & \cos(\theta)\end{matrix}\right)$$
$$Y = \left(\begin{matrix} \cos(\phi) & 0 & \sin(\phi) \\ 0 & 1 & 0 \\ -\sin(\phi) & 0 & \cos(\phi)\end{matrix}\right)$$
$$Z = \left(\begin{matrix} \cos(\psi) & -\sin(\psi) & 0 \\ \sin(\psi) & \cos(\psi) & 0 \\ 0 & 0 & 1\end{matrix}\right)$$
you just need to multiply them together in the correct order (i.e. reverse of the order which you perform them.
i.e. Rotation about X then Y then Z, or $$R_{xyz}(\theta,\phi,\psi) = R_z R_y R_x$$
which gives you this guy:
$$R_{xyz} = \left( \begin{matrix} \cos(\phi)\cos(\psi) & \cos(\psi)\sin(\theta)\sin(\phi)-\cos(\theta)\sin(\psi) & \cos(\theta)\cos(\psi)\sin(\phi)+\sin(\theta)\sin(\psi) \\ \cos(\phi)\sin(\psi) & \cos(\theta)\cos(\psi)+\sin(\theta)\sin(\phi)\sin(\psi) & \cos(\theta)\sin(\phi)\sin(\psi)-\cos(\psi)\sin(\theta) \\ -\sin(\phi) & \cos(\phi)\sin(\theta) & \cos(\theta)\cos(\phi)\\ \end{matrix}\right)$$