home *** CD-ROM | disk | FTP | other *** search
/ Dream 44 / Amiga_Dream_44.iso / RiscPc / programmation / scm4e2.arc / !Turtles < prev   
Text File  |  1995-07-02  |  3KB  |  84 lines

  1. Turtling
  2. --------
  3. A rough guide to the new functions that have suddenly materialised due to 
  4. yet more interference with the source (sorry Aubrey ;-)...
  5. I had meant to get these written about a month and a half ago but owing to
  6. a book I was using actually having WRONG code in it (grrr) and me not 
  7. spotting this....
  8. Anyway. Its here now!
  9. Thanks to The Science Of Fractals by Peitgen and Saupe for having a correct
  10. way of plotting losslessly using turtles (well actually their code was for
  11. L system plotting - I just peered at it long enough then took out the 
  12. heart of it (which is essentially a Sin/Cos table that fixes things..)...
  13.  
  14. New functions are as follows :
  15.  
  16. Function        Args            Does?
  17.  
  18. forward            n            Moves the pen forward drawing
  19.                         as it goes for n units worth.
  20.  
  21. backward        n            Sames as above but backwards!
  22.  
  23. turn            n            Turns turtle through n
  24.                         degrees (n must be integer)
  25.  
  26. left            n            Turns left through n degrees
  27.  
  28. right            n            Turns right through n degrees
  29.  
  30. init-turtle        x y h            Initialises turtle to be at
  31.                         x,y on screen (integers)
  32.                         pointing at a heading of h
  33.                         degrees. 
  34.  
  35. go            none            Moves the graphics origin,
  36.                         sets up the turtle to draw
  37.                         and clears the screen.
  38.  
  39. pen-up            none            Moves the pen up
  40.  
  41. pen-down        none            Puts the pen back onto the
  42.                         paper
  43.  
  44. pen-up?            none            #t if pen is up
  45.  
  46. pen-down?        none            #t if pen is down
  47.  
  48. home            none            moves the turtle back to
  49.                         where you started it from
  50.                         (with init-turtle)
  51.                         Or if you didnt - back to
  52.                         0,0. (With the same heading
  53.                         as you initially set it to
  54.                         have (or 0 if you didn't..)
  55.  
  56.  
  57. Problems
  58. --------
  59. You _should_ call init-turtle - or better still use (go) to do it for you,
  60. peer at the definition of go in ScmInit and you should get the idea about
  61. how you should use it.
  62. If you find that your drawing looks weird for the first plot but ok 
  63. thereafter you probably haven't called init-turtle...
  64.  
  65. Doesn't do any checking of where we are plotting and whether it might be
  66. sensible. (If you really want hack up a veneer in Scheme? ;)
  67.  
  68. Demos
  69. -----
  70. Aha! - Just to prove it does really work - have a look at turtle in the 
  71. scheme source directory - few odds and ends that draw aesthetically
  72. appealing piccies.
  73. (Careful what you choose for recursion depth in some of them - larger values
  74. tend to make it go away and think and not draw very much ..)
  75. As ever if anyone knocks up anything really cute - I'll include it with 
  76. credit (I really don't know why I bother asking....)
  77.  
  78.  
  79. any other problems I'm contactable via any means present in !RelNotes..
  80.  
  81.  
  82. al slater
  83. 7/8/94
  84.