Project 1 Due 18 Sept ---DRAFT VERSION -- subject to refinement Modify the second example (Device.java, Parametric Curve and Friends) to draw 3D surfaces z = f(x,y,t) for fixed t. 1. Instead of Graphics::drawLine, use Graphics::fillPolygon. 2. Use the painters algorithm. (See the fludge allowed below.) 3. For parameters x_0, x_1, n_x, and y_0, y_1, n_y and t_0 let x_i = x_0 + i * (x_1 - x_0)/n_x y_j = y_0 + j * (y_1 - y_0)/n_y z_i_j = f ( x_i, y_j, t_0) then plot the poly (x_i, y_j, z_i_j), (x_(i+1), y_j, z_(i+1)_j), (x_(i+1), y_(j+1), z_(i+1)_(j+1)), (x_i, y_(j+1), z_i_(j+1)) 4. Base the back to front sort on the average distance from the viewplane. See java.util.Collections.sort. 5. Design an interface for which color to paint the patch. It must be general enough to a. Paint the color based on height (z) b. Paint the color based on (x, y) c. Paint the color based on the normal to the patch. d. or some combination of the above. 6. Drawing the surface for a pair of t0, t1 values on the same plot. 7. Spin it? <--- maybe later Sample Functions to test: ranges [-1,1]x[-1,1] z = sin(t*x) + sin(t*y) z = sin(t*x*y) z = exp(-x^2-y^2)*sin(sqrt(x^2-y^2)) The last one should have been z = exp(-x^2-y^2)*sin(t*sqrt(x^2+y^2)) Color functions: Blue to Red Ramp. Gray, based on normal dot with - viewNormal (negative values black, 1.0 white.) <-- hmmm... this will be too black. Have the values range from midpoint of white and black to white?