# Pages CS 151 Computational Thinking Fall 2012 Natalie's CS151 Project 8 Natalie's CS151 Project 11

Title and Abstract: 3D Scenes, this project had two parts. First, to build 3D shapes using the turtle, and then to implement these into an abstract scene. For the project we built on the past couple project to include lsystems, shape classes, and styles. We also used recursion to make some more complex shapes. For the first task, I created four shapes; a box, pyramid, house (pyramid on top of a box) and an octahedron. I started out with the box and then advanced finally to the octahedron. I was able to create this by getting more comfortable with the 'roll' and 'pitch' parameters that were introduced in 3D Turtle. Since we were still working in turtle, just 3D, I was able to also implement different styles in my shapes, as you can see below I used the 'jitter3' style for my box, and 'dotted' style for my octahedron.

For the second task, I had to create a complex abstract scene, making it advanced with not as many code. Since I live in a city, I decided to make apartment buildings using many cubes stacked on top of each other. I used for loops with the y coordinate being y+i*100 to move the next 3D box on top of the previous one. I created multiple for loops to depict different buildings next to each other. I also used dotted, jitter, and jitter3 style as well as color differences to depict this. Finally in my scene I drew a pyramid to the right of the skyline. This is an abstract showing of where the ocean starts, I used parameters 'roll' and 'pitch' to angle the pyramid so that its base is at 90 degrees to the ground, showing that it is a plane of where the land ends and water begins.

For the third task, I had to do something interesting with my scene. I decided to add trees which utilized the lsystem needed during lab. I played with its parameters and lessoned the scale to put trees on the rooftops and make them seem farther away. I also made and abstract shark in my ocean using the house shape. I had to play around with placement as it was a challenge to put the shark inside the pyramid in 3D space. Also, in order for me to utilize the lsystem for the tree during lab, I had to adjust my code to import 'tree' and sys. Now in my command line arguments, I have to run the scene, add the lsystem and number of iterations. This scene also incorporated style because my tree uses 'jitter'. It was an exercise that helped me understand classes a bit more as well because I needed to make sure all parts of my code would connect to its parent class even when these were housed in multiple different py files.

For task 3 and extension, the something interesting I developed was making a 3D lsystem to depict a pine tree. We have not made an lsystem to represent this so I got my start off of GitHub. The lsystem I acquired needed some tweaking so I tweaked it and then looked at it in 3D space. If I looked at it from the top it was only 1/3 of the whole circle to make a full 3D tree. The solution I came up with was to run the system 3 times and use the 'roll' parameter to roll the system 60 degrees. In doing so, It completed the tree making it look like a pine tree. In total, I had the lsystem run 6 times, as I mad it full around, then I ran this same system again 100 units above the other one to make it a taller more realistic tree. I also included an image from the top as shown below.

What I learned: I learned how to draw 3D complex shapes by utilizing parameters such as 'roll' 'yaw' and 'pitch' It took me a bit of practicing to understand where the shape was being drawn in 3D space, but by making the last line drawn a different color, this helped me to see where the turtle was oriented and how I should proceed.

Sources, Imported Libraries, and collaborators:  I imported libraries: turtle_interpreter, shapes, sys, tree, and turtle3D. I worked with Stephanie Taylor in Lab, Emmett Burns in lab as well, Oliver Layton in office hours, and my tutor Andrew Turley outside of class.

Labels