remove unnecesary square root
This commit is contained in:
parent
076dfa1b72
commit
ef620b222d
6
index.js
6
index.js
|
@ -8,8 +8,6 @@ let width, height = 0;
|
||||||
let view = [-0.75, 0];
|
let view = [-0.75, 0];
|
||||||
let canvas, context, imagedata, viewWidth;
|
let canvas, context, imagedata, viewWidth;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Event called every time the page loads or reloads
|
// Event called every time the page loads or reloads
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
canvas = document.getElementById("viewport");
|
canvas = document.getElementById("viewport");
|
||||||
|
@ -99,11 +97,11 @@ function render() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the distance between the point on last iteration and origin
|
// 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
|
// If distance from origin is greater than 2, will always expand to
|
||||||
// infinity. In that case, end iteration.
|
// infinity. In that case, end iteration.
|
||||||
if (distance > 2) {
|
if (distance > 4) {
|
||||||
|
|
||||||
// This section colors in the point based entirely on the i value.
|
// This section colors in the point based entirely on the i value.
|
||||||
// There is not a science to this, I just found some combinations
|
// There is not a science to this, I just found some combinations
|
||||||
|
|
Loading…
Reference in a new issue