Compare commits

...

2 Commits
v0.3.0 ... main

  1. 1
      .gitignore
  2. 1
      README.md
  3. 7
      src/main.rs

1
.gitignore vendored

@ -2,3 +2,4 @@
/.idea
/release
mandelplot
mandelbrot.png

1
README.md

@ -18,6 +18,7 @@ OPTIONS:
- `-V, --version` => Print version information
- `-z --m_set_dimensions <m_set_dimensions>` => Set real and imaginary constraints (real_start,imaginary_startxreal_end,imaginary_end) [default: -2.5,-2.0x1.5,2.0]
## Naive benchmarks
Singe-threaded (19200x10800) (pre v0.2.0)

7
src/main.rs

@ -28,12 +28,13 @@ use num::Complex;
use std::sync::{Arc, Mutex};
/// z(n) = z(n-1)^2 + c
/// Returns amount of iterations to decide that z will escape to infinity
/// Returns amount of iterations that were necessary to decide that z escapes to infinity.
/// Returns None if z doesn`t escape to infinity even after specified number of iterations
fn mandelbrot(c: num::Complex<f64>, iterations: u32) -> Option<u32> {
let mut z: Complex<f64> = num::Complex::new(0.0, 0.0);
for i in 0..iterations {
for n in 0..iterations {
if z.norm_sqr() > 4.0 {
return Some(i);
return Some(n);
}
z = z * z + c;
}

Loading…
Cancel
Save