The purpose of this week's project was to familiarize ourselves with classes, including trees and shapes, and then manipulated them into scenes. For the first task, we created a Tree class which used the lsystem and shapes files, along with modifying functions, to draw trees in more condensed code. The output of six drawn trees (required image 1) is shown below:
In task 2, we added more child classes of shapes, including filled-in shapes. I added a rectangle, hexagon, pentagon and diamond (all were easily modified to be filled for later tasks, except the pentagon). Most of the shapes (I added more after I took this picture) are shown below for required image 2:
For the third task, we made an indoor scene that incorporated the shape as well as the tree classes. Required image 3 is shown below, with a painting, vase/plant, and window that shows the sun (a "swirl" of filled triangles):
Finally, we used the shapes to create tiles that could then be made into mosaics. The first tile/mosaic is a collaboration of squares and diamonds. The second is a pattern of hexagons (an extension).
The basic for loop to create the mosaic was: for i in range( Nx ): for j in range( Ny ): tile( x+(100*i)*scale, y+(100*j)*scale, scale )
for i in range( Nx ):
for j in range( Ny ):
tile( x+(100*i)*scale, y+(100*j)*scale, scale )
So I could have easily changed the colors....but I didn't...sorry about that
Over the course of this project, I learned how easy it is to make more intricate scenes using top-down design, in which multiple classes/functions are called into one main function. I also became much more comfortable with classes.