Updated.
This commit is contained in:
parent
0f573326bd
commit
e445814c18
BIN
h.png
BIN
h.png
Binary file not shown.
Before Width: | Height: | Size: 7.9 MiB After Width: | Height: | Size: 1.8 MiB |
21
src/main.rs
21
src/main.rs
@ -2,18 +2,18 @@ use image::{ImageBuffer, Rgb};
|
||||
use rayon::prelude::*;
|
||||
|
||||
// Image size.
|
||||
const IMGW: u32 = 2000;
|
||||
const IMGH: u32 = 2000;
|
||||
const IMGW: u32 = 1000;
|
||||
const IMGH: u32 = 1000;
|
||||
|
||||
// Fractal settings.
|
||||
const MAXITER: u32 = 512;
|
||||
const ESCRAD: f64 = 2.5;
|
||||
const MAXITER: u32 = 600;
|
||||
const ESCRAD: f64 = 2.4;
|
||||
|
||||
// Fractal bounds.
|
||||
const XMIN: f64 = -2.0;
|
||||
const XMAX: f64 = 2.0;
|
||||
const YMIN: f64 = -2.0;
|
||||
const YMAX: f64 = 2.0;
|
||||
const XMIN: f64 = 2.0;
|
||||
const XMAX: f64 = -2.0;
|
||||
const YMIN: f64 = 2.0;
|
||||
const YMAX: f64 = -2.0;
|
||||
|
||||
fn main() {
|
||||
let w = IMGW as f64;
|
||||
@ -22,11 +22,12 @@ fn main() {
|
||||
let pxs: Vec<u8> = (0..IMGH)
|
||||
.into_par_iter()
|
||||
.flat_map(|y| {
|
||||
let fy = y as f64;
|
||||
(0..IMGW)
|
||||
.into_par_iter()
|
||||
.flat_map(move |x| {
|
||||
let cx = map_range(x as f64, 0.0, w, XMIN, XMAX);
|
||||
let cy = map_range(y as f64, 0.0, h, YMIN, YMAX);
|
||||
let cy = map_range(fy, 0.0, h, YMIN, YMAX);
|
||||
let c = num_complex::Complex::new(cx, cy);
|
||||
|
||||
// Compute color for each pixel.
|
||||
@ -66,7 +67,7 @@ fn col_map(iter: u32) -> [u8; 3] {
|
||||
[0, 0, 0] // Black for points that never escape.
|
||||
} else {
|
||||
let t = iter as f64 / MAXITER as f64;
|
||||
let c = (8.5 * (1.0 - t) * (1.0 - t) * (1.0 - t) * t * 255.0) as u8;
|
||||
let c = (t * 700.0) as u8;
|
||||
[c, c, c]
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user