From ef620b222d8856cfe6d4e3e2c15ce504ba7f56ae Mon Sep 17 00:00:00 2001 From: Alexander Bass Date: Tue, 5 Jul 2022 01:31:56 -0400 Subject: [PATCH] remove unnecesary square root --- index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index abde81a..364f898 100644 --- a/index.js +++ b/index.js @@ -8,8 +8,6 @@ let width, height = 0; let view = [-0.75, 0]; let canvas, context, imagedata, viewWidth; - - // Event called every time the page loads or reloads window.onload = function() { canvas = document.getElementById("viewport"); @@ -99,11 +97,11 @@ function render() { } // Find the distance between the point on last iteration and origin - const distance = Math.sqrt(x2 * x2 + y2 * y2); + const distance = x2 * x2 + y2 * y2; // If distance from origin is greater than 2, will always expand to // infinity. In that case, end iteration. - if (distance > 2) { + if (distance > 4) { // This section colors in the point based entirely on the i value. // There is not a science to this, I just found some combinations