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 am getting 3 angles from another system that I need to convert into a 3x3 rotation matrix.

Here is the diagram:

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.

share|improve this question
    
The direction of B is unaffected by applying the rotation of C, yes? –  El'endia Starman May 10 '11 at 0:23
    
Yes correct. C rotation is applied first. A/B is then applied to the rotated object. –  Zoom May 10 '11 at 1:57
    
So... you are now rotating with respect to which axis after the $C$ rotation? –  J. M. May 13 '11 at 0:45
    
A is the angle away from the z axis. B is the direction that is applied in. –  Zoom May 13 '11 at 1:03
1  
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. –  J. M. May 13 '11 at 1:50

1 Answer 1

up vote 1 down vote accepted

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}$$

Where:
$$\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.

share|improve this answer
    
"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. –  J. M. May 14 '11 at 4:43
    
...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}$. –  J. M. May 14 '11 at 4:49

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.