From 3776192628c411c748cc5e69a05b1b33311e08f2 Mon Sep 17 00:00:00 2001 From: Lukas Jiriste Date: Fri, 19 Jan 2024 13:45:58 +0100 Subject: [PATCH] Hardcode threshold value for mandelbrot and tricorn --- fractals.c | 12 ++++++------ fractol.h | 3 +-- main.c | 5 ++--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/fractals.c b/fractals.c index 790fa35..3b04f84 100644 --- a/fractals.c +++ b/fractals.c @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/12/05 19:57:50 by ljiriste #+# #+# */ -/* Updated: 2024/01/19 11:30:08 by ljiriste ### ########.fr */ +/* Updated: 2024/01/19 13:43:01 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -39,12 +39,12 @@ double mandelbrot(t_set_man *settings, double x, double y) c.r = x; c.i = y; - count = 0; - z.r = 0; - z.i = 0; + count = 1; + z.r = x; + z.i = y; if (complex_norm(c) > 4) return (0); - while (complex_norm(z) < settings->threshold && count < settings->detail) + while (complex_norm(z) < 256 && count < settings->detail) { z = complex_add(complex_mul(z, z), c); ++count; @@ -67,7 +67,7 @@ double tricorn(t_set_man *settings, double x, double y) z.i = 0; if (complex_norm(c) > 4) return (0); - while (complex_norm(z) < settings->threshold && count < settings->detail) + while (complex_norm(z) < 256 && count < settings->detail) { z = complex_add(complex_mul(complex_conj(z), complex_conj(z)), c); ++count; diff --git a/fractol.h b/fractol.h index da1a029..1c8c791 100644 --- a/fractol.h +++ b/fractol.h @@ -6,7 +6,7 @@ /* By: ljiriste +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/11 18:51:29 by ljiriste #+# #+# */ -/* Updated: 2024/01/18 17:12:40 by ljiriste ### ########.fr */ +/* Updated: 2024/01/19 13:43:18 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -44,7 +44,6 @@ typedef struct s_view t_view; struct s_set_man { int detail; - int threshold; int color_stability; }; typedef struct s_set_man t_set_man; diff --git a/main.c b/main.c index f66669c..aca56f0 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/19 11:21:04 by ljiriste ### ########.fr */ +/* Updated: 2024/01/19 13:44:02 by ljiriste ### ########.fr */ /* */ /* ************************************************************************** */ @@ -276,8 +276,7 @@ void parse_args(int argc, char **argv, t_session *s) if (argc == 0) free(argv); s->set.man.detail = 1000; - s->set.man.threshold = 1000; - s->set.man.color_stability = 100; + s->set.man.color_stability = 1000; s->img.width = 1000; s->img.height = 1000; s->img.undersample_max = 5; -- 2.30.2