aboutsummaryrefslogtreecommitdiff
path: root/algorithms/burning-ship.c
diff options
context:
space:
mode:
authorDavid Phillips <dbphillipsnz@gmail.com>2015-06-09 22:11:04 +1200
committerDavid Phillips <dbphillipsnz@gmail.com>2015-06-10 00:11:18 +1200
commit70b7e36de4a9db760c254b8f22d91ea4e6ddc9d8 (patch)
treee9a7d2666fb2a088b8913e6b851edeca251d1f64 /algorithms/burning-ship.c
parentd29cb84f52f93e060c2ec0f020f56fea0636428d (diff)
downloadfractal-gen-70b7e36de4a9db760c254b8f22d91ea4e6ddc9d8.tar.xz
Made it easier to add new algos, added tricorn algo, burning ship lattice ship algo
Diffstat (limited to 'algorithms/burning-ship.c')
-rw-r--r--algorithms/burning-ship.c31
1 files changed, 31 insertions, 0 deletions
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;
+}