I am getting 3 angles from another system that I need to convert into a 3x3 rotation matrix.

Here is the diagram:


P is the point where all angles are 0.
A is the tilt angle limited to the angles 0 to 90 degrees.
B is the angle that A is applied in. Note B does not rotate the object itself. If A's value is zero then this angle does nothing. Range is 0 to 180 anticlockwise and 0 to -180 clockwise.
C is the rotation around P. Same ranges as B. This rotation is applied first.

In short, rotate object around P by C, then tilt by A in the direction of B.

Let me know if you need more info.

Edit: I'll start off with what I have got already and that is the C rotation. Pretty easy for that one as it is just the rotation around the Z axis.

$$\begin{pmatrix} \cos(C)&-\sin(C)&0\\ \sin(C)&\cos(C)&0\\ 0&0&1\end{pmatrix}$$

That works for my purposes but I am unsure of how to convert the other angles to a matrix so I can multiply the two together.

  • $\begingroup$ The direction of B is unaffected by applying the rotation of C, yes? $\endgroup$ Commented May 10, 2011 at 0:23
  • $\begingroup$ Yes correct. C rotation is applied first. A/B is then applied to the rotated object. $\endgroup$
    – Zoom
    Commented May 10, 2011 at 1:57
  • $\begingroup$ So... you are now rotating with respect to which axis after the $C$ rotation? $\endgroup$ Commented May 13, 2011 at 0:45
  • $\begingroup$ A is the angle away from the z axis. B is the direction that is applied in. $\endgroup$
    – Zoom
    Commented May 13, 2011 at 1:03
  • 1
    $\begingroup$ Nono, you misunderstand my query, it seems. Whenever we rotate something, you rotate with respect to some imaginary line passing through your object, yes? (think of holding a barbecue and rotating the stick) What is that imaginary line you're rotating your object on? That should assist in determining the proper rotation matrix. $\endgroup$ Commented May 13, 2011 at 1:50

1 Answer 1


After J. M.'s comment it occurred to me that I can make B + 90 degrees the arbitrary axis and spin in the amount of A. So I can use that to get an axis-angle rotation and then convert that to a matrix.

$$\begin{pmatrix} xxt+c&xyt-zs&xzt+ys\\ yxt+zs&yyt+c&yzt-xs\\ zxt-ys&zyt+xs&zzt+c\end{pmatrix}$$

$$\begin{align*} x &= \cos(B + 90°)\\ y &= \sin(B + 90°)\\ z &= 0\\ s &= \sin(A)\\ c &= \cos(A)\\ t &= 1 - c \end{align*}$$

Multiplying this matrix with the C matrix in the question above give the correct rotation matrix.

  • $\begingroup$ "axis-angle rotation" - Very good, I see that the hint was helpful. Rodrigues is always good to start from when rotating stuff around arbitrary axes. $\endgroup$ Commented May 14, 2011 at 4:43
  • $\begingroup$ ...and if you'll finally indulge me a tiny numerical note: the formula for $t$ is numerically unsound if $A$ is tiny. Rather, use $t=2\sin^2\frac{A}{2}$. $\endgroup$ Commented May 14, 2011 at 4:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .