Matt's Project2- Maine Outdoors
Skip to end of metadata
Go to start of metadata

This is the write-up of my second CS151 project, focused on using python and turtle graphics to draw scenes from the Maine wilderness. The task of this project was to use a library of functions, titled "", as a template for the more complex "" document that housed the functions for two scenes that I imagined in the beautiful state of Maine. At the beginning of my "" document, I had to import both the "turtle" and "shapelib" modules in order to draw the shapes I had made in the other document. Using the simple shapes defined in "", I organized various combinations and colors to create one scene from a woodland region of Maine, and another scene from the coastal region. 

The first step of this project was to write functions that would draw simple shapes that I would be able to incorporate later on. I chose to draw an isosceles triangle of base = 2/3*height,

and a diamond of apex angle = 53.14 degees. Because adjacent angles were not identical, I did not use a loop function here. Instead I just wrote the code for a square shape with different calculated angles.

I then created more complex shapes from combinations of smaller shapes within the shape library. The first was a pine tree made of a block (stump) and 4 isosceles triangles overlapping each other.

The final edition of the code for this tree incorporates filled coloring, which was my first attempt at an extension.

The second shape that I created was a brown leaf made of a block (stem) and 3 diamonds, each diamond sharing a single side with the other(s). The trick to this shape was rotating each diamond so that sides would share the same vector in two dimensions but would not overlap. 

As I was thinking of my first scene, I realized that I wanted to incorporate a sun in the background. My second and third extensions were to make more shapes for my scenes, so I drew a sun using a "for" loop. I remembered seeing Colin Sheehan's 36-square shape in his Project1 and realized that a similar strategy could be used for triangles. I defined an even thinner "superisoTriangle" that started at a corner that I would be able to rotate around. I told turtle to rotate the cursor 18 degrees upon completion then, using the "for" loop, I was able to repeat that shape 20 times (18*20=360 degrees of a triangle).

I then filled the shape with a single color and got the pointed-sun that I desired. 

In addition to the sun, I made a function that drew a simple rock (to be used in my second outdoor scene) that could also look like a mountain (in my first outdoor scene) using basic geometry, and colored it purple because that was the color I would make my mountains. 

Finally, I was ready to make my two outdoor scenes of all the shapes I had in "". The first is meant to represent the image a hiker sees when looking at a sunset over the mountains during the fall.
My second shape drew inspiration from an view I had this summer from Acadia National Park, overlooking the ocean and sunrise in the east.


In conclusion, I learned how to organize shapes to all fit on the same screen correctly. The most important part of that learning came from understanding the initial/final positions of the cursor after it draws a shape. Once I had defined my shapes correctly and could maintain control of where my cursor was going to be and in which direction it would draw, I was able to create the images I wanted to make. 

I referenced Python Docs for information on how to draw my code faster. I also referenced the lab exercises and my notes frequently for correct notation of coding for the "for" loops, shapes I wished to draw, and doc strings. I did not personally consult a professor or TA, but I did reference Colin Sheehan's circle drawing in his project1.