Theory

This section is a brief overview of the algorithm used in the applet.


Viewing system

Explicit polygon lists which consists of a vertex list and a face list define a polyhedron. The data in the vertex list is supposed to be specified in world coordinate system. In this project, all faces of the polyhedron are supposed to be triangles, which means all the entries in the face list should specify exactly 3 vertices.

  1. All the faces of a polyhedron are disassembled into each triangles specified by 3 vertices.
  2. Three points in each face are transformed from world coordinate to view coordinate.

    Fig.1 View coordinate

    parameters used in this program

    d = 500, h =50, Far plane = INFINITY
    C(camera location) = [0,0,600]
    N(camera direction) = [0,0,-1]
    V(camera up vector) = [0,1,0]

  3. A normal vector of each face is calculated for the light reflection.(see below)
  4. Each polygon is again transformed from view coordinate to screen coordinate.

    Fig.2 Screen coordinate

  5. Each face is stored in a queue.
  6. The queue is sorted according to its distance from the screen(Zv) in screen coordinates.
  7. From further polygons(triangles) to closer ones, each polygon in the queue is projected on the view screen.


    Lighting

    Only the diffuse component in the Phong reflection model is taken into account in this program. The light direction is fixed at [ 0, 0, 1]