aboutsummaryrefslogtreecommitdiff
path: root/mbrot-gen.c
diff options
context:
space:
mode:
authorDavid <dbphillipsnz@gmail.com>2014-05-13 21:17:30 +1200
committerDavid <dbphillipsnz@gmail.com>2014-05-13 21:17:30 +1200
commit574df05b9bd100de623b0a0126d935f513ca0f24 (patch)
treeb452b99b15cea4cd29ddf9fa2a41eb73f40ec1bd /mbrot-gen.c
downloadfractal-gen-574df05b9bd100de623b0a0126d935f513ca0f24.tar.xz
Added all files
Diffstat (limited to 'mbrot-gen.c')
-rw-r--r--mbrot-gen.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/mbrot-gen.c b/mbrot-gen.c
new file mode 100644
index 0000000..cb79f54
--- /dev/null
+++ b/mbrot-gen.c
@@ -0,0 +1,39 @@
+#include <stdio.h>
+#include <complex.h>
+#include <math.h>
+#include "config.h"
+
+int main(int argc, char **argv)
+{
+ unsigned int x, y, i;
+ float a,b;
+ float complex z,c;
+
+ fprintf(stderr, "Creating %dx%d image (raw format)\n",SIZE,SIZE);
+
+ y = 0;
+ for (b = -1.75f; y < SIZE; b+=(3.5f/SIZE))
+ {
+ x = 0;
+ for (a = -2.5f; x < SIZE; a+=(3.5f/SIZE))
+ {
+ z = 0;
+ c = a+I*b;
+ for (i = 0; i < ITERATIONS; i++)
+ {
+ if (cabsf(z) >= 2)
+ break;
+
+ z = cpow(z,POWER)+c;
+ }
+
+ printf("%c",( (255*i)/ITERATIONS ) );
+ x++;
+ }
+ y++;
+ if ( (y%10) == 0 )
+ fprintf(stderr,"\r%.3f%%",y/(float)SIZE*100);
+ }
+ fprintf(stderr,"\n");
+ return 0;
+}