One of the classic shapes to construct in turtle logo is the Spiral.
The first way you write this program, is as a variation on a polygon. You go forward, you turn a bit, you go forward, you turn a bit. But you make it recursive, so that the amount you go forward can become smaller and smaller each time. Technically, this is called a 'spirangle'
to spiral :sides :length :ratio :angle if (:sides > 0) [ fd :length rt :angle spiral :sides-1 :length * :ratio :ratio :angle ] end setxy 50 100 spiral 60 40 0.95 30 setxy 200 80 spiral 120 15 0.995 15 setxy 350 100 spiral 200 7 0.995 6 setxy 100 200 spiral 200 2 1.005 7
If you look at that last example, we turned it around completely.
Instead of making a smaller and smaller line each time, we made a bigger and bigger line. (A ratio of 1.005) This created a spiral in the opposite direction! (Opposing chirality)
There is also an 'arc' function in Turtle graphics, that lets you draw smoother curves.
to spiral :length :ratio :angle :i if :i > 0 [ penwidth (:i/3 + 1) arc :length :angle pu fd (:length - :length/:ratio) pd lt :angle spiral :length/:ratio :ratio :angle (:i - 1) ] end spiral 120 1.05 60 30
Swirls and spirals appear in nature in all kinds of places. In the seeds of a sunflower, in the vortex of a hurricane, in the horns of a goat, in the shell of a snail, in the curling fronds of a fern, in this guy's beard.
- Wikipedia: Spirangle
- Wikipedia: Parastichy
- Wikipedia: Chirality
- Tumblr: James Myrick
- Whitney Music Box