For project 10 we worked on creating a line styles that could be used to create images that were non-photorealistic. In addition we implemented recursion in our functions allowing us to draw shapes repeatedly. In project 11 we added the complexity of another another dimension. The purpose of these two projects was to gain experience with classes and to uses everything we have learned over the course of the semester and create a complex image with simple code.
In project 11 we began drawing images in three dimensions the class system that we created in the previous projects allowed us to draw in three dimensions quite easily. The ease at which we were allowed to draw in 3D is largely related to the similarities between all of the shapes and the strings we use to draw all the shapes. By adding 4 else if statements to the drawstring method in our interpreter class we were able to draw complex three dimensional trees. In addition to a symbol that tells the turtle to turn left or right in relation to the x- plane we also added symbols to tell the turtle to turn left or right in relation to the y-z plane or the x-z plane. After adding those if statements we could easily add them to a sub-class of the Shape class and draw three dimensional shapes.
For the first extension I did I first thought about splatter paint and the what it looked like and how I could recreate it using turtle. The thought came to me that splatter paint looked like blobs and lines. To create such a line function I added to my forward method in the interpreter class a line with a dot line style and named it pollock.
For my second two extensions I got a little help with where to look for the solution to that problem: "how can I get the turtle to respond to my clicking?" After finding the right mouse button call back method in the turtleTk3D file I was able to create a function of my own that called the function P.draw at the location of the mouse click, when I clicked on the turtle window. After creating that function it was much easier to understand and create a function that responded to the mouse's motion. However, that function could only handle drawing 2D shapes or else it was too slow.
The following image shows the four 3D shape classes I created.
The rectangular prism can be draw with any width, height and depth the user desires.
The following image uses both the shapes classes I created and the Tree classes that uses Lsystems to draw plants. The images is intended to be a child's drawing of outer space and thus is surreal and makes use of the jitter line style.
the following image shows examples of the three extentions I did.
the cube was drawn using the pollock line style, the yellow hexagons were drawn by dragging the mouse and the purple pyramids were drawn when I clicked on the turtle window.
This project taught me how to have something happen after I run the program from terminal. In addition I learned how to use the 3D turtle package and think about my shapes in three dimensions. More generally, the past few projects have taught me the value of classes and how to create simple code to produce complex results.