Transformation matrices in Blender (skip if you want)
Transformation matrices in Blender are by design limited to a certain type of 4x4-matrix that is less general than just any old invertible matrix. For example, shear operations are not possible. Blender's transformation matrices are precisely the matrices that satisfy the following conditions, I think:
- The first three columns are mutually perpendicular and end in a 0.
- The last column is of the form (a,b,c,1) where (a,b,c) represents a translation.
(I'm using the convention that a transformation matrix M is applied to column vectors v as M*v, as is usual in mathematics.)
Suppose that M is the transformation matrix of a Blender object (and therefore satisfied the conditions above). I now apply a scaling of factor 3 along the global x-axis. How is the resulting transformation matrix calculated?
One would naively expect that the first row of M just gets multiplied by 3. (As opposed to scaling by 3 along the local x-axis, in which case the first column of M gets multiplied by 3.) But this is not what happens, as the resulting matrix would not satisfy the first condition above anymore. Instead, all of the columns of M get rescaled in some way.
How is the transformation matrix of an object changed when I scale along the global x-axis?
Start with the default cube. Rotate it by 30 degrees along the y-axis (ry30Enter). Now rescale by 3 in the x-direction (sx3Enter). The object gets rescaled by 2.646 in its local x-direction and by 1.732 in the local z-direction. Where do these numbers come from? (They seem to equal sqrt(7) and sqrt(3), respectively. So their squares sum to 1+3^2, which is probably relevant.)
If we rescale along a global axis by a factor x, and this results in rescaling along the local axes by factors (a,b,c), then we always have a^2+b^2+c^2 = x^2+1^2+1^2.
Also, rescaling along global x by 3 twice is not the same thing as rescaling along global x by 9.
Note: I don't need an explanation of the mathematics behind transformations, matrices or quaternions. I'm familiar with those.