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?
\$\begingroup\$
\$\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
Add a comment
|
1 Answer
\$\begingroup\$
\$\endgroup\$
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