If you find this article contains errors or problems rendering it unreadable (missing images or files, mangled code, improper text formatting, etc) please contact the editor so corrections can be made. Thank you for helping us improve this resource
Since no one else has mentioned this, I guess I will. Why not use quaternions, rather than rotation matrices, to represent your rotations? Quaternions on the unit sphere and 3-d rotations are isomorphic, and quaternions don't require the redundant storage and calculation that 3x3 matrices do.
A quaternion may be thought of as an entity of the form [s,x], where s is a scalar and x is a 3-vector. Multiplication of quaternions is given by [s1,x1] * [s2,x2] = [s1 * s2 - x1 dot x2, s1*x2 + s2*x1 + x1 cross x2]. A unit quaternion is one that satisfies s*s + x dot x = 1. A unit quaternion may also be thought of as a rotation of angle 2 arccos s about the axis v. To rotate a vector v by a rotation quaternion q to get a vector w, use the formula [0,w] = inv(q) * [0,v] * q, where inv(q) * q = [1,0], and inv([s,v]) = [s,-v]. Or, if you prefer, form the equivalent rotation matrix