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.
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."
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!
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."
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