0

Let's say that I have a 4x4 matrix like this:

a11 a12 a13 tx
a21 a22 a23 ty
a31 a32 a33 tz
a41 a42 a43 w

Is it true to say that the non rotated matrix is :

1 0 0 tx
0 1 0 ty
0 0 1 tz
0 0 0 w

?

genpfault
  • 51,148
  • 11
  • 85
  • 139
toto_tata
  • 14,526
  • 27
  • 108
  • 198
  • see [Understanding 4x4 homogenous transform matrices](https://stackoverflow.com/a/28084380/2521214) depending on your matrix properties and order it might and might not be true. the inner tope left corner 3x3 matrix is the orientation and skew and scale so for orthonormal matrices setting to unit matrix is enough. I would not change the other (7) elements at all as they are not just position but also projection. more safe is to have the X,Y,Z vectors the same size as the original rotated ones (to preserve scale) – Spektre Mar 14 '18 at 07:56

1 Answers1

1

In general, the statement is wrong. By removing the left 3 columns, also other effects than just the rotation are removed. For example, scaling factors as well as skewing is also stored in this region. Also, by maintaining the w value, the result could contain some other things than just translation.

If you assume that the original matrix was only composed by rotations and translations, then the assumption is true. Although in this case, removing only the upper 3x3 matrix would yield the same result since the last row will be [0, 0, 0, 1] anyway.

BDL
  • 21,052
  • 22
  • 49
  • 55
  • Thanks for this answer. How can I modify my matrix to remove its rotation ? I imagine that I have to multiply it by the reverse of its rotation matrix ? So how can I get its rotation matrix ? – toto_tata Mar 13 '18 at 17:28
  • 1
    Could you ask a new question for that and specify what your matrix contains? I'm not sure if there is a general solution for all kinds of matrices. If you only have a mixture of translate, rotate and scale, then there should be a solution (not sure for others). – BDL Mar 13 '18 at 17:33
  • Thanks. Here is the question ! https://stackoverflow.com/questions/49262739/opengl-how-to-remove-the-rotation-of-my-4x4-matrix :) – toto_tata Mar 13 '18 at 17:53