home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Transactor
/
Transactor_21_1988_Transactor_Publishing.d64
/
circles.bas
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2023-02-26
|
1KB
|
59 lines
10 rem 'circles' in basic
20 ifpeek(49152)<>76thenload"hires",8,1
100 :
110 hires=12*4096:draw=hi+3:plot=dr+3
120 move=pl+3:clscr=mo+3:dmode=cl+3
130 selpc=dm+3:colour=se+3:box=co+3
140 text=bo+3:prnt=te+3:chset=pr+3
150 trap=ch+3
160 :
170 rem basic circles - polygons
180 sys hires,0,1,6
190 xc=160:yc=100:xr=99:yr=79
200 sa=0 :ea=360:inc=5
210 z1=sa*(NULL)/180:z2=ea*(NULL)/180:z3=inc*(NULL)/180
220 x=xc+xr*cos(z1):y=yc+yr*sin(z1)
230 sys move,x,y
240 for i=z1toz2 stepz3
250 x=xc+xr*cos(i):y=yc+yr*sin(i)
260 sys draw,x,y
270 next
280 sys prnt,16,12,"polygons"
290 for t=1to2000:next
300 :
310 rem basic circles - potential
320 sys hires,0,1,6
330 xc=160:yc=100:xr=99:yr=79
340 phi%=0:yphi%=0:xyphi%=0:y%=0:x%=xr
350 f=0:if xr<yr then f=1
360 if f=1 then x%=yr:tm=xr:xr=yr:yr=tm
370 rem start loop
380 yphi%=phi%+y%+y%+1
390 xyphi%=yphi%-x%-x%+1
400 if f=0 then x2=x%:x3=y%
410 if f=1 then y3=x%:y2=y%
420 t2%=x%:t1%=t2%*yr/xr
430 if f=0 then y3=t1%
440 if f=1 then x2=t1%
450 t2%=y%:t1%=t2%*yr/xr
460 if f=0 then y2=t1%
470 if f=1 then x3=t1%
480 :
490 sys plot,xc+x2,yc+y2
500 sys plot,xc-x2,yc+y2
510 sys plot,xc-x2,yc-y2
520 sys plot,xc+x2,yc-y2
530 :
540 sys plot,xc+x3,yc+y3
550 sys plot,xc-x3,yc+y3
560 sys plot,xc-x3,yc-y3
570 sys plot,xc+x3,yc-y3
580 :
590 phi%=yphi%:y%=y%+1
600 if abs(xyphi%)<abs(yphi%) then phi%=xyphi%:x%=x%-1
610 if x%>y% goto 380 'loop for more
620 :
630 sys prnt,16,12,"potential"
640 for t=1to2000:next
650 end