W3C home > Mailing lists > Public > www-svg@w3.org > November 2007

Re: The trouble with matrix multiplication code monk

From: Chris Lilley <chris@w3.org>
Date: Thu, 29 Nov 2007 23:39:27 +0100
Message-ID: <0807406.20071129233927@w3.org>
To: Karl Dubost <karl@w3.org>
Cc: www-svg@w3.org

On Wednesday, November 21, 2007, 11:51:36 AM, Karl wrote:

KD> For Information

KD>      The trouble with matrix multiplication
KD> 2007-11-19

KD> is that it?s not commutative. That means that when the SVG spec says  
KD> in the documentation for the multiply method in the SVGMatrix DOM  
KD> ?this matrix is post-multiplied by another matrix? it really does  
KD> matter which way round you do the multiplication of the two matrices.

Yes, it does matter (scale and then shift is not the same as shift and then scale). 

However, I don't read the commenter as complaining, but praising the SVG spec for specifying which way round the multiplication goes.

That is why instead of saying just "multiplied" we say "pre-multiplied" or "post-multiplied" as appropriate.

KD> In the call A.multiply(B), A is this and should be post-multiplied  
KD> by B. In the usual mathematical convention the result should be AB.

KD> Safari computes BA, Firefox computes AB. Oopsy.

I find it surprising that the Safari DOM call does pre-multiply; they seem to have the rest of the transformations correct when SVG code has nested transformations. However its listed as a known bug

The comments on that bug indicate that the issue arose because of two mathematical notations for writing matrices - row vectors and column vectors. They seem to have worked out what went wrong and what to change so that the library they are using gets called correctly.

KD>      -- The trouble with matrix multiplication  code monk
KD> http://drj11.wordpress.com/2007/11/19/the-trouble-with-matrix-multiplication/
KD>      Wed, 21 Nov 2007 10:50:19 GMT

 Chris Lilley                    mailto:chris@w3.org
 Interaction Domain Leader
 Co-Chair, W3C SVG Working Group
 W3C Graphics Activity Lead
 Co-Chair, W3C Hypertext CG
Received on Thursday, 29 November 2007 22:39:36 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:12 UTC