how to rotate coordiante system about Z axis first then rotate about about the new Y axis.
17 views (last 30 days)
Show older comments
Yang Lu
on 13 Aug 2018
Commented: David Goodmanson
on 28 Jun 2019
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?
1 Comment
KSSV
on 13 Aug 2018
Have a look on Affine transformations. You can frame your Rotation matrices and get what you want.
Accepted Answer
David Goodmanson
on 19 Aug 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 Comments
James Tursa
on 28 Jan 2019
Edited: James Tursa
on 28 Jan 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
on 28 Jun 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.
More Answers (1)
Yang Lu
on 28 Jan 2019
5 Comments
David Goodmanson
on 29 Jan 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
See Also
Categories
Find more on Array Geometries and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!