Another week, another project write up. I am very pleased with the result of this project; my images turned out very close to how I imagined them and I learned a
lot in the process.
To start off, we were instructed to make two different basic shapes. Thinking ahead to what I would need for my picture, I made a rectangle with adjustable hight and width, and a 45,45,90 triangle with adjustable scale. I also decided to make a heart basic shape, since I felt a little bad that one of my basic shapes was one that we used in class. I never used the heart in my drawings for this project, but I know it will be useful in the future. To test that my basic shapes worked for all sizes, positions, and rotations, I set up a function that would draw each one with random parameters three times. Though they overlapped a little, the resulting image proved that the basic shapes were indeed versatile.
A few shapes demonstrating their versatility.
Next, I had to make an aggregate shape out of the shapes I already had. Since I planed on making an outdoor scene first, I decided to focus on trees. The pine trees I made are fairly simple: a stack of increasingly smaller triangles atop a rectangle trunk. I changed the color of the triangles and the rectangle to be more tree colored, and adjusted the permitters so that the tree could be scaled. This was good, as the pine trees I ended up using in the scene were twice as big as the original tree. Another aggregate shape I made were the windows for the building. All the windows have four pains of glass, made of four blue rectangles with black borders, and a brown bottom, made of just one rectangle. Since I would be drawing ten windows, It was useful to have their making condensed down into on nice simple function. A third aggregate shape I made is not really an aggregate shape, as it was not made of any of the basic shapes from above, but made of circles and a unique trunk shape. However, this shape is my pride and joy, so I feel it should get a mention, as well as count as an extension. The birch trees are made of four basic parts: the base leaves, the trunk, the stripes, and the top leaves. The bottom layer of leaves are 20 radius circles, placed at random locations within a 100x100 block, and with random colors ranging from yellow to green. I achieved the random colors by only using the random.random function for the red color value, and setting the green and blue color value to 1 and 0 respectively. Then the trunk is drawn, which uses the turtle forward and goto functions to achieve it's shape. The lines on the birch trunk are drawn by a function that selects a random point along the trunk, and then draws a line between 1 and 10 px long (as the trunk is 10 px wide) across the trunk, and this is done on both sides of the trunk. Finally, the last part of the function draws another collection of leaves, these ones smaller yet more numerous, not achieve a nice layered affect. The result is a very complex aggregate shapes that looks like a birch tree, and is of course scalable and positionable. Also, it should be noted that the window function is rotatable, but both of the trees are not, but this is OK, but the trees are strapping young trees who always sit up striate.
A few trees showing off how aggregate they are.
Finally, the moment you have all been waiting for! The completed Colby scene depicts my very own dorm, Williams! (Which is part of Hillside)
Dorm sweet dorm
To make Williams, I used my aggregate shapes, as well as other shapes that I added in to make the picture more than just trees and windows. For the repeating shapes like the the windows and the white poles, I used a for statement that moved the position with every repeat, as demonstrated below:
This caused the white rectangle to repeat across the building, without having to write it out each time. I also took advantage of the fact that the turtle will draw over itself in the order of when each object is drawn to create a layered affect with the trees and the building.
The second Colby scene I drew was a vending machine, which had position, size, and three color variables.
Hope you're hungry for colored squares!
The vending machine also made use of the for statement to repeat like images, as that is how both the buttons and interior of the machine are made. As demonstrated for the food and clips below, I not only used a for statement in the y direction, but in the x direction too.
(The rings are also in this function, but not pictured for space purposes)
The snacks are designed to be random colors, as a vending machine that only dispensed one thing would be very boring.
As an extension, I decided to make some pop art. If you count the randomly colored snacks as only one color, there are four colors in the vending machine. I made some small edits to the code so that the snacks would not longer be random, and then had it repeat four times, with a different set of random colors each time. The result: Instant Pop Art!
If only it was a soda machine, not a vending machine. We could have pop Pop Art.
Well, that is my writeup for this week. I hope I was not too long winded. See you next time!