[Bf-committers] Change Representation and Initialisation of Matrices to Conform with Standard Notation
trumanblending at gmail.com
Fri Dec 9 12:37:13 CET 2011
I will try to explain better (this is a devilish topic). The problem here
is how matrices are accessed in Python and how the matrix product is
formed. The method of indexing matrices is shown in ,  and . This
method has the method of accessing matrices as
matrix[row_index][column_index], this is the method used in Python
currently. However, when the product of a matrix and vector is formed
according to normal matrix rules for a matrix times a column vector (see
 and ) the result is incorrect. Also see the patch tracker entry for
an example of how the matrix multiplication in Python is incorrect.
The reason that the multiplication is not being calculated correctly is
that the way matrices are printed an how they are stored is different.
Because of this in Python when we access matrix[i][j] element, we're
accessing element matrix[j][i] in C. Hence the product matrix*vector is
actually computed as matrix^T * vector of what is shown on screen. matrix^T
is the matrix transpose, i.e. rows/columns switched.
On Fri, Dec 9, 2011 at 9:01 PM, Ton Roosendaal <ton at blender.org> wrote:
> Hi Andrew,
> Can you provide evidence for who is spreading, supporting or enforcing
> this "Standard Notation"?
> Apart from that - especially when this standard appears disputable -
> we can much better ensure we are 100% clear about it in docs. Look at
> this wonderful Panda3d page:
> I rather see this approach for us!
> Ton Roosendaal Blender Foundation ton at blender.org www.blender.org
> Blender Institute Entrepotdok 57A 1018AD Amsterdam The Netherlands
> On 8 Dec, 2011, at 7:05, Andrew Hale wrote:
> > Hi All,
> > I have written a patch which rectifies a cause of confusion among
> > Blender
> > uses when starting out with matrices and vectors. The patch ensures
> > consistency between the matrix representation and matrix/vector
> > products so
> > that they behave in the way that people familiar with math expect.
> > This is
> > achieved by adjusting pythons access to the internal storage, while
> > keeping
> > the internal data the same. Note that this does not interfere with how
> > matrices are stored internally or how matrix products, additions etc
> > are
> > performed internally.
> > The patch can be found here:
> > with a more in depth explanation.
> > Thanks,
> > Andrew
> > _______________________________________________
> > Bf-committers mailing list
> > Bf-committers at blender.org
> > http://lists.blender.org/mailman/listinfo/bf-committers
> Bf-committers mailing list
> Bf-committers at blender.org
More information about the Bf-committers