W3C home > Mailing lists > Public > www-style@w3.org > June 2013

Re: [css3-images] Helping implementers with math

From: Simon Sapin <simon.sapin@exyr.org>
Date: Tue, 18 Jun 2013 18:09:47 +0100
Message-ID: <51C0945B.704@exyr.org>
To: www-style@w3.org
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

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:12 UTC