- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Sun, 11 Nov 2012 08:03:46 -0800
- To: www-style@w3.org

On 11/11/12 12:56 AM, Simon Sapin wrote: > Le 11/11/2012 05:13, Rik Cabanier a écrit : >> It's always left to right so: >> >> accumulator = accumulator * to_matrix(function) > > Thanks for answering. For some reason I settled on the opposite in my code. That's because Rik is mostly wrong. ;) This whole thing is bit of a mess and continues to be in spite of repeated requests to fix it up. :( See http://lists.w3.org/Archives/Public/www-style/2011May/0633.html and http://lists.w3.org/Archives/Public/www-style/2011Feb/0531.html for some previous issues that were raised... Unfortunately, they were only partially addressed. http://dev.w3.org/csswg/css3-transforms/#mathematical-description now defines what matrix each transform function corresponds to, but not how to apply the matrix. Note that the matrices defined in this section will act as expected if they are treated as matrices acting on column vectors by left-multiplication. Rik is thinking of this in terms of what seems to be the usual graphics programming convention in which matrices act on row vectors by right-multiplication. So for _him_ the multiplication puts the new matrix to the right of the accumulator. If you're thinking of your matrices as acting on column vectors by left-multiplication, then your multiplication will need to put the new matrix to the left of the accumulator. These situations are completely equivalent (because just taking the transpose of everything will go between the two of them). The main places where confusion can arise are the definition of the "transformation matrix" and the actual definition of what matrices matrix() produces. The latter has been dealt with, but the former has not as you note. What I think we should do is define in section 21 that the matrices it defines act on the column vector [x,y,z,1] by left-multiplication. And then we should clarify section 6 by either describing what the multiplication order for the matrices is is or by saying that the transformations are applied in order from left to right and that the "transformation matrix" is the matrix of the resulting transformation. That avoids the problem, since transformation application, while non-commutative, does not have the issue of "well, but _how_ do I apply the transformation". >> Similar questions arise with nested "transformed" stacking contexts See links above. :( >> Is your confusion with preserver-3d or with regular 2d transforms? >> In the case of 2d, the outer transform happens first (= to the left) See, this is part of the problem. The way the spec is phrased right now, "first" is "to the _right_". And the fact that not everyone is on board with that is not helping. :( -Boris

Received on Sunday, 11 November 2012 16:04:15 UTC