#### Keeping track of depth for later use

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

 (3.45)

It is identical to the matrix in (3.42) except in how it transforms the coordinate. For purposes of placing points on the virtual screen, it is unnecessary because we already know they are all placed at . The 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 calculates the third coordinate as

 (3.46)

When divided by , (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 is further from the eye than point , then it remains further after the transformation, even if the distances are distorted. It does, however, preserve the distance in two special cases: and . This can be seen by substituting these into (3.46) and dividing by .

Steven M LaValle 2020-01-06