[Bf-committers] matrix multiplication in Blender SVN of this morning (W32 Vista mingw compiled)

Paul Melis paul.melis at sara.nl
Wed Jul 27 15:05:22 CEST 2011


Just chiming in here....

On 07/27/2011 12:47 PM, Benoit Bolsee wrote:
> Hi, I repeat once more: mathutils matrices are COLUMN-MAJOR. This means
> that the top elements in the definition list are columns, not rows,
> despite the fact that they are printed horizontaly. 
> [...]
> Mathutils matrices are column-major because that's how Blender stores
> the matrices internal, and Blender uses that convention because openGL
> uses it.

Why would the textual (or any higher-level representation) have to
follow the storage layout?

For me those are two distinct concepts and it would be the least
confusing to have the matrix representation follow the regular math
convention. E.g.
http://www.opengl.org/sdk/docs/man/xhtml/glLoadMatrix.xml shows
multiplication with a matrix m being loaded as

       / m[0]  m[4]  m[8]   m[12] \   / v[0] \
M(v) = | m[1]  m[5]  m[9]   m[13] | x | v[1] |
       | m[2]  m[6]  m[10]  m[14] |   | v[2] |
       \ m[3]  m[7]  m[11]  m[15] /   \ v[3] /

even though the actual storage order of the matrix is obviously
column-major.

Secondly, when creating a matrix with Matrix([e1, e2, e3, e4]) I was
very surprised to see that the e_i represent columns! Again, this is the
storage layout coming through on a higher level, which is confusing.

Anyways, just my 2 cents.

Regards,
Paul


More information about the Bf-committers mailing list