Geometric models used in computer graphics are made up of combinations of points, lines, planes, curves, surfaces and other geometric primitives. The goal of the first two programming assignments is to create two geometric models. In this assignment, the goal is to create a model made from "rectangular blocks". The next programming project will create a geometric model made of "generalized cylinders". The detailed requirements for this assignment are listed below:
Rectangular building blocks are familiar children's toys, so it is relatively easy to visualize how a number of every day objects are constructed from blocks. For example, a variety of tables, chairs, book cases, and other household objects can be modeled by placing different sized rectangular blocks at different positions. Your task is to write a C++ function to generate a graphics model of one of these rectangular objects.
Start by drawing some diagrams of your geometric object from the front and from the top, showing all of the blocks that make up your object. To keep things simple, align your object with the (x,y,z) coordinate axes, and use the x-axis for "left-right", the y-axis for "up-down", and the z-axis for "near-far". Once you have done this, decide what units you want to use (e.g. inches, feet, centimeters). Then choose one point as the origin (0,0,0) and label all other points in your object with appropriate (x,y,z) values in these units.
Once you have drawn and labeled your geometric object, write a C++ function that prints out the coordinates for each of the rectangular blocks in your model in the following format: "block Xmin Ymin Zmin Xmax Ymax Zmax" with one block per line. Run your program and check that these values match your diagram.
Your next task is to generalize your function so the you can "scale" your object up or down by multiplying all of the coordinates by a floating point scale parameter. Your final task is to "position" your object. To do this, add three parameters corresponding to the desired (x,y,z) coordinates for the origin of your geometric object.
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. Run your program with a variety of input values, and save your output in text files for submission on the program due date. To visualize what your model looks like, compile the sample program "model_view.cpp" and run "./model_view model.txt". You should see a wire frame display of your geometric model. Use the 'x' 'X' 'y' 'Y' 'z' 'Z' keys to rotate your model on the screen to see how it looks. Finally, save a sample screen capture of your model to include in your project report.
When you have completed your C++ program, write a short report (less than three pages 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 PDF file 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" your documentation, C++ 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.