Re: [css3-3d-transforms] rotations, changes needed...

On Dec 7, 2011, at 5:36 PM, L. David Baron wrote:

> On Wednesday 2011-12-07 16:41 -0800, Chris Marrin wrote:
>> On Dec 1, 2011, at 1:39 PM, L. David Baron wrote:
>>> On Thursday 2011-12-01 13:24 -0800, Chris Marrin wrote:
>>>> On Nov 29, 2011, at 12:13 PM, Matt Woodrow wrote:
>>>>> This seems like the right interpretation to me, but I believe the matrix definition for rotate3d() in the spec needs to be updated to reflect this.
>>>> 
>>>> I'll look at it. What error(s) do you see?
>>> 
>>> Firefox implements the matrix definition of rotate3d that's given
>>> in the spec, and everyone seems to agree that rotates in the wrong
>>> direction.  Given that, I think the fix would be that all the terms
>>> with sin(angle) should have their sign reversed.
>> 
>> How do you mean it rotates in the wrong direction? rotate(45deg) and rotate3d(0,0,1, 45deg) both rotate in the same direction, right?
> 
> Everyone is saying they should.  But according to the spec they
> shouldn't, since:
>  rotate(45deg)
>   == (per SVG 1.1 explicitly, and also implicitly in CSS)
>  matrix(cos(45deg), sin(45deg), -sin(45deg), cos(45deg), 0, 0)
>   == (explicitly based on 3d-transforms)
>  matrix3d(cos(45deg), sin(45deg), 0, 0,
>           -sin(45deg), cos(45deg), 0, 0,
>           0, 0, 1, 0,
>           0, 0, 0, 1)
> 
> But according to css3-3d-transforms:
>  rotate3d(0, 0, 1, 45deg)
>   == (based on the definition of rotate3d())
>  matrix3d(1 + (1-cos(45deg))*(0*0-1), -1*sin(45deg)+(1-cos(45deg))*0*0, 0*sin(45deg)+(1-cos(45deg))*0*1, 0,
>           1*sin(45deg)+(1-cos(45deg))*0*0, 1 + (1-cos(45deg))*(0*0-1), -0*sin(45deg)+(1-cos(45deg))*0*1, 0,
>           -0*sin(45deg)+(1-cos(45deg))*0*1, 0*sin(45deg)+(1-cos(45deg))*0*1, 1 + (1-cos(45deg))*(1*1-1), 0,
>           0, 0, 0, 1)
>   == (reducing)
>  matrix3d(cos(45deg), -sin(45deg), 0, 0,
>           sin(45deg), cos(45deg), 0, 0,
>           0, 0, 1, 0,
>           0, 0, 0, 1)
> 
> So I think the signs of all the sin(angle) terms in the definition
> of rotate3d() need to be flipped, which is equivalent to transposing
> the matrix.
> 
> (I could certainly see ending up the wrong way by accident given
> confusion over which way matrix3d() describes a matrix and whether
> it's for row vectors or column vectors.)

Ok, I understand. This is probably due to the fact that a while back we changed from row to column major matrices and I failed to fix this formula. I'll fix it...

-----
~Chris
cmarrin@apple.com

Received on Thursday, 8 December 2011 23:55:02 UTC