example tree image  

Programming Assignment 2

Due Monday, October 18 before lecture (by 12:59pm)

This programming assignment will introduce you to 3D modeling, basic display lists, and transformations in OpenGL.  You will develop a program that allows the user to control the growth and shape of a branching plant: a simple tree made of cylinders.  The tree is defined recursively using replacement rules for it's branches, using a simple constrained L-system.  Here is an example of a replacement rule as it is recursively applied to construct a tree.

base
base
base
base
base cylinder
after one recursion
after two recursions
after three recursions

Parameters of this example are: branching factor = 2, branching angle = 25 degrees, branch scale factor = 0.75, base length=5, base radius = 0.3. This means that the base has radius 0.3 and length 5.   Then at each recursion,  2 new branches are added to each existing branch tip.  Each new branch "leans away" from its parent branch by 25 degrees.  Each new branch is scale to 75% the size of it's parent branch.

Get Some Files 

Some basic functions and the plant tool's main program are provided for you. So, before you begin programming, you will need to download source files: You will also need appropriate files to compile and link your program.  The workspace for Visual C++ 6.0 is provided here:
By copying the above files, you have almost everything you'll need to build your own plant tool. You are expected to complete the program by writing appropriate functions in the template file.  There are comments in the template file that will help guide you in writing your own subroutines.  

Run the Example Plant Tool

An example of a fully functioning sketch tool is available: Run the example working plant tool to see how your program should work. The user interface to the program is provided through mouse buttons and keyboard:

The Code You Write

You should write all the functions you need to generate the tree's display list(s), draw the tree, and any helper functions.  The code you write will be submitted in the file myTreeFuncs.c 

Required for CS680 Students

Put leaves or flowers one the tree, at the end of each branch.  Algorithms for this will be described in class.

Extra Credit

Allow the user to control a random perturbation component (drawn from Normal distribution) that can be independently added to each of the parameters at each branch: depth, angle, length, and scale factor.  The user will press the Right arrow, left arrow to increase/decrease the variance, clamped to range [0,1]. Algorithms for this will be described in class.

Test Cases

A number of test cases are provided. They appear each time you press the T key. You can preview these test cases in the working example and compare the results with those of your own implementation.  These should help you in debugging your program.

Demo

Part of your grade for this programming assignment will be based on your giving a short demo (10 minutes) in the CS teaching lab. You will be expected to talk about how your program works, and we will see how well your program performs on the aforementioned test cases, as well as some additional, surprise test examples. Demos will be scheduled during the lab section meetings, after the due date.   You will be asked to sign up for a demo slot on a signup sheet that will be circulated in class before the assignment due date.  

Source Code Submission

Your program's source files are to be submitted electronically. Use the gsubmit program on the CS cluster.  At present, gsubmit is only available on csa.bu.edu and the Sun workstations in the CS lab. This probably means that you will need to telnet to csa.bu.edu to submit your program for grading.

The code you submit should conform with the program assignment guidelines.

Grading (Out of 100 points)

CS480

Proper translation, and rotation around tree base (in the tree-centered coordinate system) 30 points
Tree growth controls work (D, F, A, L, S) and working test cases
60 points
Programming style  10 points
Random perturbation control for plant parameters
10 extra credit 

CS680

Proper translation, and rotation around tree base (in the tree-centered coordinate system)
20 points
Tree growth controls work (D, F, A, L, S) and working test cases 40 points
Leaves or flowers
30 points
Programming style  10 points
Random perturbation control for plant parameters 10 extra credit

Late Assignment Policy

Late programming projects and problem sets will be levied a late penalty of 10% per day (up to three days). After three days, no credit will be given.

Collaboration/Academic Honesty

All course participants must adhere to the CAS Academic Conduct Code. All instances of academic dishonesty will be reported to the academic conduct committee.


Stan Sclaroff 

Created:  October 1, 2004