Skip to content

Commit

Permalink
style: rename constants
Browse files Browse the repository at this point in the history
  • Loading branch information
istudyatuni committed May 9, 2022
1 parent 5cf0773 commit aa262a7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ pub struct Mandelbrot {
pixels_count: usize,
}

/// modulo
const R: f64 = 2.0;
const ESCAPE_MODULUS: f64 = 2.0;
/// number of iterations
const N: u16 = 100;
const DEPTH: u16 = 100;
/// complex zero
const Z0: Complex<f64> = Complex::new(0.0, 0.0);

Expand Down Expand Up @@ -84,10 +83,10 @@ fn check_series(x: f64, i: f64) -> f32 {
let point = Complex::new(x, i);
let mut num = Z0 + point;

for step in 0..N {
if num.norm() >= R {
for step in 0..DEPTH {
if num.norm() >= ESCAPE_MODULUS {
// calculate percent of step
return step as f32 / N as f32;
return step as f32 / DEPTH as f32;
}

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

0 comments on commit aa262a7

Please sign in to comment.