CS465 Fall 2006 Homework 7 Solution ------------------- 1.1 Using the given image width and height, nx = 12/2 = 6, ny = 8/2 = 4 so M_vp = [6 0 0 5.5] [0 4 0 3.5] [0 0 1 0 ] [0 0 0 1 ] 1.2 We know n and f. r and l (b and t) can be derived by transforming 2 eye-space vertices into pixel space and solving the system of equations for the first (second) homogenized coordinate. This gives l=-3 r=3 b=-2 t=2 and the matrix M_proj = [-5/3 0 0 0 ] [ 0 -2.5 0 0 ] [ 0 0 -9/7 -80/7 ] [ 0 0 1 0 ] 1.3 This simply involves multiplying M_vp*M_proj*V for each vertex, and dividing by w. (1.75, 0.75, 1/7) (8.25, 0.75, -4/7) (5, 5.75, -5/7) 2.1 Barycentric coordinates: alpha, beta, gamma Canonical depth: z' Texture coordinates: u/w, v/w, 1/w 2.2 The point has relative height of 2.25 pixels, and the top vertex has height 5. Thus Gamma = 2.25/5 = 0.45. From symmetry, alpha = beta = (1.0 - 0.45)/2 = 0.275. 2.3 Barycentric coords from 2.2: 0.275, 0.275, 0.45 z' = 0.275*(1/7) + 0.275*(-4/7) + 0.45*(-5/7) = -123/280 = -0.439285 w = original depth of point; so 1/w at vertices = -1/8, -1/16, -1/20 and u/w at vertices = 0, -1/16, -1/40 v/w at vertices = 0, 0, -1/20 u/w = 0.275*0 + 0.275*(-1/16) + 0.45*(-1/40) = -91/3200 = -0.02844 v/w = 0.275*0 + 0.275*0 + 0.45*(-1/20) = -9/400 = -0.0225 1/w = 0.275*(-1/8) + 0.275*(-1/16) + 0.45*(-1/20) = -237/3200 = -0.07406 2.4 u = (u/w) / (1/w) = 91/237 = 0.38397 v = (v/w) / (1/w) = 72/237 = 0.30380 This result can be verified by reprojecting the pixel into world space, finding barycentric coordinates there, and interpolating u,v.