Compare commits

..

No commits in common. 'main' and 'v0.3.0' have entirely different histories.
main ... v0.3.0

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

1
.gitignore vendored

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

1
README.md

@ -18,7 +18,6 @@ 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,13 +28,12 @@ use num::Complex;
use std::sync::{Arc, Mutex};
/// z(n) = z(n-1)^2 + c
/// 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
/// Returns amount of iterations to decide that z will escape to infinity
fn mandelbrot(c: num::Complex<f64>, iterations: u32) -> Option<u32> {
let mut z: Complex<f64> = num::Complex::new(0.0, 0.0);
for n in 0..iterations {
for i in 0..iterations {
if z.norm_sqr() > 4.0 {
return Some(n);
return Some(i);
}
z = z * z + c;
}

Loading…
Cancel
Save