Course Home | Class Schedule | Assignments | Git Submission | Perusall | Python | Tutoring

Saint Louis University

Computer Science 1300/5001
Introduction to Object-Oriented Programming

Michael Goldwasser

Fall 2018

Computer Science Department

Hands-on Day

Advanced Graphics


Mickey
One of the drawings in our previous activity was drawing the following image of Mickey Mouse on a 500 x 500 canvas.

This time, we wish for you to create that same drawing, but proportionally based upon a variable w that represents the width of the canvas. So if w=500 it should look like the above image, but if w=200 it should appear as follows.

Spoiler: my code


Ice Cream Cone
Write a script that draws this ice cream cone, but designed in a way so that it uses a variable w that defines the width of the canvas. Here are images of our cone drawn with w=200 and w=400.

As an aside, the scoop is a full circle, and if you look carefully, a tiny bit of it is visible aside the cone (dripping, I presume).

Spoiler: my code


Propeller
The blades of the propeller are ellipses having width 35 and height 200, prior to being rotated about their centers.

Spoiler: my code


Rotated Rectangle
The bigger rectangle in the following is 100 x 400, with one of its corners coincidentally positioned at coordinates (100,400), however it has been rotated 60 degrees clockwise from vertical (or -30 degrees from horizontal, if you prefer). Although you won't have the gridlines on your canvas, if you get this right you'll notice two of the other corners pretty close to the edges. We've placed a 100 x 100 square in the bottom left corner, to provide a frame of reference.

Spoiler: my code


Stick Figure (à la xkcd)
Create a layer containing all parts of this stick figure. If successful, you should be able to then add it to a large canvas and do something like

person.move(20,0)
sleep(0.5)
person.move(20,0)
sleep(0.5)


Spoiler: my code


Pine Trees
Create a pine tree as a layer, so that the bottom of the trunk is placed at the origin of the layer, as shown in the following model.

Once you've built that layer properly, you should be able to create a large canvas, add the tree to the canvas, and then create clones of the tree which can be scaled to other sides. The key is that if the base of the trunk is at the origin, then when scaled, all trees will "grow" upward.


Spoiler: my code


Michael Goldwasser
CSCI 1300/5001, Fall 2018
Last modified: Wednesday, 19 September 2018
Course Home | Class Schedule | Assignments | Git Submission | Perusall | Python | Tutoring