Re: [css3-2d-transforms] transform:matrix() questions

On 2/17/11 10:10 PM, David Singer wrote:
> I think it's more likely that we should have the equation (maybe we already do) that the point (x, y) is transformed into (x', y') by multiplying the vector (x, y, 1) with the matrix, i.e.
>
> x' = ax + by + c
> y' = dx + ey + f
>
> (if I have the order right, and if I don't, it's even more of a suggestion we should document it...)

The correct formulas are:

   x' = ax + cy + e
   y' = bx + dy + f

And yes, we should document this clearly.

We should also clarify the spec where it talks about how to handle 
'transform' values with multiple parts.  Right now the spec is at best 
vague and at worst self-contradictory.  Specifically, 
http://www.w3.org/TR/css3-2d-transforms/#transform-property says:

   The final transformation value for an element is obtained by
   performing a matrix concatenation of each entry in the list.

while http://www.w3.org/TR/css3-2d-transforms/#transform-functions says:

   The value of the transform property is a list of
   <transform-functions> applied in the order provided.

 From my testing, what Gecko and Webkit actually implement is the latter 
of these two spec quotes: the transformations are applied in the order 
provided.  Whether this matches the first quote depends on whether the 
reader reads "concatenation" as meaning "matrix multiplication", and if 
so whether the matrices are acting on the vectors from the right or from 
the left....  If they read it as being multiplication of left-acting 
matrices, then the transformation order is the opposite of the one the 
spec actually wants and what's implemented.

The simplest solution may be to take that first quoted bit out entirely; 
then we don't have to worry about matrix stuff except for matrix() 
itself, and that can be defined in terms of the explicit formula above.

-Boris

Received on Friday, 18 February 2011 04:22:01 UTC