how to rotate coordiante system about Z axis first then rotate about about the new Y axis.

24 visualizzazioni (ultimi 30 giorni)
Assume two coordinate systems, one is the global coordinate system(XYZ) and another is a local coordinate system which is obtained by rotating about the Z axis of the global coordinate system and then rotating about the new Y axis. how can I get the translated matrix of this process?

Risposta accettata

David Goodmanson
David Goodmanson il 19 Ago 2018
Hi Yang,
Suppose you have rotation matrices
Rx = [1 0 0 Ry = [c 0 -s Rz = [c -s 0
0 c -s 0 1 0 s c 0
0 s c] s 0 c] 0 0 1]
If p is the column vector [x;y;z], then for example pnew = Rx*p.
Here s is sin(theta), c = cos(theta), these are active rotations of the object, and looking down the axis of rotation toward the origin, the rotations are counterclockwise.
A rotation in z and then in the original y would be
vnew = Ry*Rz*v
A rotation in z and then in the new y is
vnew = Rz*Ry*v
which has the order reversed. That's because a rotation about the new y axis is equivalent to: rotate the new y axis back to the old y axis, then rotate about the old y axis, then rotate forward so that the old y axis is the new y axis.
Ry_new = Rz*Ry*Rz^(-1)
so
Ry_new*Rz = Rz*Ry*Rz^(-1)*Rz = Rz*Ry
  6 Commenti
James Tursa
James Tursa il 28 Gen 2019
Modificato: James Tursa il 28 Gen 2019
@David: You have a mixed set of rotation matrices because the sine signs are not consistent. The sine signs of the Ry rotation should be reversed when compared to the others to make the set consistent. E.g.,
Rx = [1 0 0 Ry = [c 0 s Rz = [c -s 0
0 c -s 0 1 0 s c 0
0 s c] -s 0 c] 0 0 1]
See this link "In three dimensions":
David Goodmanson
David Goodmanson il 28 Giu 2019
Hi James, thanks for pointing this out. I blithely borrowed the first ones from a set I made having to do with the earth's rotation, but for the problem here the consistent set would have been better.

Accedi per commentare.

Più risposte (1)

Yang Lu
Yang Lu il 28 Gen 2019
Ry_new = Rz*Ry*Rz^(-1)
so
Ry_new*Rz = Rz*Ry*Rz^(-1)*Rz = Rz*Ry
Hi David,
Regarding to the Ry_new, I do not understand why do you multiply Rz^(-1). In my opinion, the new Ry can be obtained by rotating the Ry around the Z-axis.
Thank you!
Yang.
  5 Commenti
Yang Lu
Yang Lu il 28 Gen 2019
if rotate around the global Y, the Rnew = Ry*Rz and if rotate around the local Y, the Rnew is Rnew = Rz*Ry.
David Goodmanson
David Goodmanson il 29 Gen 2019
OK, to, start with, a vector has one index so it is going to transform like
vnew(i) = Sum{j} A(i,j)v(j)
for some A.
A matrix has two indices so under the usual assumptions involving transformations it is going to transform like
Mnew(i,j) = Sum{k,q} A(i,k)B(j,q)M(k,q)
for some A and B. WIth matrix multiplication convention you arrive at, for example
Rnew = Rz*R*Rz^(-1).
That's one argument.
Now suppose there is an arbitrary rotation about the x axis and a 90 degree rotation about the z axis:
Rx = [1 0 0;
0 c -s;
0 s c]
Rz = [0 -1 0;
1 0 0;
0 0 1]
Without getting entrapped in all the details, since the 90 deg z rotation swaps x and y (with a sign involved), using these two rotations one should be able to convert an x rotation into a y rotation.
However, doing what you propose,
Rz*Rx = [0 -c s;
1 0 0;
0 s c]
which is an orthogonal matrix as it must be, but not a useful rotation matrix. On the other hand if you work out Rz*Rrx*Rz^(-1) the result is
Rz*Rx*Rz^(-1) = [ c 0 s; = Ry
0 1 0
-s 0 c]
a

Accedi per commentare.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by