In our sixth project, we used L-systems to create complicated shapes that we could use in a scene. The goal of this project is to experiment with L-systems using an interpreter that converts long text files into turtle commands.
In the first part of the project I created a winding spiral. I did this by increasing the angle and the length as a function of i in a for loop. I also incorporated two other L-systems using systemA1 and systemB.
Picture 1 shows the winding spiral pattern which used two different L-systems. It also shows the two other images of the two other lsystems in the center.
In the second part of the project I created a 3 by 3 grid of plants. Each of these plants increased in number of iterations as you moved across each column and increased in angle as you moved up the grid. I did this using a list for each lstring and a list for each angle. In two nested for loops, I called for the ith number of each lstring and jth angle from these two lists.
Picture 2 shows the grid of plants which increase in number of iterations to the right and decreased in angle moving down.
In the third part of the project I made two different plants using two more L-systems. I incorporated different iterations of these plants in a scene with a tree and a building. I used turtle to create different objects which I called for in the main() function.
Picture 3 shows the scene with a number of different plants around a building.
As two more extensions of this project, I made a 3 by 3 grid, each of the original 3 by 3 grid of plants done in part 2 of the project. Each of the smaller grids contained a color changing function which was implemented in the for loop of the smaller grids. As a second extension, I made each of the smaller grids a moveable and scaleable object using three parameters (x,y, and scale). I then made a 3 by 3 grid of each smaller grid which would increase in size moving upward and towards the right.
The Code Snapshot shows the two nested for loops which made a 3 by 3 grid of grids. I used an if statement so that the lower left grid would be visible.
Picture 4 shows the two extensions that I undertook by modifying the grid.py file. As you can see, I made a 3 by 3 grid of each grid that contained L-system objects that changes color.
I learned how to use a three step process of working from a system to create a string which was then converted to python commands. I also learned that with the same L-system we can make different patterns by using different angles and a different number of iterations. I found it interesting that we can mimic the shapes of different plants by using L-systems.