Theory
Outlined below is the theory behind the viewing system used in the
Camera and Perspective Transforms.
World CoordinateSpace
The object in the World Coordinate space is represented in a .obj file
as a set of vertices and a set of face list. The object is displayed as
a Wireframe Model. The Viewing Frustrum in the World Coordinate Space
is displayed using Inverse Camera transforms. The inverse
transformation used is defined below.
![](theory1.gif)
View Coordinate Space
To calculate the viewing transforamtion that transforms the object
from the world space to the view space the following parameters ar
required. These parameters are defined in the World Coordinate Space.
- The Camera Position (C) which is the Look From Position and is also
the center of projection.
- A Viewing Direction vector N (the positve Zv axis) which is a
vector normal to the view plane.
- An Up Vector (V) that orients the camera about the view direction
and establishes with N the orientation of the view plane window within
the view volume.
- A vector U to denote the direction of increasing "x" in the eye
coordinate space. This establishes a right-handed or Left-handed
coordiante system.
The transformation from world coordinate to view coordiante space
is carried out using the Tview matrix.
![](theory2.gif)
The Viewing Frustrum is displayed in the view space using the Near
Plane distance, the far plane distance and the Screen height. The View
Plane is coincident with the Near Plane. The view volume is a
truncated pyramid in the view space against which we clip the
object. The view volume is defined by six planes
![](theory3.gif)
The View Window is square as specified by the Screen Height and
symmetrically disposed about the "center" of the view plane.
Screen Coordinate Space
The Perspective Projection that is used to trnasform the object from
View space to Screen space is as follows.
![](theory4.gif)
The View Window in the Screen Space is drawn with values of X and Y
ranging from [-1 1] and in the range of [0 1] for the Z axis.
Clipping
Clipping is carried out in the view space. The object is clipped
against the six planes of the view volume using Cohen-Sutherland Line
Clipping Algorithm.