diff options
| author | JP Appel <jeanpierre.appel01@gmail.com> | 2024-04-20 03:02:53 -0400 |
|---|---|---|
| committer | JP Appel <jeanpierre.appel01@gmail.com> | 2024-04-20 03:02:53 -0400 |
| commit | c4a156a82960e1e5f9c36c8061ffc0c981c1a56e (patch) | |
| tree | 98426e405075c105360712ac028e9652af87c1c7 | |
| parent | 627f4641269d273f3bbf76e679381924115aaf16 (diff) | |
started work on fill grid func
| -rw-r--r-- | src/serial-fractals.c | 18 | ||||
| -rw-r--r-- | src/shared-fractals.c | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/serial-fractals.c b/src/serial-fractals.c index c5b9c4e..55cd431 100644 --- a/src/serial-fractals.c +++ b/src/serial-fractals.c @@ -1,4 +1,6 @@ #include "fractals.h" +#include "grids.h" +#include "util.h" /* * Computes the number of iterations it takes for a point z0 to diverge * if the return value is equal to max_iterations, the point lies within the mandelbrot set @@ -16,6 +18,22 @@ size_t mandelbrot(const double complex z0, const size_t max_iterations) { } /* + * Fills a grid with the a complex sit + */ +void mandelbrot_grid(grid_t* grid, vec2 resolution, const size_t iterations){ + if(!grid || !grid->data) return; + const size_t size = grid->size; + + set_grid(grid, 0); //unnecessary step + + + size_t* data = grid->data; + for(size_t i = 0; i < size; i++){ + data[i] = mandelbrot(lattice_to_complex(i, resolution), iterations); + } +} + +/* * Computes the number of iterations it takes for a point z0 to diverge * if the return value is equal to max_iterations, the point lies within the multibrot set * This is implementation closely matches mandelbrot diff --git a/src/shared-fractals.c b/src/shared-fractals.c new file mode 100644 index 0000000..f0d837e --- /dev/null +++ b/src/shared-fractals.c @@ -0,0 +1 @@ +#include "fractals.h" |
