From 70b7e36de4a9db760c254b8f22d91ea4e6ddc9d8 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Tue, 9 Jun 2015 22:11:04 +1200 Subject: Made it easier to add new algos, added tricorn algo, burning ship lattice ship algo --- algorithms/burning-ship-lattice.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 algorithms/burning-ship-lattice.c (limited to 'algorithms/burning-ship-lattice.c') diff --git a/algorithms/burning-ship-lattice.c b/algorithms/burning-ship-lattice.c new file mode 100644 index 0000000..cf80632 --- /dev/null +++ b/algorithms/burning-ship-lattice.c @@ -0,0 +1,31 @@ +#include "../fractal-gen.h" + +void *generate_burning_ship_lattice_section(void *section) +{ + data_section *d = (data_section*)section; + unsigned int x,y,i; + int idx = 0; + double a,b; + double complex z,c; + double size_units = 0.09f; + double top = -0.082f; + double left = -1.8f; + + for (y = d->core, b = (d->core*(size_units/d->size)+top); y < d->size; b+=((d->cores*size_units)/d->size), y+=d->cores) + { + for (x = 0, a = left; x < d->size; a+=(size_units/d->size), x++) + { + z = 0; + c = a+I*b; + for (i = 0; i < d->iterat; i++) + { + if (cabsf(z) >= 2) + break; + + z = cpow( cabsf(crealf(z)) + I*cabsf(cimagf(z)) , d->power) + c; + } + d->data[idx++] = (255*i)/d->iterat; + } + } + return NULL; +} -- cgit v1.1