0
\$\begingroup\$

Let's say I have a right handed column major 4x4 transformation matrix. Can I safely assume (even though there exist non uniform scale) that first column is X axis vector, second column is Y axis vector and third column is Z axis vector?

$$ \begin{bmatrix} Xx & Yx & Zx & 0 \\ Xy & Yy & Zy & 0 \\ Xz & Yz & Zz & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} $$

Iis the above layout correct? By the way I am using glm and I don't know if there is a function to extract these axis.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Thought it was rows that held the axis. For X,Y,Z axis on rows 0,1,2. But it makes no difference as long as the vectors are in the appropriate direction, If transform matrix axis are along rows then a vector is a column and if axis a column then vectors are a row \$\endgroup\$
    – Blindman67
    Oct 19, 2016 at 12:27

1 Answer 1

0
\$\begingroup\$

Yes, in GLM it is laid out as such:

$$ \begin{bmatrix} ux & vx & nx & tx \\ uy & vy & ny & ty \\ uz & vz & nz & tz \\ 0 & 0 & 0 & 1 \end{bmatrix} $$

Where the vector t is translation, and the top-left 3x3 matrix is rotation.

You can also use the GLM method decompose(...).

Note that the documentation is outdated - you need to include <glm/gtx/matrix_decompose.hpp> instead of <glm/gtx/decomposition.hpp>

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .