wooo it works

This commit is contained in:
nora 2022-01-10 21:58:41 +01:00
parent c03b0c399a
commit 647e8c69e0
5 changed files with 30 additions and 33 deletions

View file

@ -47,6 +47,7 @@ pub unsafe fn mandelbrot(
let idx = thread::index_2d();
if idx.x >= width || idx.y >= height {
return;
}
@ -61,12 +62,12 @@ fn check_part_of_mandelbrot(cfg: Cfg, id: Vec2<u32>) -> u32 {
let x_step_size = (cfg.end.real - cfg.start.real) / cfg.width as f64;
let y_step_size = (cfg.end.imag - cfg.start.imag) / cfg.height as f64;
let x = x_step_size * id.x as f64;
let y = y_step_size * id.y as f64;
let x_offset = x_step_size * id.x as f64;
let y_offset = y_step_size * id.y as f64;
let sample_pos = CNumber {
real: cfg.start.real + x,
imag: cfg.start.imag + y,
real: cfg.start.real + x_offset,
imag: cfg.start.imag + y_offset,
};
check_mandelbrot(sample_pos, cfg.iterations, cfg.threshold)