Hmwk 13

Now that you have implemented the matrixType class, it is time to put it to use. For this homework assignment, you will implement a program that reads wireframe model data from a text file, displays the model, and allows the user to apply scaling, translation, and rotation transformations. Like our earlier image processing application, this program uses a command line interface. I've written the command line interface for you in Hmwk13.cpp so you can concentrate on the code for reading and viewing the model.

Available Commands

Below is the text displayed by the help command. It summarizes the commands available when this program is run.

In all the commands, items within square brackets are optional. For ex-
ample, the help command can be entered as "h" or as "help". Commands
are not case sensitive so the help command could also be entered as "H".

c[lear] - clear (reset) the transformation matrix.

h[elp] - Display this help message.

list - Display the names of the available wireframe data files.

l[oad] filename - load a wireframe model into memory from the specified
      file. (The default file extension is WF which may be omitted.)

m[ove] dx# dy# dz# - move the current scene using the specified increments.

q[uit] - Terminate the application.

r[otate] axis angle# - rotate the current view about the axis which is
     entered as a single character ('x', 'y', or 'z'). The angle is
     measured in degrees. Alternate versions of this command include
     rx angle#, ry angle# and rz angle#

s[cale] factor# - scale the current view by the given factor.

t[ranslate] dx# dy# dz# - same as move

v[iew] o[rthogonal] or vo - Set the viewing mode to orthogonal projection.

v[iew] p[erspective] or vp - Set the viewing mode to perspective view.

Wireframe Data Structures

There are three data structures used in this application. The first is a point3D structure which contains three double-type components: x, y, and z.

The second data structure is an edgeType structure that contains two integer components: first and second. The values of these components are the array indexes of the vertices that are the endpoints of the edge.

The third data structure is the wireframe model itself. The wireframe structure has four components: the number of vertices, a one-dimensional array of point3D structures to store the vertices, the number of edges, and a one-dimensional array of edgeType structures to store the edges. Notice that the maximum number of vertices is 1500 and the maximum number of edges is 3000 (as declared in the corresponding constant declarations).

Wireframe Data Files

A wireframe data file contains, in this order, the number of vertices, the coordinates of the vertices, the number of edges, and the indices of the vertices that define the edges. Here is an example file (where the text is not actually part of the file):

8              The number of vertices
1 1 1          Vertex 1
-1 1 1         Vertex 2
-1 -1 1
1 -1 1
1 1 -1
-1 1 -1
-1 -1 -1
1 -1 -1        Vertex 8
12             The number of edges
1 2            Edge from vertex 1 to vertex 2
1 4            Edge from vertex 1 to vertex 4
1 5
2 3
2 6
3 4
3 7
4 8
5 6
5 8
6 7
7 8            Edge from vertex 7 to vertex 8

Log on to the Asbury University network and navigate to my public classes folder (Q:\SEARLS). Copy any or all of the files in the "WireframeData" folder to the folder that contains your wireframe viewer project.

Your Job

You are to do three things:

  1. Add your name as co-author of this application.
  2. Implement the readModel function.
  3. Implement the viewModel function.

File Submission

 Submit your completed Hmwk13.cpp file and your project file as email attachments.