How would I create a rotation matrix that rotates X by a, Y by b, and Z by c?
I need to formulas, unless you're using the ardor3d api's functions/methods.
Matrix is set up like this
xx, xy, xz, yx, yy, yz, zx, zy, zz
A Quaternion is fine too.
How would I create a rotation matrix that rotates X by a, Y by b, and Z by c?
I need to formulas, unless you're using the ardor3d api's functions/methods.
Matrix is set up like this
xx, xy, xz, yx, yy, yz, zx, zy, zz
A Quaternion is fine too.
The rotation matrices around the x, y, and z axes, respectively, are $$R_x(\theta) = \begin{pmatrix} 1 & 0 & 0 \\ 0 & \cos \theta & -\sin \theta \\ 0 & \sin \theta & \cos \theta \end{pmatrix}$$ $$R_y(\phi) = \begin{pmatrix} \cos \phi & 0 & \sin \phi \\ 0 & 1 & 0 \\ - \sin \phi & 0 & \cos \phi \end{pmatrix}$$ $$R_z(\psi) = \begin{pmatrix} \cos \psi & - \sin \psi & 0 \\ \sin \psi & \cos \psi & 0 \\ 0 & 0 & 1 \end{pmatrix}$$
If you want to rotate in the order specified in your comment on mathcast's answer, then you want $$R_z(\psi) \cdot R_y(\phi) \cdot R_x(\theta) = $$
$$\begin{pmatrix} \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{pmatrix}$$
I think that 3d rotation is more complicated than this; rotating around each of the axes separately can give different cumulative results depending on the order in which you choose to do the rotations.
see also
http://en.wikipedia.org/wiki/Rotation_matrix#Three_dimensions