'=========================================================================== ' Subject: MASKS Date: 08-15-00 (15:47) ' Author: Jacob Wieles Code: QB, QBasic, PDS, PB ' Origin: j.wieles@hccnet.nl Packet: GRAPHICS.ABC '=========================================================================== 'programma : MASKS.BAS (15-08-2000) ' : Playing with sine and cosine and find masks ' 'auteur : Jacob Wieles 'basics ? : PowerBASIC and Q(uick)BASIC defint b-z defdbl a,p ColOn=1 ColOff=0 screen 12 'Find out on which basic the program runs out &H3C7,15 cr=inp(&H3C9) cg=inp(&H3C9) cb=inp(&H3C9) ' if cr=42 then the program runs on PowerBasic ' if cr=63 then the program runs on Q(uick)Basic timedivisor=100'=====================>> For PowerBASIC if cr=63 then timedivisor=8'=========>> For Q(uick)BASIC 'The value for the timedivisor are found for a Pentium 100 PC 'For an other PC maybe you must change this value 'To prevent flickering monitor and SetUpDrawSpeed t!=timer wp&=0 do while timer< t!+1 wp&=wp&+1 loop DrawLoop&=wp&/timedivisor TS$=" Key for stop. " XM=point(0) YM=point(1) pi=4*atn(1) window (-XM,-YM)-(XM-1,YM-1) Radius=(YM-4)/2 TotalMask=12 RunFlag=1 restore ShapeMaskNumb for Mask=1 to TotalMask read ShapeNumber SidePolygon=720/ShapeNumber locate 1,60 print Mask;"from";TotalMask DrawColor=ColOn gosub DrawMask t!=timer while timer< t!+2:wend DrawColor=ColOff gosub DrawMask next Mask QuitProg: cls screen 0 print" Hit a key for the source." end DrawMask: locate 1,1 print TS$ for DrawStep=0 to 720 Angle=DrawStep*2*pi/720 Angle2=ShapeNumber*Angle R1=Radius*sin(Angle2+Angle) X1=Radius*cos(Angle2-Angle) Y1=R1*sin(Angle) X=X1+Radius*cos(Angle) Y=Y1+Radius*sin(Angle2-Angle) col=14-DrawStep mod SidePolygon if DrawColor=ColOff then col=0 if DrawStep=0 then pset (X,Y) else line -(X,Y),col for w&=0 to DrawLoop&:next w& end if inv$=inkey$ if inv$<>"" then gosub KeyNext if RunFlag=0 then goto QuitProg next DrawStep return KeyNext: RunFlag=1 locate 1,1 print" Key for go on." locate 2,1 print" Esc for end. " do keyhit$=inkey$ loop until keyhit$<>"" if keyhit$=CHR$(27) then RunFlag=0 locate 1,1 print TS$ locate 2,1 print string$(14," ") return ShapeMaskNumb: data 120,121,122,142,146,178,179,180,181,182,238,242