From 00b488b32fa5e40151bf63443821c5b3c1840217 Mon Sep 17 00:00:00 2001 From: JP Appel Date: Sun, 21 Apr 2024 02:14:27 -0400 Subject: implemented julia sets --- src/serial-fractals.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/serial-fractals.c') diff --git a/src/serial-fractals.c b/src/serial-fractals.c index 718fccb..fe420d6 100644 --- a/src/serial-fractals.c +++ b/src/serial-fractals.c @@ -59,10 +59,10 @@ void multibrot_grid(grid_t* grid, const size_t max_iterations, const double d){ /* * Computes ????? for a julia set * implementation of https://en.wikipedia.org/wiki/Julia_set#Pseudocode + * + * This behaves weirdly, needs a very small number of iterations to be visibile */ -size_t julia(const double R, const long double complex z0, const long double complex c, const size_t max_iterations){ - //FIXME: I'm notsure if this is currently implemented correctly - if(R*R - R >= cabsl(z0)) return 0; +size_t julia(const long double complex z0, const long double complex c, const size_t max_iterations, const double R){ long double complex z = z0; size_t iteration = 0; @@ -73,3 +73,10 @@ size_t julia(const double R, const long double complex z0, const long double com return iteration; } +void julia_grid(grid_t* grid, const size_t max_iterations, const long double complex c, const double R){ + const size_t size = grid->size; + size_t* data = grid->data; + for(size_t i = 0; i