Keeping track of depth for later use

The following matrix is commonly used in computer graphics, and will be used here in our chain:

$\displaystyle T_p = \begin{bmatrix}n & 0 & 0 & 0  0 & n & 0 & 0  0 & 0 & n+f & -fn  0 & 0 & 1 & 0  \end{bmatrix} .$ (3.45)

It is identical to the matrix in (3.42) except in how it transforms the $ z$ coordinate. For purposes of placing points on the virtual screen, it is unnecessary because we already know they are all placed at $ z = n$. The $ z$ coordinate is therefore co-opted for another purpose: Keeping track of the distance of each point from the eye so that graphics algorithms can determine which objects are in front of other objects. The matrix $ T_p$ calculates the third coordinate as

$\displaystyle (n + f) z - fn$ (3.46)

When divided by $ z$, (3.46) does not preserve the exact distance, but the graphics methods (some of which are covered in Chapter 7) require only that the distance ordering is preserved. In other words, if point $ p$ is further from the eye than point $ q$, then it remains further after the transformation, even if the distances are distorted. It does, however, preserve the distance in two special cases: $ z = n$ and $ z = f$. This can be seen by substituting these into (3.46) and dividing by $ z$.

Figure 3.19: The rectangular region formed by the corners of the viewing frustum, after they are transformed by $ T_p$. The coordinates of the selected opposite corners provide the six parameters, $ \ell $, $ r$, $ b$, $ t$, $ n$, and $ f$, which used in $ T_{st}$.
\begin{figure}\centerline{\psfig{file=figs/eyeframe4.eps,width=3.5truein}}\end{figure}

Steven M LaValle 2016-12-31