# Axis of affine transformation matrix

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.

• 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 – Blindman67 Oct 19 '16 at 12:27

$$\begin{bmatrix} ux & vx & nx & tx \\ uy & vy & ny & ty \\ uz & vz & nz & tz \\ 0 & 0 & 0 & 1 \end{bmatrix}$$
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>