Pages Hyeon-Seung Yu’s Home Hyeon-Seung (Alex) Yu's CS 151 Hyeon-Seung (Alex) Yu's CS 151 Project 7: Fractals and Trees

You are viewing an old version of this page. View the current version.

Version 5

Abstract:

In project 7, I used turtle library again to draw certain different shapes.  However, the approach to drawing the shapes was very different from the previous projects that used turtle library.  The following were the key differences: 1) I used L-system, which enabled me to draw an organized yet complex graphics/images without long turtle commands and 2) I used list and indexes to contain and manipulate information of different L-systems.  Essentially, the idea of using list was recycled from the project 5.  I think list is a good way of using different L-systems if one is attempting to assign different parameters to the systems such as color, thickness, scale, etc.

Abstract Image:

First of all, I assigned different values to the indexes that I used to draw different L-systems.

.  The following list shows the actual values I assigned to those indexes.

How do I actually use this list information to draw L-systems?  I just have to assign more parameters to the drawString() function and modify the function like below.

.

My abstract image had three L-systems that drew tree, sun, and snow.  Below is the image.

.

I wrote my own tree L-system based on systemB.txt; snow and sun L-systems were based on the example that was given during the lecture by professor Skrien.

Grid:

For task 2, I created two separate functions that drew the grid and a set of 9 trees, respectively.  Although I was able to draw a 3x3 grid, I could not figure out how to use double for loop to do so.  The set of 9 trees each had specific x and y coordinates so that they would be located inside each grid.  Below is the image.

This image is actually one of my extensions but it does what task 2 asks me to do.  From the left to right, the number of iterations increases by 1.  From the top to bottom, the angle of the L-system changed from 22 to 46 and from 46 to 60.

For extension, I simply assigned different colors to each column to represent the shift of season from summer to fall (green to brown) and from fall to winter (brown to white).

Labels
• No labels