From 74c1057a1cea4ec5fc3a8f338b24af553cc83399 Mon Sep 17 00:00:00 2001 From: JP Appel Date: Sat, 20 Apr 2024 02:26:05 -0400 Subject: started work on julia set serial --- src/mandelbrot.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/mandelbrot.c b/src/mandelbrot.c index f8e65f7..ee2585f 100644 --- a/src/mandelbrot.c +++ b/src/mandelbrot.c @@ -44,6 +44,23 @@ size_t multibrot(const double complex z0, const size_t max_iterations, const uin return iteration; } +/* + * Computes ????? for a julia set + * implementation of https://en.wikipedia.org/wiki/Julia_set#Pseudocode + */ +size_t julia(const double R, const double complex z0, const double complex c, const size_t max_iterations){ + //FIXME: I'm notsure if this is currently implemented correctly + if(R*R - R >= cabs(z0)) return 0; + double complex z = z0; + + size_t iteration = 0; + while(cabs(z) < R && iteration < max_iterations){ + z = z * z + c; + iteration++; + } + return iteration; +} + /* * Converts a grid point into an complex number */ -- cgit v1.2.3