CMSC 435/634: Computer Graphics

Lab 3: 2D Transformations and L-systems

Due October 20, 2000



Image by Deborah Fowler


The Assignment

Your assignment is to create a lab that produces growing 2D plant models based on L-system growth techniques.

Your program should follow this specifications: When started, the program displays a window with the following menu buttons Plant1, Plant2, Plant3, Write PPM, Clear, and Exit.

When the user clicks the left mouse button on one of the menu buttons the following action takes place:

Plant 1
The program uses the following production rules to create the next gneration plant. The initial seed is "X"
Rule 1: X = F[+X]F[-X]+X
Rule 2: F = FF
Angle: 20

Plant 2
The program uses the following production rules to create the next gneration plant. The initial seed is "X"
Rule 1: X = F[+X][-X]FX
Rule 2: F = FF
Angle: 25.7

Plant 3
The program uses the following production rules to create a the next gneration plant. The initial seed is "X"
Rule 1: X = F-[[X]+X]+F[+FX]-X
Rule 2: F = FF Angle: 22.5

Example Output

The starting location for drawing each plant should come from the location of the next mouse button press. The initial orientation of the plant should be straight up. Each repeated press of the same plant button should grow a new generation. It is intended that multiple plants can be grown in the same image; don't clear the window unless explicitly requested.

Positive rotation is counter-clockwise. The terminal symbol F indicates move forward a step of length d. Draw a line from the previous location to the new location. You should choose an appropriate initial value for the length of the plant stem (d) . For each successive generation, scale the plant segment length by 70%. The non-terminal symbol "X" should not be drawn. Your program should be able to handle 8 generations of plant growth.

Extra Credit

All of the extra credit should be done with new buttons. The points will be given by how realistic of a result the algorithm generates, so experiment with reasonable amounts of randomness to add to each of these variations.

Make your results as realistic as possible. Each of these should be added on additional buttons, so that Plant1 and Plant2 give the deterministic results described above.

Turn in your assignment by using the submit mechanism on gl. Include your c code, your Makefile, and an example ppm image produced when your program is run on the sample input. Use the project name 'lab3'.Your comments should include the environment (hardware and software ) that you used to develop your program as well as a description what outside help you got .


Main Page | Syllabus | Class Calendar

Course Assignments & Handouts | Links | Reading List