CSC 418/2504 Fall 2001 Assignment 2, Question 5.
Files:
The program uses three data files, which have the following format:
- Camera file (here's an example): this
lists the following information:
- nearZ : the distance from the eye to the image plane
(in CAMERA coordinates).
- leftX, rightX : the left and right boundaries of the
image, also in camera coordinates.
- bottomY, topY : the bottom and top boundaries of the
image, also in camera coordinates.
- width, height : the number of PIXELS in the image, both
left-right and up-down. This is in
DEVICE (ie, pixel) coordinates.
- A file describing the cylinder's shape (here's an example). It lists the following parameters:
- x,y,z : the position of the centre of the cylinder.
- radius : the cylinder's radius.
- height : the cylinder's height (from top to bottom).
- Finally, a file listing the pixels through which rays should be
cast (here's an example). The file
lists:
- n : the number of pixels.
- xi,yi : for i from 1 to n, the
coordinates of the pixels themselves.
NOTE: These are in DEVICE coordinates,
and both x and y behave like ordinary cartesian
coordinates. By this I mean, in particular, that
y increases as you go up, the image, not
down.
In the example given above, all the rays hit the BACK of the cylinder.
Here is an image with three sample rays, through pixels:
- a (180,220) HIT
- b (180,180) HIT
- c (150,150) MISS
The parameters are as follows:
Cylinder:
- (x y z) = (1 2 -5)
- radius = 1
- height = 2
Camera:
- nearZ = 1
- (leftX rightX) = (-1 1)
- (bottomY topY) = (-1 1)
- (width height) = (300 300)
Alejo Hausner,
Dept of Computer Science,
University of Toronto
Last modified: Mon Oct 22 15:53:10 EDT 2001