Last active
August 29, 2015 14:09
-
-
Save glcoder/f6929e8468eee2b9d0be to your computer and use it in GitHub Desktop.
Mandelbrot set plotter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h>/* this code draw Mandelbrot set and save it into BMP file */ | |
unsigned long h[]={7753026UL,128L,7733248UL,2621440UL,268435456UL,268435456UL, | |
65536L,4L,0L,0L,0L,1048576L,0L,0L,65280L,336920320UL,673775380UL,1010630440UL, | |
1347485500UL,1684340560UL,2021195620UL,2358050680UL,2694905740UL,3031760800UL, | |
3368615860UL,3705470920UL,4042325980UL,4210753520UL,4294967290UL,4294967295UL} | |
;int main(int n,char**f){FILE*o=fopen("fractal.bmp","wb");if(NULL==o)return 1; | |
;fwrite(h,1L,118L,o);**f=0;int c,x,y;for(y=-2048;y<2048;++y)for(n=0,x=-3000;x< | |
1096;n=00,++x){float i,j,k;i=j=k=0;while(i*i+j*j<4&&n++<16){i=i*i-j*j+x/1600.0 | |
;j=2*k*j+y/1600.0;k=i;}c=**f?fputc((c<<4)|(n&15),o):n&15;**f=!**f;}fclose(o);} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment