[whatwg] Canvas arc

Ian Hickson ian at hixie.ch
Thu Jan 31 16:35:06 PST 2008

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.   `._.-(,_..'--(,_..'`-.;.'

More information about the whatwg mailing list