The goal of this programming project is to initialize the surface that will be the "ground" for our virtual city. Your task is to create an N by N grid of rectangular polygons with "ground like" elevation changes. To display your grid, you can use the GL_LINE_LOOP option. To see the surface from different positions, you should use keyboard-based scene rotation from hw#2. The task of adding buildings and other objects to your virtual city will be in hw#4.
There are many ways to create this surface, so the choice is up to the student.
Option #1: Specify the (x,y,z) coordinates of the four corners of the N by N grid, and use a recursive subdivision algorithm to divide the rectangle into four sub-rectangles, and add random changes to (x,y,z). The surface will look smoother/rougher depending on how large the random change is relative to the size of the initial retangle.
Option #2: Initialize the surface using a function of the form z(x,y) for a user specified range of (x,y) values. Something that combines multiple sin or cos functions or low order polynomials will give a smooth surface. You can make the surface rough/bumpy by adding random z values to every point.
Option #3: You can use random values to initialize your z(x,y) surface and use local averaging to smooth this down to look more like a "ground" surface. A typical smoothing approach is to replace each z(x,y) value with the average of the 4 or 8 adjacent values. It may take several smoothing loops to get a surface that is smooth enough.
You can implement this program using either a bottom-up approach or a top-down approach. If you go for a bottom-up approach, start by creating basic functions and classes, and test theses functions using a simple main program that calls each method. When this is working, you can create the main program that uses these functions to solve the problem above.
If you go for a top-down approach, start by creating your main program that reads user input, and calls empty functions to pretend to solve the problem. Then add in the code for these functions one at a time. This way, you will get an idea of how the whole program will work before you dive into the details of implementing each method and class.
Regardless of which technique you choose to use, you should develop your code incrementally adding code, compiling, debugging, a little bit at a time. This way, you always have a program that "does something" even if it is not complete.
Test your program to check that it operates correctly for all of the requirements listed above. Also check for the error handling capabilities of the code. Try your program on 2-3 input documents, and save screen shots and/or testing output in text files for submission on the program due date.
When you have completed your program, write a short report (less than one page long) describing what the objectives were, what you did, and the status of the program. Does it work properly for all test cases? Are there any known problems? Save this report in a separate document to be submitted electronically.
In this class, we will be using electronic project submission to make sure that all students hand their programming projects and labs on time, and to perform automatic analysis of all programs that are submitted. When you have completed the tasks above go to the class web site to "submit" or "upload" your documentation, program, and testing files.
The dates on your electronic submission will be used to verify that you met the due date above. All late projects will receive reduced credit (50% off if less than 24 hours late, no credit if more than 24 hours late), so hand in your best effort on the due date.
You should also PRINT a copy of these files and hand them into your instructor in your next class or put it his mailbox in the department office. Please print and include a copy of the programming project evaluation form as the title page of your report.