# [Webkit-unassigned] [Bug 16062] SVGMatrix multiply method is wrong way around

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Nov 23 00:33:03 PST 2007

http://bugs.webkit.org/show_bug.cgi?id=16062

------- Comment #7 from drj at pobox.com  2007-11-23 00:33 PDT -------
> I think it's just that AffineTransform has got it wrong. I'm seeing the same
> problem with CSS transforms.

I think it's just that SVG/CSS use column vectors, and CG/AffineTransform uses
row vectors.

As far as I can tell AffineTransform has it right.

As you know matrices operate on vectors and can be considered as linear
transformations in a vector space.  But it matters whether you talk about row
vectors or column vectors.

A matrix M operates on a column vector v by acting on the left, we form the
product Mv.  A matrix operates on a row vector by acting on the right: vM.

Essentially CG operates in a "transpose world" compared to SVG.  So instead of
doing the operating Mv, in CG we do (v^T)(M^T) where (@^T) denote transpose.
That's why Eric notes in comment 3 that CG and SVG use different matrix layouts
(they are transposes of each).

Essentially when SVG asks for a vector transformation Mv, what you actually
perform in CG is ((v^T)(M^T))^T.  The transposition comes "for free" as you
write the entries into the vector and matrix and read the result out.

This is no trouble until you need to multiply matrices.  If SVG asks you to
compute ABv then in transpose world you need to compute (v^T)(B^T)(A^T) because
(AB)^T = (B^T)(A^T).

--
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.