The purpose of this lab is to introduce the concept of non-photorealistic rendering and give some practice with designing modifications to the current system to make NPR easy to implement.
The first task is to create another jitter function. This time the jitter will be three lines instead of one. The figure will look like three line segments, criss-crossing jittered lines. The first task is to get the length of the whole line segment using the initial and final position of the turtle as the end points. Then, divide the length by three. I copied the whole structure of the jitter style and add the divided lengths as the initial and final points of each small line segments.
Here is the result of the task with the normal style, jitter style, and the jitter3 style:
The next task is to create a dotted line. The first task is to create a variable that holds the number of dots per line, called num_dots. To do this, I use the math.floor function. Then, with a for loop function, I first call the turtle.circle function to draw the first dot and then put the turtle on the position of the second dot. The for loop will repeat itself by the number in num_dots divided by two.
Here is the result of the task with the normal style, jitter style, jitter3 style, and the dotted style:
The third task is to use the indoor scene from the last project and apply the different stroke style in the image. I first copied all the functions that create the indoor scene. Within each function and just right before it draws the image, I call the setStyle method and set it to either normal, jitter, jitter3, or dotted.
Here is the result of the task:
The final task is just creating a new L-system. I based my design on my Project 8 L-system and grab inspiration from it. I improved the L-system by incorporating new objects and colors to the design. To make my L-system look nice, I set it inside a frame which is drawn with a jitter style.
One of my extension is similar to the last task - creating new L-system. This time, I grabbed my inspiration from my first L-systems. Again, I improved the L-system by incorporating new objects and colors to the design.
The second task is to create a new stroke style. This time, I created a brush stroke style. In order to make this, I first set an if statement indicating what will be the y and x distance from the initial and final points. And then, I created a for loop that draws 5 parallel lines for each if statements. In addition, I made each parallel lines one shade more than the last.
Here are my designs:
It is interesting that I can change the stroke styles by just adding new methods and functions to the system. In addition, more stroke styles can be added by just being creative or reverse-engineer the copied stroke styles. This is a new and fun way to make the scenes more interesting.
Thanks to Prof. Kyle Burke for helping me!!!