Closed Bug 404221 Opened 18 years ago Closed 18 years ago

SVGMatrix multiply method (in JavaScript) has its arguments swapped.

Categories

(Core :: SVG, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: drj, Unassigned)

References

()

Details

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9b2pre) Gecko/2007111704 Minefield/3.0b2pre Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9b2pre) Gecko/2007111704 Minefield/3.0b2pre SVGMatrix from SVG, http://www.w3.org/TR/SVG11/coords.html#InterfaceSVGMatrix , has a multiply method. A.multiply(B) is supposed to computer A _post_-multiplied by B. In other words it is supposed to compute BA in conventional mathematical notation. Instead AB is computed. Reproducible: Always Steps to Reproduce: Here's some JavaScript that detects the bug: // truthy iff SVGMatrix.multiply is wrong (swopped). For example in // Firefox. matmulwrong = function() { var g = document.createElementNS('http://www.w3.org/2000/svg', 'g') g.setAttribute('transform', 'matrix(0 1 1 0 0 0) translate(1 0)') var l = g.transform.baseVal.getItem(0).matrix var r = g.transform.baseVal.getItem(1).matrix return r.multiply(l).e } Actual Results: matmulwrong() returns 1 Expected Results: matmulwrong() should return 0 Safari gets it right, Opera gets it wrong.
Component: General → SVG
Product: Firefox → Core
QA Contact: general → general
Various searching suggests that AB means is B pre-multiplied by A (or A is post-multiplied by B). e.g. http://mrl.nyu.edu/~perlin/courses/fall2003/hw/4.html or http://mrw.interscience.wiley.com/emrw/9780470011812/eob/article/b2a13039/current/html#b2a13039-sec1-0002 Suggesting to me that the gecko implementation is correct.
Not only do those comments suggest that, so does my friendly Cambridge Maths PhD. I defer and agree. Close the bug. I'll be opening one with Safari / WebKit. Sorry.
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.