2
\$\begingroup\$

I am currently learning about game engines, and for the engine math, there are functions called GetXAxis, GetYAxis, and GetZAxis that returned the X, Y and Z axes for a matrix. These functions return the x, y and z components of the first three rows of the 4x4 matrix as a normalized Vector3. The actual functions are simple enough, but I am having trouble conceptually understanding what exactly the axes of a matrix are. Are they the forward, left, and up vectors of a transformation?

\$\endgroup\$
1
  • \$\begingroup\$ You might find this write-up on matrix math useful here. It mainly talks about matrices using the opposite convention (where the columns form the basis vectors, rather than the rows), but the same ideas apply to your convention if you flip the matrix along its main diagonal. \$\endgroup\$
    – DMGregory
    Commented Sep 25, 2019 at 11:05

1 Answer 1

0
\$\begingroup\$

A matrix can be represented as a set of its basis vectors (that is local, X, Y and Z), so that if we have a matrix m with vectors represented as a, b and c, to transform vector v with matrix m, we need to sum multiplication product of each coordinate of a vector with the corresponding axis vector of the matrix:

transformed_v = m.a*v.x + m.b*v.y + m.c*v.z

2D graphical representation of the process is demonstrated here

enter image description here

\$\endgroup\$

You must log in to answer this question.

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