Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I need to remove dependence on a programming library from a computer application I'm working on and instead hand code a geometric operation. Please can you show explicitly (for someone with little experience of geometry) the primitive steps to calculate a 3x3 rotation matrix from the composition of three angle (in radians)- unit axis pairs?

Example input:

0.005 radians, (1, 0, 0) -0.0003 radians, (0, 1, 0) 0.02 radians, (0, 0, 1)

and output should be a 3 x 3 matrix?

share|improve this question
It depends on a couple of things: (1) What order do you do the rotations? i.e. Do you first rotate about $x$, then rotate the result about $y$, then the result of that about $z$, or vice versa, or something else? (2) Are your points represented as column vectors, $v=\begin{bmatrix}x\\y\\z\end{bmatrix}$ and you apply a matrix $A$ by computing $Av$, or are points row vectors $v=\begin{bmatrix}x&y&z\end{bmatrix}$ and you do $vA$? –  Rahul Aug 2 '12 at 22:26
Anyway, take a look at what Wikipedia says about rotation matrices in three dimensions. –  Rahul Aug 2 '12 at 22:28
Wikipedia 'Euler angles' provides plenty of details. –  Raymond Manzoni Aug 2 '12 at 22:29
You've seen the Rodrigues rotation formula, I take it? Assemble your three matrices and multiply them out (minding order, as @Rahul says). –  J. M. Aug 3 '12 at 3:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.