home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 44
/
Amiga_Dream_44.iso
/
RiscPc
/
programmation
/
scm4e2.arc
/
!Turtles
< prev
Wrap
Text File
|
1995-07-02
|
3KB
|
84 lines
Turtling
--------
A rough guide to the new functions that have suddenly materialised due to
yet more interference with the source (sorry Aubrey ;-)...
I had meant to get these written about a month and a half ago but owing to
a book I was using actually having WRONG code in it (grrr) and me not
spotting this....
Anyway. Its here now!
Thanks to The Science Of Fractals by Peitgen and Saupe for having a correct
way of plotting losslessly using turtles (well actually their code was for
L system plotting - I just peered at it long enough then took out the
heart of it (which is essentially a Sin/Cos table that fixes things..)...
New functions are as follows :
Function Args Does?
forward n Moves the pen forward drawing
as it goes for n units worth.
backward n Sames as above but backwards!
turn n Turns turtle through n
degrees (n must be integer)
left n Turns left through n degrees
right n Turns right through n degrees
init-turtle x y h Initialises turtle to be at
x,y on screen (integers)
pointing at a heading of h
degrees.
go none Moves the graphics origin,
sets up the turtle to draw
and clears the screen.
pen-up none Moves the pen up
pen-down none Puts the pen back onto the
paper
pen-up? none #t if pen is up
pen-down? none #t if pen is down
home none moves the turtle back to
where you started it from
(with init-turtle)
Or if you didnt - back to
0,0. (With the same heading
as you initially set it to
have (or 0 if you didn't..)
Problems
--------
You _should_ call init-turtle - or better still use (go) to do it for you,
peer at the definition of go in ScmInit and you should get the idea about
how you should use it.
If you find that your drawing looks weird for the first plot but ok
thereafter you probably haven't called init-turtle...
Doesn't do any checking of where we are plotting and whether it might be
sensible. (If you really want hack up a veneer in Scheme? ;)
Demos
-----
Aha! - Just to prove it does really work - have a look at turtle in the
scheme source directory - few odds and ends that draw aesthetically
appealing piccies.
(Careful what you choose for recursion depth in some of them - larger values
tend to make it go away and think and not draw very much ..)
As ever if anyone knocks up anything really cute - I'll include it with
credit (I really don't know why I bother asking....)
any other problems I'm contactable via any means present in !RelNotes..
al slater
7/8/94