#include WINMAIN { int n,i; char str[100]; GRAPHICS(1024,768,"Nonlinear things [Stephen Brooks 2004]"); loadfont("font.dat","normal"); double zoom=yres/2,k=1; LOOP { if (mb&1) zoom*=1.01; if (mb&2) zoom/=1.01; if (KEY(VK_Z)) k*=1.01; if (KEY(VK_X)) k/=1.01; double th=fmod(M_TWOPI*mx/xres+eithertime()*0.01,M_TWOPI),cth=cos(th),sth=sin(th); double ox,x,y; for (n=0;n<100;n++) { x=0.01*n; y=0; for (i=4000;i>0 && x*x+y*y<100;i--) { putpix(xres/2+x*zoom,yres/2+y*zoom,50+n); ox=x; x=x*cth+y*sth; y=y*cth-ox*sth+k*x*x; } } sprintf(str,"Fractional tune = %.5lf",th/M_TWOPI); bfwrite(0,0,str,15); ccl(0); } }