# 3D Rotation of a rigid body in Fixed Axes (Not Axes Rotation)

1. Aug 22, 2012

### mushi

Dear All,

I have come across with a seemingly very simple problem but could not solve it by searching on internet and books. May be I am confused.

I want to rotate a 3D body around an arbitrary axis with fixed principal axes. The solutions I found is with Euler angles (Euler rotational matrices). But in Euler case, we are not rotating the body but rotating the principal axes, which I don't want.

In short:
In Euler case we map axes XYZ to X'Y'Z' with rotation matrices using any angle theta.
I my case I want my body position xyz to be mapped to new position x'y'z' after rotation about an arbitrary axis of angle theta. (XYZ = XYZ before and after applying rotation).

I hope I am clear to explain my question here.
Desperately waiting for help.

Mushi

2. Aug 22, 2012

### Filip Larsen

3. Aug 22, 2012

### mushi

Hi Filip,

I am sorry that is what I don't want to do. I tried to explain in my post (may be not explained in a good way) that this method is used when you want to rotate the principal axes. I want my principal axes remind fixed.

I rather want to rotate my body (defined by Cartesian coordinates) to be rotated in a fixed, orthogonal, 3D coordinate system i.e. XYZ.

I think I am more clear now :S

4. Aug 22, 2012

### Simon Bridge

It's actually the same thing.

Anyway - you've seen wikipedias general rotation matrixes?
http://en.wikipedia.org/wiki/Rotation_matrix

You should be able to demonstrate the equivalence yourself by considering simple rotations of a single point (position vector) and constructing the rotation matrix for it.

5. Aug 22, 2012

### Studiot

What you are saying is that given a point P1 (x1, y1, z1, ) after rotation by given angles (α,β,γ) about the axes you want a formula for the point P2 (x2, y2, z2, ) that P moves to ?

And what you have found is given P1 (x1, y1, z1, ) and P2 (x2, y2, z2, ) find angles (α,β,γ).

6. Aug 22, 2012

### mushi

Dear Simon,

You are referring to the same Wikipedia article.

If it is the same then please explain because I am not getting what I intend to.

7. Aug 22, 2012

### mushi

Dear Studiot,

I have points (in Cartesian coordinates) and I know the desired angle (α,β,γ) on which I want my points to be rotated. I want to get the rotated points i.e. P2 in your example.

For example,
P1(1,2,3) has to be rotated around principal axes XYZ at angles (α=10,β=20,γ=30).
What would be P2?

With traditional Euler matrices, we do not rotate P1 onto P2. We rather rotate XYZ to X'Y'Z' which is not I desire.

8. Aug 22, 2012

### Studiot

The transformations you require are

$$\begin{array}{l} \left[ {\begin{array}{*{20}{c}} 1 & 0 & 0 \\ 0 & {\cos \theta } & { - \sin \theta } \\ 0 & {\sin \theta } & {\cos \theta } \\ \end{array}} \right] \\ \left[ {\begin{array}{*{20}{c}} {\cos } & 0 & {\sin \theta } \\ 0 & 1 & 0 \\ { - \sin \theta } & 0 & {\cos \theta } \\ \end{array}} \right] \\ \left[ {\begin{array}{*{20}{c}} {\cos } & { - \sin \theta } & 0 \\ {\sin \theta } & {co{\mathop{\rm s}\nolimits} \theta } & 0 \\ 0 & 0 & 1 \\ \end{array}} \right] \\ \end{array}$$

The first matrix gives rotation about the x axis, the second about the y axis and the third about the z axis.

9. Aug 22, 2012

### Studiot

I should point out that the actual end position will depend upon the order in which you perform the rotations.

There is another matrix for the rotation about a general vector from the origin to the point (a,b,c)

$$\left[ {\begin{array}{*{20}{c}} {{a^2}(1 - \cos \theta ) + \cos \theta } & {ab(1 - \cos \theta ) - csin\theta } & {ac(1 - \cos \theta ) + bsin\theta } \\ {ab(1 - \cos \theta ) + csin\theta } & {{b^2}(1 - \cos \theta ) + \cos \theta } & {bc(1 - \cos \theta ) - asin\theta } \\ {ac(1 - \cos \theta ) - bsin\theta } & {bc(1 - \cos \theta ) + asin\theta } & {{c^2}(1 - \cos \theta ) + \cos \theta } \\ \end{array}} \right]$$

Last edited: Aug 22, 2012
10. Aug 22, 2012

### Muphrid

A rotation about successively rotated axes can be rewritten as a rotation about fixed frame axes, with the individual rotations performed in reverse.

11. Aug 22, 2012

### mushi

Dear Studiot,

Thanks for the reply. This is actually a further explanation of what has already been said and understood. Thanks for this anyways.

The difficulty I am facing is as follows:
I rotated my coordinates first around Z-axis, 90° CW. This mapped +ve y-coordinate onto +ve x-coordinate. Then when I tried to rotate further around Y-axis, I got some very strange values. But when I rotated my coordinates around X-axis rather than Y-axis (as a second rotation after Z), I got the right results. It happened because Y-axis had actually mapped to X-axis after first rotation.

In summary:
1st Rotation around Z-axis : Using third matrix, 90°, CW
2nd Rotation desired in Y-axis : Using second matrix (wrong results); Using first matrix (correct results)

12. Aug 22, 2012

### mushi

Dear Muphrid,

13. Aug 22, 2012

### Studiot

Although you have posted in the classical physics section this is really a mathematics question and in mathematics we count angles anticlockwise. So for CW angles we must add a negative sign.

Take the first matrix, rotation about the x axis.

This corresponds to the 3 equations

x2 = x1 → x1

y2 = y1 → y1cosθ - z1sinθ

z2 = z1 → y1sinθ + z1cosθ

14. Aug 22, 2012

### mushi

Dear Studiot,

My question was not emphasized on CW or ACW. I know that if I invert the sign of 'sin' in the matrices you mentioned, the direction will be changed.

I actually want to ask why I need to rotate in X-axis for second rotation rather than Y-axis when actually the rotation around Y-axis was desired? .Kindly read the my previous post for clarity.

15. Aug 22, 2012

### Studiot

I am trying to help you understand, not do your calculations for you, so bear with me.

Firstly it is the angle θ which is negative for clockwise rotation not the trig function.

Since sin (-θ) = -sin(θ) and cos (-θ) = +cos(θ), this amounts to changing the sign of the sin entries only. But this is not always the case so beware and put the minus sign in the correct place.

Read again my entry from post #9

To see this take a book, place it in front of you on the desk. Rotate it about about each of two then three axis by 90° or 180°. do this several times with the axes of rotation in different orders.

You will see that the front cover of the book ends up differently depending upon the order you do your rotations.

Murphrid's post was to tell you what order to apply my matrices to the vector (x,y,z) compared to the desired order of rotations - that is to apply the matrix for the last rotation first.

Last edited: Aug 22, 2012
16. Aug 22, 2012

### mushi

Dear Studiot,

Thanks for your help. Now I have almost solved my problem.

Kind Regards,

17. Aug 22, 2012

### Studiot

That's what I like to hear.

edit: incidentally the direction of rotation is taken standing at the origin and looking towards +∞ for a right handed set of axes.

Last edited: Aug 22, 2012