CPTR 425 Computer Graphics Assignment 3

Write a C++ program that reads in a text file containing information for polylines in the same format as dino.dat.

In class we explained the format of the polylines file. The first number is the number of polylines. Each polyline is represented by a number specifying the number of segments making up the line, followed by a list of points that constitute the end points of those line segments.

Your program should allow the user to pan the image left, right, up, and down with the arrow keys. The user should be able to zoom in and out with the < and > keys. The zoom should be centered at the center of the window. The user should be able to rotate the image clockwise and counterclockwise by pressing the R and T keys, respectively. The rotation is about the center of the window. Holding down the shift key causes the speed to the transformation to increase (for example, the right arrow key moves the image to the right by one pixel distance, but shift right arrow moves the image by 10 pixels).

The window is 640×480, and with no transformations, the original dinosaur picture should look like:

After panning to the left (so the image moves right) we get

subsequently zooming out (and thus shrinking the image), we get

and after rotating it about 45° clockwise we get

You should alter neither the viewport nor the window dimensions to achieve the transformations; instead, transform the points of the polylines to alter the image within the window.

Please submit your completed source code to eclass.