Understanding the transform matrix
Three-dimensional transforms of Location, Rotation, and Scale are stored together inside a matrix. Matrices are, at large, tables of numbers arranged in rows and columns. Transformation matrices are combined using linear algebra. We will not go into the details here; we will just have a quick look at what a matrix means and how we can use it in our scripts.
Like with other representations, Blender provides a Matrix
class in the mathutils
module:
>>> from mathutils import Matrix >>> Matrix() Matrix(((1.0, 0.0, 0.0, 0.0), (0.0, 1.0, 0.0, 0.0), (0.0, 0.0, 1.0, 0.0), (0.0, 0.0, 0.0, 1.0)))
A matrix containing these default values, 1.0
in its diagonal entries and 0.0
everywhere else, represents the rest state. In other words, an object associated with this matrix was not moved, rotated...