Tuesday, January 26, 2016

LogoTurtle Fractal Designs

I was inspired by Erik Nauman's Generative Art and the LogoTurtle post and decided to program some fractal art for the LogoTurtle to draw.

First, I reached out to Erik for a little assistance adapting my TurtleArt Dragon Curve procedure to LogoTurtle. He and Brian helped me by building a little random number generator that helps determine whether the LogoTurtle turns right or left 90 degrees.

to dragon.curve
repeat 100 [
fd 50
ifelse (random 0 10) < 5
[rt 90]
[lt 90]
This procedure calls for repeating many times or even looping infinitely. The only limitation is the amount of ink in the pen and the size of your canvas!

The next procedure was adapted from Michael Friendly's Advanced Logo. I have been wanting to understand and create a tree pattern like this for some time: this exercise put me on that path.

to tree2 :len :depth :ang
if :depth = 0 [stop]
lt :ang fd :len
tree2 :len (:depth - 1) :ang
bk :len rt 2 * :ang
fd :len
tree2 :len (:depth - 1) :ang
bk :len lt :ang
 First, I ran it small with the following procedure:
rt 60 
rt 60 
back 100 
repeat 3 [tree2 20 5 12 lt 60] 

The design is surprisingly organic and beautiful. The trunk is not quite right, though.

The next time I ran it I sized it up considerably:
to startup
wait 1000
rt 60
repeat 3 [
tree2 100 5 12 lt 60]
rt 120
bk 100

It was also beautiful.

LogoTurtle, like elsewhere, proves to be a fun and beautiful place to examine fractals and mathematics.

No comments: