- From: Ian Hickson <ian@hixie.ch>
- Date: Fri, 13 Jun 2008 01:39:46 +0000 (UTC)
- To: Philip Taylor <pjt47@cam.ac.uk>
- Cc: HTML WG <public-html@w3.org>
- Message-ID: <Pine.LNX.4.62.0806122310400.8559@hixie.dreamhostps.com>
On Sun, 27 Apr 2008, Philip Taylor wrote: > > http://www.whatwg.org/specs/web-apps/current-work/multipage/section-the-canvas.html#arcx- > says: > > "[...] 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: > > "[...] 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). I used a different solution that should have the same effect. Let me know if I misunderstood what I was doing here. On Sun, 27 Apr 2008, Philip Taylor wrote: > > The behaviour of arcTo is undefined for radius=0. (In particular, "let > The Arc be the shortest arc given by circumference of the circle that > has radius radius, and that has one point tangent to [some line], and > that has a different point tangent to [some other line]" is impossible > to satisfy, since there aren't two different points on the circle.) > > Suggested fix: Alter "If the point (x0, y0) is equal to the point (x1, > y1), or if the point (x1, y1) is equal to the point (x2, y2), then the > method must add the point (x1, y1) to the subpath, and connect that > point to the previous point (x0, y0) by a straight line." to include > "... or if radius is 0". > > "if the direction from (x0, y0) to (x1, y1) is the same as the direction > from (x1, y1) to (x2, y2), then method must add the point (x1, y1) to > the subpath" - s/then/then the/ Fixed and fixed. -- Ian Hickson U+1047E )\._.,--....,'``. fL http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 13 June 2008 01:40:29 UTC