I’m diving back in to what Matrix numbers mean. I have read 2 explanations for the scale component of transform matrix. Given the row-major (maya) matrix :
[ xx xy xz 0 ]
[ yx yy yz 0 ]
[ zx zy zz 0 ]
[ tx ty tz 1 ]
Explanation 1 :
Scale factor is the length of the X Y Z components of the 3x3 rotation sub matrix
Scale X = length [ xx xy xz ]
Scale Y = length [ yx yy yz ]
Scale Z = length [ zx zy zz ]
Explanation 2:
Scale factor is the diagonal elements of the 3x3 rotation sub matrix
Scale = [ xx yy zz ]
I suspect Explanation 1 is always correct,
and Explanation2 is only true with no rotation - when it’s a scale matrix only
In fact, here’s something to play around with to give you a better feel for things. I wrote it for a coworker of mine just last week to explain how matrices work. It’s a rig that directly builds a matrix in Maya. It just plugs the translation values of some objects directly into a fourByFourMatrix node.
You can grab the x, y, and z axes and move them around and see what it does.
Ah, yeah. My code works in python 3.9 and later. And I’m on Maya 2024 which is python 3.10.
Ugh. And apparently they had a proposal to add those “generic type annotations” to a __future__ import, but they delayed it. And it’s not like maya 2022 is gonna get any python updates
It’s probably better to just strip the types for maximum compatibility