Re: [css3-images] Helping implementers with math

Le 18/06/2013 17:58, Boris Zbarsky a écrit :
> On 6/18/13 12:54 PM, Boris Zbarsky wrote:
>> On 6/18/13 12:46 PM, Simon Sapin wrote:
>>>       <code>abs(W * sin(A)) + abs(H * cos(A))</code>
>>
>> I feel like I must be missing something, since it looks to me like for A
>> == 0 the correct answer for "half the size of the gradient line" is H/2...
> Ah, I think you just gave the formula for the size of the gradient line,
> not for half of it.

You’re right of course. I missed a "/ 2" I have further down in my code. 
Corrected note to add to the spec:

     Given:

     * <var>A</var> the angle (in any quadrant) defining the gradient
line’s direction such that 0 degrees points upwards and positive angles
represent clockwise rotation,
     * <var>W</var> the width of the gradient box,
     * <var>H</var> the height of the gradient box,

     The size of the gradient line (between the starting and ending 
point) is:

     <code>abs(W * sin(A)) + abs(H * cos(A))</code>

-- 
Simon Sapin

Received on Tuesday, 18 June 2013 17:10:07 UTC