aboutsummaryrefslogtreecommitdiff
path: root/algorithms
diff options
context:
space:
mode:
Diffstat (limited to 'algorithms')
-rw-r--r--algorithms/burning-ship-lattice.c31
-rw-r--r--algorithms/burning-ship.c31
-rw-r--r--algorithms/mandelbrot.c31
-rw-r--r--algorithms/tricorn.c31
4 files changed, 124 insertions, 0 deletions
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;
+}
diff --git a/algorithms/burning-ship.c b/algorithms/burning-ship.c
new file mode 100644
index 0000000..bfbd0a7
--- /dev/null
+++ b/algorithms/burning-ship.c
@@ -0,0 +1,31 @@
+#include "../fractal-gen.h"
+
+void *generate_burning_ship_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 = 3.5f;
+ double top = -2.2f;
+ double left = -2.2f;
+
+ 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;
+}
diff --git a/algorithms/mandelbrot.c b/algorithms/mandelbrot.c
new file mode 100644
index 0000000..7f8a613
--- /dev/null
+++ b/algorithms/mandelbrot.c
@@ -0,0 +1,31 @@
+#include "../fractal-gen.h"
+
+void *generate_mandelbrot_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 = 3.5f;
+ double top = -1.75f;
+ double left = -2.5f;
+
+ 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(z , d->power) + c;
+ }
+ d->data[idx++] = (255*i)/d->iterat;
+ }
+ }
+ return NULL;
+}
diff --git a/algorithms/tricorn.c b/algorithms/tricorn.c
new file mode 100644
index 0000000..eddc4d6
--- /dev/null
+++ b/algorithms/tricorn.c
@@ -0,0 +1,31 @@
+#include "../fractal-gen.h"
+
+void *generate_tricorn_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 = 4.f;
+ double top = -2.f;
+ double left = -2.3f;
+
+ 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(conj(z) , d->power) + c;
+ }
+ d->data[idx++] = (255*i)/d->iterat;
+ }
+ }
+ return NULL;
+}