Blender Git Loki

Git Commits -> Revision 0ab2f67

Revision 0ab2f67 by Benoit Bolsee (master)
September 7, 2009, 22:26 (GMT)
Fix bug in Mathutil with matrix/matrix and matrix/vector multiplication order.

MathUtil matrix type follows Blender convention of column
major storage. This means that the elements on one column
are contiguous in memory. Vectors are one dimensional
arrays that can be considered in row or in column but
the Blender convention is column so vector should only
be considered as row. This means that the only logical
multiplication operation between matrix and vector is
matrix * vector.

This convention is respected in all parts of MathUtil
except in matrix/matrix and matrix/vector multiplication
where the row major convention is assumed, which in the
and is equivalent to reversing the order of multiplication.

This is clearly a bug and must be corrected but the side
effect is that it will break all scripts using these
operations. Script writers who care about the correctness
of the matrix operations have already implemented work around:

1) change order of matrix/vector multiplication.
vec2 = vec1 * mat1

This must be changed to the normal order:
vec2 = mat1 * vec1

2) change order of matrix/matrix multiplication
(with matl a local transform in matw reference)
mat3 = matl * matw

This must be changed to the normal order:
mat3 = matw * matl

3) transpose before an after the multiplication
matl.transpose()
matw.transpose()
mat3 = matw * matl
mat3.transpose()

This must be changed to:
mat3 = matw * matl;

Commit Details:

Full Hash: 0ab2f675c364f2ca1212b0453bf2ffdce5ebb9ea
SVN Revision: 23052
Parent Commit: 01eaf4f
Lines Changed: +23, -22

2 Modified Paths:

/source/blender/python/generic/matrix.c (+15, -14) (Diff)
/source/blender/python/generic/vector.c (+8, -8) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021