diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2024-04-20 02:26:05 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2024-04-20 02:26:05 -0400 |
| commit | 74c1057a1cea4ec5fc3a8f338b24af553cc83399 (patch) | |
| tree | fb75d0b1172eff3f59fdf0467a18637d760866c4 /src/mandelbrot.c | |
| parent | 4e332fdfdccd7c617b0eba00e1da9886227eb485 (diff) | |
started work on julia set serial
Diffstat (limited to 'src/mandelbrot.c')
| -rw-r--r-- | src/mandelbrot.c | 17 |
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) { |
