aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJP Appel <jeanpierre.appel01@gmail.com>2024-04-20 02:26:05 -0400
committerJP Appel <jeanpierre.appel01@gmail.com>2024-04-20 02:26:05 -0400
commit74c1057a1cea4ec5fc3a8f338b24af553cc83399 (patch)
treefb75d0b1172eff3f59fdf0467a18637d760866c4
parent4e332fdfdccd7c617b0eba00e1da9886227eb485 (diff)
started work on julia set serial
-rw-r--r--src/mandelbrot.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mandelbrot.c b/src/mandelbrot.c
index f8e65f7..ee2585f 100644
--- a/src/mandelbrot.c
+++ b/src/mandelbrot.c
@@ -45,6 +45,23 @@ size_t multibrot(const double complex z0, const size_t max_iterations, const uin
}
/*
+ * 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
*/
double complex lattice_to_complex(const size_t index, const size_t x_res, const size_t y_res) {