From: Lukas Jiriste Date: Wed, 17 Jan 2024 09:34:55 +0000 (+0100) Subject: Add check to mandelbrot to for visual correctness X-Git-Url: https://git.ljiriste.work/?a=commitdiff_plain;h=fe5637a5d6e2c2f0283ee3fb31a92a641386d1df;p=42%2Ffract-ol.git Add check to mandelbrot to for visual correctness Coordinates too far from the fractal had incorrect color. --- diff --git a/main.c b/main.c index 4de9972..f397d53 100644 --- a/main.c +++ b/main.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/10/27 14:29:26 by ljiriste #+# #+# */ -/* Updated: 2024/01/16 14:31:25 by ljiriste ### ########.fr */ +/* Updated: 2024/01/17 10:29:34 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -79,6 +79,8 @@ double mandelbrot(double x, double y, double resolution) count = 0; z.r = 0; z.i = 0; + if (complex_norm(c) > 4) + return (0.01); while (complex_norm(z) < threshold && count < 100 * resolution) { z = complex_add(complex_mul(z, z), c);