W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2008

[whatwg] Canvas arc

From: Ian Hickson <ian@hixie.ch>
Date: Fri, 1 Feb 2008 00:35:06 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0802010012230.3212@hixie.dreamhostps.com>
On Tue, 3 Jul 2007, Philip Taylor wrote:
> For the 'arc' function:
> What if startAngle = endAngle?

Now defined as zero length arc.

> What if endAngle > 2? + startAngle? (The endAngle = 2? + startAngle case 
> isn't interesting since floating-point imprecision means it will never 
> occur.)

According to the spec, nothing special happens. The points are defined as 
being on the circle, so 3pi = 1pi, as far as where the point is. 
Clarified, though.

> So, for FF/Safari: When startAngle -> endAngle is in the opposite 
> direction to the (anti)clockwise flag, the two angles are treated modulo 
> 2? and the arc is drawn between them in the appropriate direction. When 
> it's the same direction as the (anti)clockwise flag, Safari extends the 
> path all the way from startAngle to endAngle (going round the whole 
> circle multiple times if necessary), and Firefox does the same except it 
> skips all but the first full going-round-the-whole-circle bit (so it 
> goes round 1 <= n < 2 times, if abs(startAngle-endAngle) > 2?).
> It seems sensible to adopt either Firefox's or Safari's approach (which 
> differ only in the amount of overdraw). It's probably easier to use 
> Firefox's, so then Safari would just have to mod the angles a little 
> before drawing them, because I can't see any other reason to choose one 
> approach over the other, and I can't see any reason to choose a totally 
> different approach.

Well, having the arc overlap itself seems dumb... :-)

> Talking about arcs is confusing when the arc is more than a full
> circle and wraps around itself and isn't really a mathematical arc any
> more, so I think it's necessary to not define the operation in terms
> of arcs.

That's another reason not to do this. :-)

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Thursday, 31 January 2008 16:35:06 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:00 UTC