Skip to content

Commit

Permalink
feat: add simple coloring
Browse files Browse the repository at this point in the history
  • Loading branch information
istudyatuni committed Apr 17, 2022
1 parent 0e36f7e commit 8e11775
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const N: i16 = 100;
const Z0: Complex<f64> = Complex::new(0.0, 0.0);

const IS_IN: u8 = 255;
const IS_NOT_IN: u8 = 0;

#[wasm_bindgen]
impl Mandelbrot {
Expand Down Expand Up @@ -88,9 +87,9 @@ fn check_series(x: f64, i: f64) -> u8 {
let point = Complex::new(x, i);
let mut num = Z0 + point;

for _ in 0..N {
for i in 0..N {
if num.norm() >= R as f64 {
return IS_NOT_IN;
return i as u8;
}

num = num.powu(2) + point;
Expand Down

0 comments on commit 8e11775

Please sign in to comment.