I am needing to scale/rotate some uvmapping and not sure how to use some of the functions.
A point can be transformed by a matrix.
myPointA * (matrix) = myPointB
The type of matrix you multiply by will do different things to PointA. So the trick is to construct an appropriate scaling, rotation, transformation, etc. matrix to multiply by.
A single matrix can be constructed by muliplying matrices together.
ScaleMatrix * RotationMatrix * TransformationMatrix = C PointA * C = PointB
So to scale a point you first construct a Scaling matrix. This is done by
Mathutils.ScaleMatrix(scaling_factor, matrix_size, (optional)abitrary_axis)
scaling_factor = the scaling amout
matrix_size = the size of the square matrix to return (2,3,4)
abitrary_axis = an optional parameter to scale along an abitrary axis (like a shear really)
If i remember correctly in this equation:
A * B = C
where A, B is either matrix/vector or vector/matrix
the # of columns in A must equal the # of rows in B
[x,x,x] * [x,x,x] = 3 columns A * 3 rows in B [x,x,x] [x,x,x]
This is the reason for the matrix_size. If you are scaling a 2D coordinate you need a 2x2 matrix to scale it.
scaleMatrix = Mathutils.ScaleMatrix(2,3) myPoint = Mathutils.Vector([1,2,3]) transformedPoint = Mathutils.VecMultMat(myPoint ,scaleMatrix) print myPoint print transformedPoint
the output should read: