W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2011

[whatwg] context.arc and current point

From: Ian Hickson <ian@hixie.ch>
Date: Wed, 2 Mar 2011 00:23:44 +0000 (UTC)
Message-ID: <Pine.LNX.4.64.1103020019370.26730@ps20323.dreamhostps.com>
On Thu, 2 Dec 2010, Andrea Canciani wrote:
>
> What will be the current point after an arc with endAngle-startAngle > 
> 2pi?
> 
> The specification seems to say that the end point is defined to be the 
> point at endAngle, but the path is required to be exactly a circle.

The path is a circle but the end point is unaffected by this; it is 
defined as being endAngle aleng the circle's circumference, measured in 
radians clockwise from the positive x-axis.

So for example:

  c.beginPath();
  c.moveTo(20,20);
  c.arc(200, 200, 100, 0, 5*Math.PI, false);
  c.lineTo(380,380);
  c.stroke();

...draws a line from the top left, diagonally down to the right edge of a 
circle, and then draws a line from the left edge of that circle diagonally 
down to the bottom right.

HTH,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 1 March 2011 16:23:44 UTC

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