remove unnecesary square root

This commit is contained in:
Alexander Bass 2022-07-05 01:31:56 -04:00
parent 076dfa1b72
commit ef620b222d

View file

@ -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