circle.sl 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. % CIRCLE.SL.3 31 Jan. 83
  2. % Test program to draw a circle on a graphics screen.
  3. % G. Novak
  4. (DG CIRCLE
  5. (XSTART:integer YSTART:integer RADIUS:INTEGER)
  6. % (* edited: "19-MAR-82 16:31")
  7. % (* Draw a circle incrementally.)
  8. (PROG (X Y YLAST DELTA NP2)
  9. (X_RADIUS)
  10. (Y_0)
  11. (DELTA_0)
  12. (WHILE Y<X DO (YLAST_Y)
  13. (DELTA _+
  14. X + X - 1)
  15. (WHILE DELTA>0 DO (DELTA _-
  16. Y+Y+1)
  17. (Y_+1))
  18. (NP2 _(Y - YLAST + 1)/2)
  19. (WHILE NP2>0 DO (NP2_-1)
  20. (DRAWCIRCLEPOINT X YLAST XSTART YSTART)
  21. (YLAST_+1))
  22. (X_-1)
  23. (WHILE YLAST<Y DO
  24. (DRAWCIRCLEPOINT X YLAST XSTART YSTART)
  25. (YLAST_+1)))))
  26. % for testing:
  27. (de drawcirclepoint (x y xstart ystart)
  28. (prin1 x)(prin2 '! )(print y))
  29. (dg oldDRAWCIRCLEPOINT
  30. (X:integer Y:integer XSTART:integer YSTART:INTEGER)
  31. % (* edited: "19-MAR-82 15:40")
  32. (BITMAPBIT XSTART+X YSTART+Y 1)
  33. (BITMAPBIT (XSTART - X)
  34. YSTART+Y 1)
  35. (BITMAPBIT (XSTART - X)
  36. (YSTART - Y)
  37. 1)
  38. (BITMAPBIT XSTART+X (YSTART - Y)
  39. 1)
  40. (BITMAPBIT XSTART+Y YSTART+X 1)
  41. (BITMAPBIT XSTART+Y (YSTART - X)
  42. 1)
  43. (BITMAPBIT (XSTART - Y)
  44. YSTART+X 1)
  45. (BITMAPBIT (XSTART - Y)
  46. (YSTART - X)
  47. 1))