home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lb091.zip / MANDALA.BAS < prev    next >
BASIC Source File  |  1995-01-02  |  1KB  |  58 lines

  1.  
  2.  
  3.     ' Plot a mandala with 20 vertices
  4.  
  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.  
  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"
  32.         input #mand, vrtcX, vrtcY
  33.  
  34.         ' Add to table
  35.         verticesX(i) = vrtcX
  36.         verticesY(i) = vrtcY
  37.  
  38.     next i
  39.  
  40.     ' Draw - put the pen down
  41.     print #mand, "down"
  42.  
  43.     ' Draw each individual line in the mandala
  44.     for a = 1 to verticesQty
  45.         for b = a to verticesQty
  46.             print #mand, "line "; verticesX(a); " "; verticesY(a); " "; verticesX(b); " "; verticesY(b)
  47.         next b
  48.     next a
  49.  
  50.     ' Force the drawing to 'stick'
  51.     print #mand, "flush"
  52.  
  53.     ' Pause to look at the drawing
  54.     input r$
  55.  
  56.     ' Close the window
  57.     close #mand
  58.