diff --git a/AddAndShift/circle.js b/AddAndShift/circle.js index 4572b00..d95d275 100644 --- a/AddAndShift/circle.js +++ b/AddAndShift/circle.js @@ -43,6 +43,10 @@ function drawCircle(canvas, xc, yc, r, ctx.fillStyle = "black"; const before = performance.now(); + // We'll need this later... Prepare arrays to receive sine and cosine values + // as side effects of drawing a circle + const sine = [], cosine = []; + for (let i = 0; i < loops; i++) { // This algorithm relies on the differential equation system for a circle. // From: @@ -61,10 +65,6 @@ function drawCircle(canvas, xc, yc, r, let n = 0; for (let twopown = 1; twopown < r; n++, twopown <<= 1); - // We'll need this later... Prepare arrays to receive sine and cosine values - // as side effects of drawing a circle - const sine = [], cosine = []; - // Now we can start from (r, 0) and apply the differential equations at each step let x = r << bdp, y = 0, t = 0; while (x >= y) { // We only need draw 1/8th of the circle, symmetries will do the rest