Implement a hidden surface algorithm using the Depth Sort algorithm. Ignore the issue of clipping polygons to the viewing volume. Demonstrate the algorithm with a non-trivial example such as a pair of cubes.
Due Date: Nov 8
This requires that you add a polygon_3() primitive to your 3D package. This might have the form: polygon_3(color,n,x,y,z) x,y,z arrays of length n
You will need to add a 2D polygon primitive to your 2D graphics package if you did not already do so, in order to support the 3D polygon capability. This might have the form polygon(color,n,x,y) x,y arrays of length n In practice, because of Assignment 4 everyone already has a 2D polygon primitive working, although it has not been used except in test_x11.
While transforming and projecting a polygon from 3D to the screen is no harder than for a line (i.e. just project the vertices, then call a 2D polygon routine), the real issue is to handle the fact that one polygon may hide part or all of another as seen by the viewer (COP or DOP). This is the core of the assignment.