i
i
i
i
i
i
i
i
1.5. Numerical Issues 5
ditional geometric coordinates and a fourth homogeneous coordinate that helps
with perspective viewing. These 4D coordinates are manipulated using 4 × 4
matrices and 4-vectors. The graphics pipeline, therefore, contains much machin-
ery for efficiently processing and composing such matrices and vectors. This
4D coordinate system is one of the most subtle and beautiful constructs used in
computer science, and it is certainly the biggest intellectual hurdle to jump when
learning computer graphics. A big chunk of the first part of every graphics book
deals with these coordinates.
The speed at which images can be generated depends strongly on the number
of triangles being drawn. Because interactivity is more important in many appli-
cations than visual quality, it is worthwhile to minimize the number of triangles
used to represent a model. In addition, if the model is viewed in the distance,
fewer triangles are needed than when the model is viewed from a closer distance.
This suggests that it is useful to represent a model with a varying level of detail
(LOD).
1.5 Numerical Issues
Many graphics programs are really just 3D numerical codes. Numerical issues
are often crucial in such programs. In the “old days,” it was very difficult to han-
dle such issues in a robust and portable manner because machines had different
internal representations for numbers, and even worse, handled exceptions in dif-
ferent and incompatible ways. Fortunately, almost all modern computers conform
to the IEEE floating-point standard (IEEE Standards Association, 1985). This al-
lows the programmer to make many convenient assumptions about how certain
numeric conditions will be handled.
Although IEEE floating-point has many features that are valuable when cod-
ing numeric algorithms, there are only a few that are crucial to know for most
situations encountered in graphics. First, and most important, is to understand
that there are three “special” values for real numbers in IEEE floating-point:
1. infinity (∞). This is a valid number that is larger than all other valid num-
bers.
2. minus infinity (−∞). This is a valid number that is smaller than all other
valid numbers.
3. no t a number (NaN). This is an invalid number that arises from an opera-
tion with undefined consequences, such as zero divided by zero.
The designers of IEEE floating-point made some decisions that are extremely
convenient for programmers. Many of these relate to the three special values