logo tree

| No Comments
My husband has been listening to me talk about trees for over a week now. And he still reads this little blog. Aw. After reading one of my posts about drawing my tree earlier this week, he drew his own tree.

logo_tree.jpg

 
He drew this tree using a computer programming language called Logo, which was developed in the 80's for teaching computer science in a constructivist framewok. (For more on the history of Logo, check out the Logo Foundation website.) Hubby explains how he drew his tree: Logo has a screen on which sits a "turtle." The turtle has a pen attached to its tail and understands commands like "walk forward," "walk backward," "turn left," and "turn right."

logo_turtle.jpg

That's all you need to draw a tree. Here's his program:

to tree :size
if :size >= 5 [
 forward :size
 left 60
 tree :size / 2
 right 60
 tree :size / 2
 right 60
 tree :size / 2
 left 60
 back :size]
end

Which means:

if the current size is greater or equal than 5 then do the following:
o draw a line of length size in the current direction
o turn left by 60 degrees
o draw a tree of half the current size
o turn right by 60 degrees
o draw a tree of half the current size
o turn right by 60 degrees
o draw a tree of half the current size
o turn left by 60 degrees
o draw a line of length size backward

Different trees can be made by varying the minimum size (here 5), the rotation angle and the proportion of the child trees to their parents.

Apparently, it's a simple exercise in recursion, which involves the repetition of the same form or function. Hubby says he started thinking about the Logo tree when he read this passage in my post from Monday about the groups of smaller branches that seemed to pop out of the main branches all around the same spot: "And in fact, they are very reminiscent of the original four limbs all bursting out of the main trunk at around the same height. I can see this same pattern repeated in some of the smaller branches too." He explained, that's what makes drawing a tree so simple with this program: the tree is just a bunch of smaller versions of itself (each made up of even smaller versions, etc.) attached to each other.

Neat-o!

Leave a comment

October 2011

Sun Mon Tue Wed Thu Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          

About this Entry

This page contains a single entry by Alison published on February 16, 2011 4:35 PM.

a walk among the trees was the previous entry in this blog.

it's a popcorn tree is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Pages

OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.12