CSC418/2504F, Fall 2000: Assignment 2, Question 5

Here is a skeleton program for you to modify. It should be invoked as follows:
intersect [camera-file] [x1 y1 polygon-file1] [x2 y2 polygon-file2] ...
The camera file describes the image dimensions and the perspective view volume. It contains 2 integers (H and W, the height and width of the image in pixels), and 6 floating-point numbers, which describe the view volume (left, right, top,bottom, near, far).

NOTE: The front and back clipping distances (near and far) are given as positive numbers, as in the openGL function glFrustum, but the camera looks towards the negative z-axis!.

Polygon files describe one polygon each. They contain 1 integer (n, the number of vertices), followed by 3n floating-point numbers, giving one (x,y,z) triple for each vertex.

Looking for some test cases? They are here.


Alejo Hausner, Dept of Computer Science, University of Toronto
Last modified: Tue Oct 24 16:00:31 EDT 2000