From 1d50fb35485583404691d5f30420fa9d494af35f Mon Sep 17 00:00:00 2001 From: David Phillips Date: Wed, 30 Mar 2016 00:20:38 +1300 Subject: Style and misc updates --- algorithms/burning-ship-lattice.c | 16 ++++++++++------ algorithms/burning-ship.c | 6 +++--- algorithms/mandelbrot.c | 4 ++-- 3 files changed, 15 insertions(+), 11 deletions(-) (limited to 'algorithms') diff --git a/algorithms/burning-ship-lattice.c b/algorithms/burning-ship-lattice.c index 5497635..e58912e 100644 --- a/algorithms/burning-ship-lattice.c +++ b/algorithms/burning-ship-lattice.c @@ -25,14 +25,18 @@ * SUCH DAMAGE. */ -#include "../fractal-gen.h" +#include "common.h" void *generate_burning_ship_lattice_section(void *section) { data_section *d = (data_section*)section; - unsigned int x,y,i; - double a,b; - double complex z,c; + unsigned int x = 0; + unsigned int y = 0; + unsigned int i = 0;; + double a = 0; + double b = 0; + double complex z = 0; + double complex c = 0; double size_units = 0.09f; double top = -0.082f; double left = -1.8f; @@ -49,10 +53,10 @@ void *generate_burning_ship_lattice_section(void *section) c = a+I*b; for (i = 0; i < iterat; i++) { - if (cabsf(z) >= 2) + if (cabs(z) >= 2) break; - z = cpow( cabsf(crealf(z)) + I*cabsf(cimagf(z)) , power) + c; + z = cpow( fabs(creal(z)) + I*fabs(cimag(z)) , power) + c; } d->data[d->idx++] = (255*i)/iterat; a += (clust_total*size_units)/size; diff --git a/algorithms/burning-ship.c b/algorithms/burning-ship.c index c36c8c5..5c7d2e3 100644 --- a/algorithms/burning-ship.c +++ b/algorithms/burning-ship.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ -#include "../fractal-gen.h" +#include "common.h" void *generate_burning_ship_section(void *section) { @@ -49,10 +49,10 @@ void *generate_burning_ship_section(void *section) c = a+I*b; for (i = 0; i < iterat; i++) { - if (cabsf(z) >= 2) + if (cabs(z) >= 2) break; - z = cpow( cabsf(crealf(z)) + I*cabsf(cimagf(z)) , power) + c; + z = cpow( fabs(creal(z)) + I*fabs(cimag(z)) , power) + c; } d->data[d->idx++] = (255*i)/iterat; a += (clust_total*size_units)/size; diff --git a/algorithms/mandelbrot.c b/algorithms/mandelbrot.c index 8225d8c..8b59f2f 100644 --- a/algorithms/mandelbrot.c +++ b/algorithms/mandelbrot.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. */ -#include "../fractal-gen.h" +#include "common.h" void *generate_mandelbrot_section(void *section) { @@ -50,7 +50,7 @@ void *generate_mandelbrot_section(void *section) c = a + I*b; for (i = 0; i < iterat; i++) { - if (cabsf(z) >= 2) + if (cabs(z) >= 2) break; z = cpow(z , power) + c; -- cgit v1.1