# Pages Audrey Lyman Project 9 Non-conforming trees and a mosaic quilt

Ellen Evangelides

Proj 9

The goal of this week's project was to continue our use of classes, in particular with shapes and trees,  and to use inheritance within them.

In task 1, I created a Tree class that uses an Lsystem to generate a string to draw. It inherited the Shape class but overrode the _init_ function with given default values. It also overrode the draw method while keeping the same parameter list. Basically, now what would be the same tree drawn three times in the last project has turned into three trees that vary slightly...much more interesting.

In task 2, I created other other classes that inherit the shape class and defined them using different strings and angles. I created a Square, Triangle, Pentagon, Hexagon, and Heptagon. I also created a SquareFill and a HexagonFill by using curly brackets ( ?

Unknown macro: { , }

) in my interpreter to begin and end the fill of the shape. Here's what some of my shapes looked like:

I now created an indoor scene using a set of shapes and a tree. I essentially set the color and called draw on the various objects. I also used for loops to create the potters which I thought were pretty cool. Then consecutively decreased their scale and built up inside of one another. To do this my code looked like this :
for i in range(1):
scale = 0.5
offset =+ scale * 87
hp.setColor( 'black' )
for i in range(20):
hp.draw(-150, -250 + offset, scale=scale, orientation=180)
scale *= 0.83 for i in range(1): scale = 0.5 offset =+ scale * 87 hp.setColor( 'black' ) for i in range(20): hp.draw(-150, -250 + offset, scale=scale, orientation=180) scale *= 0.83
Here's what my image looked like:

First, I made a tile. To do this, I defined tile with (x, y, scale) parameters and then set various colors and drew smaller squares inside of larger squares while adjusting their orientation . Here's what my tile looked like:

Then , to patch these tiles together into a quilt, I used a nested for loop that looked like this :

for i in range(Nx): for j in range(Ny): tile( (x+i*100)*scale, (y+j*100)*scale, scale*1)
for i in range(Nx):

for j in range(Ny):

tile( (x+i*100)*scale, (y+j*100)*scale, scale*1)

This for loop was in my mosaic function whose parameteres were (x,y) , scale, and Nx Ny which indicate the number of rows and columns. For this image, I made a 5 by 5 quilt.
Ta-Dah!

What I Learned:
I learned how to become more comfortable and efficient with my Classes and using top down design within them by calling parent classes in their child classes. I also understood more how to use the for loops, espeically with the Nx and Ny parameters.

Labels