Pages Jonathan's CS151 Project 11 Page History

Key

• This line was removed.
• Formatting was changed.
Comment: Migrated to Confluence 4.0

Overview:

The purpose of this project was to enter the world of 3D coding. In order for us to be able to code in 3D, we needed to adjust a lot of our past codes. During lab, we added another variable, z, to our lsystem, shapes and turtle_interpreter files. We did not necessarily need to add new classes to these files, however wherever we had our x and y variables, we needed to add the z variable.

The first task asked us to create 4 new 3D shape methods. These methods were added on the our shapes class in the shapes file. All of the shapes were created by strings that get read in by our TurtleInterpreter class. Branching played a key role in coming up with the shapes and strings, as it allowed us to create more efficient strings. Below is an image showing my 4 new shapes:

I created a box, a house, a chair and a 3D triangle.

Task 2: For task 2 we were asked to make at least one of our functions recursive. I decided to choose my 3D triangle class, and to make my 3D triangle recursive. Below is my new 3D triangle function that uses recursion:

Task 3 asked us to incorporate the new shapes we created to make a scene. The scene could be abstract, artistic or realistic. I decided to make my scene realistic. My scene includes a bedroom that has a bed, 2 night stands, a lamp, flowers and tiled flooring. I used 3D methods for creating all of the shapes within the scene. Below is my scene for Task 3:

I particularly like the lamp that I created. 3D shapes cannot be filled properly, so I needed to improvise. I decided to use my 2D square method, set the color to yellow, and stack a bunch of squares on top of each other. Once that was completed, I added a black box around the cube in order to give it a nice touch of detail.