Natalie's CS151 Project 8
Skip to end of metadata
Go to start of metadata

Title and Abstract: Better Trees. For this project we built off of last week's project 7. Therefore, I imported both my L-system.py and turtle_interpreter.py to call upon and update them. For this project I did not import turtle. Instead, I passed strings to the buildString method in the L-system class which contained the turtle. Key lecture concepts were classes and lsystems. We learned how to utilize both so that everything within a class had methods and functions stayed outside of the class. Each L-system was passed to a method of the class to draw. This way, the class is encapsulated, and things inside do not affect what is outside the class.

Task 1 was to create an arrangement of trees using multi-rule L-systems. With each of these L-systems, we wanted to change the string, but leave the color and other parameters alone. To do this, I created different characters in the string such as '<' '>' '-' '+' and others. In my arrangement, I used systemFL, systemCL, and systemDL. I portrayed each image twice and gave each system two different iterations to draw to show the "growth" of each tree. Below is my image:

 

For the second image, I made variations of the systems from above, I took systemDL and added one X after the first + or left turn. The other variation is one I took from the ABOP book. Below is systemKL and systemLL which are the result of these variations.

  

To make this second image, I did do a bit of guess and checking. I found adding and X or F kept the shape of the tree to resemble a tree whereas adding '-' or '+' may change my whole image.I found that keeping my angles smaller also kept the image more 'tree-like.' I ran these systems with iterations 3,4,5 and 4,5,6

For the extension, I added one more X at the same place in systemKL and I added leaves to systemLL. Their codes and image are below:

 

This change to systemKL was made so that it looks as though a gust of wind is passing through in the middle of the trees blowing their branches and leaves outward. On top of the system changes, I also changed the hard coding for the leaves. I imported the random package and had it choose between two colors for the leaves. I also used random.randint(2,5) for the radius of the circle of each leaf.

What I learned: I learned more about L-systems and increased my knowledge in using them. More importantly, I learned about classes and how a class encapsulates the data within it, making for easy changes to the code to manipulate one image and leave others alone.

Sources, Imported Libraries, and collaborators: I imported libraries: lsystem, turtle_interpreter, and random. I went to my tutor, Andrew Turley, my classmate Erik Cohen, and my teammate Zeb Keith-Hardy, to ask various questions throughout this project. They sat with me to debug and help me understand why my output images looked the way that they did.

 

 

 

 

Labels