a better circle function

Here's a challenge for you - can you create circle(diameter)?

The picture shows my comparing circle(100) to polygon(360,1).

Click here to reveal my answer.

function circle(diameter=100) {
  var circumference=Math.PI*diameter;
  var d=circumference/360;
  polygon(360,d);
}
function test() {
  polygon(360,1);
  circle();
}
so now you should be able to produce this:

A reminder that the canvas is 800 steps wide.


Click here to reveal my answer.

function test() {
  for (var i=0;i<10;i++) {
    circle(300); rt(36);
  }
}