0

This type of question has been asked before, but I haven't been able to find a satisfactory explanation. Perhaps I'm just a bit slow...

Say that I have a global right-handed coordinate system represented by X, Y, and Z. Say then that I have a rotated cube whose lower, left, back corner defines the origin of a new right-handed coordinate system and whose sides connecting to the origin define the X', Y', and Z' axes. Next we define the angle between X and X' as alpha, the angle between Y and Y' as beta, and the angle between Z and Z' as gamma.

I would like to be able to use rotation matrices and the angles alpha, beta, and gamma to define the coordinates of the rotated cube in the X, Y, and Z global coordinate system. These rotation matrices are given by:

Rx = [[1, 0, 0], [0, cos(alpha), -sin(alpha)], [0, sin(alpha), cos(alpha)]]

Ry = [[cos(beta), 0, sin(beta)], [0, 1, 0], [-sin(beta), 0, cos(beta)]]

Rz = [[cos(gamma), -sin(gamma), 0], [sin(gamma), cos(gamma), 0], [0, 0, 1]]

For example, a rotation about the z-axis for a vector X in R3 gives a new vector x by:

x = Rz * X

These rotation matrices work perfectly well and order of matrix multiplication does not matter when two of the three rotation angles are zero e.g. when alpha≠0 and beta=gamma=0 or beta≠0 and alpha=gamma=0 or gamma≠0 and alpha=beta=0. This is because when the rotation angle for a particular rotation matrix is equal to 0 the rotation matrix becomes the identity matrix.

The order of these matrices matters when more than one of the rotation angles are nonzero. My understanding is that for the following rotation:

x = Rz * Ry * Rx * X

represents a rotation about the x-axis, then a rotation about the new y-axis, and then a rotation about the new new z-axis.

Is there an order of these rotations that does what I would like? Or a relation in order to do so? In summary, I would like a relation to be able to rotate these based only on the angles between X' and X, Y' and Y, and Z' and Z.

  • Do you know coordinates of three vertices of cube (except `for lower, left, back corner`)? – MBo Jan 27 '21 at 06:40
  • 1. those angles are deltas to already rotated stuff from previous rotations and not actual angle between transformed and untransformed axises (that is true only for the first angle)!!! 2. The order can be any however the results too so first you need to either specify which order to use and use only it, or if you got some data encoded already and do not know which one it is then just try all combinations of order and angle directions until your data matches. [In case you got access to transform then you can infer the order like this](https://stackoverflow.com/a/56950130/2521214) ... – Spektre Jan 27 '21 at 08:46
  • Anyway I try to get rid of Euler angles if I can as they have many disadvantages, coumulative homogenuous transform matrix is much easier,more robust for many situations. – Spektre Jan 27 '21 at 08:48
  • If you know X,Y,Z and X',Y' and Z' you want direction cosines: http://www.starlino.com/dcm_tutorial.html – mikuszefski Jan 27 '21 at 08:51

0 Answers0