>>> from mathutils import Vector, Matrix
Matrix((1.0, 2.0, 0.0),
(0.0, 3.0, 0.0),
(0.0, 0.0, 4.0))
Vector((1.0, 2.0, 3.0))
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
TypeError: Matrix multiplication: not supported between 'mathutils.Matrix' and 'mathutils.Vector' types
huh?!? . This was ok in 2.54. Seems we can now only do backwards algebra, enforcing Vectors to be strictly row-vectors:
Vector((1.0, 8.0, 12.0))
Yet this syntax is still interpreted as a dot product:
Why cripple right-multiplication?
this is not so special!
The limitation is more to make clear what actions are taken.
to modify a Vector in blender, the vector is the 3d-location
and there is only the way to rotate, translate, scale … using a matrix
for this is then only:
vector * matrix
and not the permute. Think about the result has to be used in blender
and the permute multiplication is not to be used as a 3d-coord.
For matrix-multiplications the order is crucial, a permutation has different results.
In blender-2.4x the permutation made different results always as an vector,
but compared to “numpy” etc. there is a “big” difference doing permutation in matrix multiplications.
correct me if i am wrong …
test-dr: I entirely agree with you. Its just about conventions and syntactic sugar really.
Most algebra books will give matrix multiplication to the right: Mv, this is because the vectors are considered column-vectors by default. Maybe this convention is different in graphics software circles. There is nothing wrong with taking the transpose of that equation: vN, where now the vector is a row-vector, and N is the transpose of M - these are identical equations.
Previously both forms where possible and the orientation of the vector was taken by context. In nicely designed software this is usually the case, or else the vectors can be both in row and column form (i.e. you can take a transpose of a vector). It’s just annoying to have one form suddenly disabled. It broke my code for example and I have to go through and take the transpose of all my equations. Multiple coordinate transformations are finicky enough without bringing in changing notation conventions.
the “vector” in blender
is a row
and the objects-location (etc.) too.
In “mathematics” the vector is normaly a column-like thing
if using numpy (from python)
there is no such thing like a vector,
its only a matrix - and this kind of matrix is not possible in blenders mathutils.
With numpy matrix one uses the transpose
to switch the “vector-representation” from row to column …
A row-matrix in numpy: v = matrix([1,2,3])
can only do:
v * Matrix
and will show an error too for
Matrix * v
but not for:
Matrix * v.T
v.T =… [,,] … a column-like vector
The Matrix multiplication is change from old 2.7 A.P.I. to 2.8 A.P.I.: