home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_21_1988_Transactor_Publishing.d64 / circles.bas (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  1KB  |  59 lines

  1. 10 rem  'circles'  in basic
  2. 20 ifpeek(49152)<>76thenload"hires",8,1
  3. 100 :
  4. 110 hires=12*4096:draw=hi+3:plot=dr+3
  5. 120 move=pl+3:clscr=mo+3:dmode=cl+3
  6. 130 selpc=dm+3:colour=se+3:box=co+3
  7. 140 text=bo+3:prnt=te+3:chset=pr+3
  8. 150 trap=ch+3
  9. 160 :
  10. 170 rem  basic circles - polygons
  11. 180 sys hires,0,1,6
  12. 190 xc=160:yc=100:xr=99:yr=79
  13. 200 sa=0 :ea=360:inc=5
  14. 210 z1=sa*(NULL)/180:z2=ea*(NULL)/180:z3=inc*(NULL)/180
  15. 220 x=xc+xr*cos(z1):y=yc+yr*sin(z1)
  16. 230 sys move,x,y
  17. 240 for i=z1toz2 stepz3
  18. 250   x=xc+xr*cos(i):y=yc+yr*sin(i)
  19. 260   sys draw,x,y
  20. 270 next
  21. 280 sys prnt,16,12,"polygons"
  22. 290 for t=1to2000:next
  23. 300 :
  24. 310 rem  basic circles - potential
  25. 320 sys hires,0,1,6
  26. 330 xc=160:yc=100:xr=99:yr=79
  27. 340 phi%=0:yphi%=0:xyphi%=0:y%=0:x%=xr
  28. 350 f=0:if xr<yr then f=1
  29. 360 if f=1 then x%=yr:tm=xr:xr=yr:yr=tm
  30. 370 rem  start loop
  31. 380   yphi%=phi%+y%+y%+1
  32. 390   xyphi%=yphi%-x%-x%+1
  33. 400   if f=0 then x2=x%:x3=y%
  34. 410   if f=1 then y3=x%:y2=y%
  35. 420   t2%=x%:t1%=t2%*yr/xr
  36. 430   if f=0 then y3=t1%
  37. 440   if f=1 then x2=t1%
  38. 450   t2%=y%:t1%=t2%*yr/xr
  39. 460   if f=0 then y2=t1%
  40. 470   if f=1 then x3=t1%
  41. 480   :
  42. 490   sys plot,xc+x2,yc+y2
  43. 500   sys plot,xc-x2,yc+y2
  44. 510   sys plot,xc-x2,yc-y2
  45. 520   sys plot,xc+x2,yc-y2
  46. 530   :
  47. 540   sys plot,xc+x3,yc+y3
  48. 550   sys plot,xc-x3,yc+y3
  49. 560   sys plot,xc-x3,yc-y3
  50. 570   sys plot,xc+x3,yc-y3
  51. 580 :
  52. 590   phi%=yphi%:y%=y%+1
  53. 600   if abs(xyphi%)<abs(yphi%) then phi%=xyphi%:x%=x%-1
  54. 610   if x%>y% goto 380 'loop for more
  55. 620 :
  56. 630 sys prnt,16,12,"potential"
  57. 640 for t=1to2000:next
  58. 650 end
  59.