Maya's composite matrix

I’m trying to wrap my head around the composite matrix that gets returned when you use the -matrix flag with xform. I have a pretty good understanding of what the first three components of what each row are. If I’m correct, then they are the 3d vectors for each of the x,y and z axis. I’m not as confident about what the fourth element is in each of the rows. Is the fourth element in each row the quaternion w? If so, what about the last element, whose row deals with position? It shouldn’t have a [w] element because it is only dealing with position.

|(+x[x]) (+x[y]) (+x[z]) (+x[w]) | <== +x axis quaternion?
|(+y[x]) (+y[y]) (+y[z]) (+y[w]) | <== +y axis quaternion?
|(+z[x]) (+z[y]) (+z[z]) (+z[w]) | <== +z axis quaternion?
|(pos.x) (pos.y) (pos.z) (?) | <== position coordinates x, y,z, (?)

Does anyone know what the 16th element represents? Am I correct about the w in each row? Thanks!

I am not a great mathematician but from experience I know that you shouldn’t be bothered with the fourth elements as far as transforming objects goes. You are correct, the rows represent vectors that are the rotation axes of the transform. The length of those vectors represents the scaling in their respective axis. And the last row is the position of the object. When you composite a matrix using pymel you can totally ignore the fourth elements and initialize the class using four arrays with three members. It just sets the last column as 0001.

You’re almost right about the upper-left 9 units in the matrix: they are the vectors for the x, y and z of the matrix’s local coord sys. The bottom 3 are the translation.

The fourth column is the ‘homogeneous coordinate’. It’s not a quaternion W. The homogeneous coordinate makes the math work equally well for points and vectors. It doesn’t have an obvious physical meaning, unfortunately, but it there to support things like non-uniform scales (if you look at a sheared matrix it won’t be all 0s)

One of the useful properties is that the W component lets you distinguish between points (position in space) and a vector (a space delta which doesn’t correspond to a location) If you multiply a point by a matrix you get the translation of the point; if you multiply a vector you get a rotated or scaled vector but it doesn’t move. Under the hood the point multiplication is

(x,y,z,1) * matrix

while a vector is (x,y,z,0) * matrix;

More gnarly detail here

or

http://antongerdelan.net/opengl/vectorsandmatrices.html

So it indicates whether it is a point (w=1) or a vector (w=0). Very helpful! Thank you Theodox and Raziel!