- From: Philip Taylor <pjt47@cam.ac.uk>
- Date: Sun, 27 Apr 2008 02:19:46 +0100
- To: HTML WG <public-html@w3.org>

http://www.whatwg.org/specs/web-apps/current-work/multipage/section-the-canvas.html#arcx- says: "The points at startAngle and endAngle along the circle's circumference, measured in radians clockwise from the positive x-axis, are the start and end points respectively. The arc is the path along the circumference of this circle from the start point to the end point ... . Since the points are on the circle, as opposed to being simply angles from zero, the arc can never cover an angle greater than 2π radians. If the two angles are equal, or if the radius is zero, then the arc is defined as being of zero length in both directions." That definition would break either ctx.arc(x, y, 0, 2*Math.PI, true); or ctx.arc(x, y, 0, 2*Math.PI, false); since one of them would be drawn as very nearly zero length, depending on whether 2*Math.PI is <2π or >2π. People (at least me) expect both of those cases to draw an entire circle. Suggested replacement: "The points at startAngle and endAngle along the circle's circumference, measured in radians clockwise from the positive x-axis, are the start and end points respectively. If 'anticlockwise' is false and endAngle >= startAngle + 2π, or if 'anticlockwise' is true and startAngle >= endAngle + 2π, then the arc is the whole circumference of the circle. Otherwise, the arc is the path along the circumference of this circle from the start point to the end point ... [and the rest the same as before]" That works as expected in the (0, 2*Math.PI+/-epsilon) case, and is tolerant of errors in the angles (since a small change in the input won't cause a big change in the output). It matches the arcs drawn by Firefox and Safari, with the only difference being that it does no overdraw for >2π arcs (which is usually an invisible effect anyway). -- Philip Taylor pjt47@cam.ac.uk

Received on Sunday, 27 April 2008 01:20:19 UTC