Exercises Chapter 7

1(a) The OpenGL utilities library provides a function to specify a 3D view:
gluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez,
	      GLdouble centrex, GLdouble centrey, GLdouble centrez,
	      GLdouble upx, GLdouble upy, GLdouble upz);
eye = (eyex,eyey,eyez) is the centre of projection, centre = (centrex,centrey,centrez) is a reference point, and up = (upx, upy, upz) is the up-vector. Derive the matrix that transforms a World Coordinate (WC) point into the 'viewing coordinate system' (or 'eye coordinate system') specified by eye, centre and up. (Remember that OpenGL operates a right-handed coordinate system throughout).

1(b) Suppose that eye=(0,0,0), centre = (3,0,4) and up = (0,0,1). What coordinates in the viewing coordinate system would the WC point (0,1,2) have?

1(c) The view plane is 1 unit along the positive z axis. To what point on the view plane will the WC point (0,1,2) be projected?

1(d) Suppose the view plane window is between -4 and 4 in both x and y, and the display window size is 1000 by 1000 pixels. To what actual pixel will the WC point (0,1,2) be projected?

2. A camera is modelled as follows: the View Reference Point is at (-3,1,5), the camera is pointing at the centre of the cube defined by A,B,C,D,E,F,G,H in the following diagram, and the View Up Vector is (0,1,0). Where does the point A map to in camera coordinates?


3. (Harder, refer to Chapter 11) Calculate which faces of the cube A,B,C,D,E,F,G,H are visible to the camera that was defined in question 2?


Back to: Index of Exercises
Back to: Chapter 7

Last modified: Sun Jul 20 20:53:52 BST 2003