conversion of julia.c to html:
#include <stdio.h> #include <math.h> #include <stdlib.h> main(int argc, char *argv[]) { int itermax = 100; /* maximum iters to do /* double breakout=1000000.; /* z^2 greater than this is a breakout /* double magnify=10; /* 10 is standard magnification /* double cr=-.7492; double ci=.1; /* ci=.1 /* double x0=.09950; double y0=-.00062; int hxres = 500; /* horizontal resolution /* int hyres = 500; /* vertical resolution /* double x,xx,y,xl,yl,zsq,zm,rb; int iter,hx,hy; int red,green,blue; FILE *ofp; rb=sqrt(breakout); ofp=fopen("julia.ppm","w"); if (argc>1) sscanf(argv[1],"%lf",&magnify); if (argc>2) sscanf(argv[2],"%d",&itermax); if (argc>3) sscanf(argv[3],"%lf",&cr); if (argc>4) sscanf(argv[4],"%lf",&ci); if (argc>5) sscanf(argv[5],"%lf",&x0); if (argc>6) sscanf(argv[6],"%lf",&y0); /* header for PPM output /* fprintf(ofp,"P6\n# magnify=%lf itermax=%d\n",magnify,itermax); fprintf(ofp,"%d %d\n255\n",hyres,hxres); for (hy=1;hy<=hyres;hy++) { for (hx=1;hx<=hxres;hx++) { y = 4*((hyres+1-hy-.5)/hyres-0.5)/magnify+y0; x = 4*((hx-.5)/hxres-0.5)/magnify+x0; zm=0; for (iter=1;iter<itermax;iter++) { xl=x; yl=y; xx = x*x-y*y+cr; y = 2.0*x*y+ci; x = xx; zsq=x*x+y*y; if (zsq > zm) zm=zsq; if (zsq>breakout) break; } if (iter>=itermax){ red=0; green=255.*zm/breakout; blue=255.*zm/breakout; } else{ red=255*(rb+xl)/(2*rb); green=0; blue=.5*255*(rb+yl)/(2*rb); } fputc((char)red,ofp); fputc((char)green,ofp); fputc((char)blue,ofp); } } fclose(ofp); system("xv julia.ppm"); }