# Pages Put on your 3D glasses...

... because project 11 is coming at you!

Wow, what a week it has been.  Making the turtle 3D just adds a whole new dimension to these projects, not to mention a whole new area of puns to exploit.  I promise I won't make any more.

Our overall task this week was very simple:  Make a scene in 3D.  However, as usual, this main task was broken up into sub-tasks.  Our first task was to create at least four different new shape objects.  In the end, I created 11 shapes, though half of those were filled versions of the other shapes.  The shapes were a Cube, a rectangular prism, a rectangular pyramid, a triangular pyramid, and a sphere.  I also updated my Rectangle object so that is used parameters instead of repeated Fs of length 1.  My five favorite shapes can be seen below drawn in my styles, which were updated to 3D.  A striate-on view is compared with a slightly angled view.

For my scene, I decided to make a lovely little house.

Inside the house, there is a bed...

... a doorstop...

... and a lamp.

The thing I am very proud of is how I made the inside of the walls a different color that the outside.  I did this by placing the rectangles that made up the walls in exactly the same location, but the blue walls would be closer to the center by one.  Because they were the same size and therefore had the same midpoint, they would always appear in the correct positions relative to each other.  I wish I could say the same for the bed.

Above is a view from the bottom, and a view from the top with the roof removed.

Above is a frame version of the house, so you can see all of the interior at once.

Below, someone bought a play version of the house, proving it is scalable and positionable.

For my extension this week, I made a tree using a recursive function.  It would take in a desired length, and then make each successive branch half the length, until it reached the base case, which was when half the previous length was less than one.  Then, it would return a leaf.  Below is the code for the recursive function, followed by the tree.

Because I made it that the function returns a string, I made a Geomatree object in my tree file that used this function as the string.

I also made a 3D version of the function, which is basically the same as the 2D version, but has branches in the zy plane as well as the xy plane.

As the length of the base trunk increased, the iterations also increased, allowing you to draw denser trees.  The scale on the tree could also be changed, so even if you increased the trunk length, you could shrink the tree to be the same size, so it could be the same sized tree with more iterations.

I also had another extension I wanted to do, but I ran into problems and could not figure out how to fix them.  What I was attempting do to was read in a pixmap image, vary the colors of the image slightly, and then draw random points from the pixmap in the turtle window using different shapes, such as lines or circles.  The goal of this whole process was to take pictures from my earlier project and make them look more like the paintings from the extension from my last project.  Alas, only one of the three parts of my plan worked.

So that you are not completely confused by the pictures of my failure, here is the original image:

However, trouble began when I tried to draw the pixmap in the turtle window, without even changing the color of the pixels.  For some reason, only the blue and white colors went through, everything else showed up as black.  (the image appears pixely because I was drawing with very small circles.  )

My color shifting function did not work very well either; it looked more like a broken TV set than a snow globe.  This might, however, be continued manifestation of whatever was causing the first problem.

However, my idea of using circles to create a sort of 'scaly' appearance did work.

This week I learned about many new things.  I learned about pitch, yaw, and roll, which actually was not to hard to learn, as they have the same meaning in the turtle as the do on a boat.  I would often imagine the turtle as a boat for this project.  I also learned about recursive functions, how to use them, and how to make them.  I also spend a lot of time thinking about 3D space, and how to make things appear the way you want them to appear within the limitations of that space.

I've had a lot of fun taking this class; thank you for an excellent semester.

-Lizzie T.

Labels