home *** CD-ROM | disk | FTP | other *** search
/ PC User 2001 August / APC_Aug2001_CD2.iso / features / devtools / files / lb202win.exe / LB202W.EXE / MANDALA.BAS < prev    next >
Encoding:
BASIC Source File  |  2000-12-06  |  1.3 KB  |  58 lines

  1.  
  2.  
  3.     ' Plot a mandala with 20 vertices
  4.     nomainwin
  5.     dim verticesX(100)
  6.     dim verticesY(100)
  7.     verticesQty = 20
  8.     diameter = 400
  9.     radius = int(diameter/2)
  10.     angle = 360/verticesQty
  11.  
  12.     ' Open the graphics window
  13.     open "Mandala" for graphics_fs as #mand
  14.     print #mand, "trapclose [quit]"
  15.     print #mand, "home"
  16.     print #mand, "north"
  17.     print #mand, "up"
  18.  
  19.     ' Create vector table
  20.     for i = 1 to verticesQty
  21.  
  22.         ' Place turtle in center of screen pointing to top of screen
  23.         print #mand, "home"
  24.         print #mand, "north"
  25.  
  26.         ' Turn to next vector and 'go' there
  27.         print #mand, "turn "; i * angle
  28.         print #mand, "go "; radius
  29.  
  30.         ' Ask for turtle position in xy
  31.         print #mand, "posxy vrtcX vrtcY"
  32.  
  33.         ' Add to table
  34.         verticesX(i) = vrtcX
  35.         verticesY(i) = vrtcY
  36.  
  37.     next i
  38.  
  39.     ' Draw - put the pen down
  40.     print #mand, "down"
  41.  
  42.     ' Draw each individual line in the mandala
  43.     for a = 1 to verticesQty
  44.         for b = a to verticesQty
  45.             print #mand, "line "; verticesX(a); " "; verticesY(a); " "; verticesX(b); " "; verticesY(b)
  46.         next b
  47.     next a
  48.  
  49.     ' Force the drawing to 'stick'
  50.     print #mand, "flush"
  51.  
  52.     ' stop to look at the drawing
  53.     wait
  54.  
  55. [quit]
  56.     ' Close the window
  57.     close #mand
  58.     end