2013/02/08

Self square fractal drawing (direct draw)

This program draws a self square fractal.
In V1.6, screen drawing becomes so faster, it can draw in only 105 seconds (iPad3).

By the way, At 512 x 512 size, it took about 1 hour 25 minute on the iPad3 with V1.5.
Peke-BASIC took about 3.5 hours and X-BASIC/68 seems to take more than 6 hours.

References : Oh!X 1988 March "Introductory of X68000BASIC" Akira Nakamori

// Self square fractal drawing
// pset() use type
int wx,wy
width(0)
getWidth(wx,wy):/* get graphic screen size
width(64)
// same as X68000 size
if wx>=512 then wx=512
if wy>=512 then wy=512
//
locate(0,0):print "wx*wy=";wx;"*";wy
locate(0,1):print "start=";time$
vpriority(TPAGE,GPAGE0,GPAGE1,GPAGE2,GPAGE3)
vpage(B_TPAGE or B_GPAGE0 or B_GPAGE1 or B_GPAGE2 or B_GPAGE3,YES)
apage(GPAGE0)
int MAXREP=50
int MAXDOT=wx
int MAXCOL=255
float remin=-0.5#
float remax= 0.5#
float immin=-0.5#
float immax= 0.5#
float recon=-0.04#
float imcon=-0.695#
int rep,ix,iy
float x,y,re,im,dx,dy
//
dx=(remax-remin)/MAXDOT
dy=(immax-immin)/MAXDOT
/*
for iy=0 to MAXDOT-1
    locate(0,2):print "line=";iy
    for ix=0 to MAXDOT-1
        x=remin+ix*dx
        y=immin+iy*dy
        for rep=0 to MAXREP
            re=x*x-y*y+recon
            im=2#*x*y+imcon
            if ((re*re+im*im)>4#) then break
            x=re:y=im
        next
        int c=(rep mod MAXCOL)*4
        gcolor(c,c,c,255)
        pset(ix,iy)
    next
next
locate(0,2):print "end=";time$
//
end


Zip archive file : XBetc.zip

No comments:

Post a Comment