Versions Compared


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

In this project we further modified our turtle_interpreter and shapes python files from last week. These programs draw pictures using strings of characters, and this week we made these pictures look more hand drawn by making the computer jitter the lines as it drew. Another component we added was the ability to put numbers in a string of characters, which tell the computer how long to make a line or how much to turn.

We implemented a jitter in the lines by modifying the forward function of the turtle interpreter class. Normally this function simply moves turtle forward by the parametrized amount, but here we modified it to draw that line invisibly, record the start and end points, move those points a little bit using the random package, and then redraw the line, this time visibly. We also made an option for the forward function to draw the jittered line in three parts. The results look like this:
Next we added a dotted line option, which draws a line of dots that corresponds in length to the parameter distance. All of the different drawing styles on my three different shapes look like this:

Next I modified my file from last week to make use of some of these new drawing styles. Although drawing style is stored as a field in the TurtleInterpreter class, a Shape object can modify that value by calling one of TurtleInterpreter's mutator methods. Therefore, in my indoor scene file, which makes no references to turtle_interpreter, can still change the style of drawing thru the Shape objects. Here's my picture:
Next I modified to lsystem sysTree to make more randomness and asymmetry in the drawing. The results look like this:
In this project I learned how randomness in computer graphics can create more lifelike or humanistic images. I also learned how classes interact with each other, as well as how you can make a computer algorithm for getting more advanced information from a string than simply its characters.