Intel i86W Manual page 185

Table of Contents

Advertisement

PROGRAMMING EXAMPLES
Calculate the reciprocal of dX:
RdX
=
l/dX
The value of dX is used several times as a divisor.
It
is most efficient to calculate its
reciprocal once, then, instead of dividing by dX, multiply by RdX. The slope of Z is ...
mZ
=
(22 -
Zl)*RdX
Because each polygon is a plane, the value of m2 is constant for all scan lines that
intersect the polygon; therefore mZ needs to be calculated only once for each polygon.
Example 9-21 assumes that dX and mZ have already been calculated, and all that re-
mains is to apply mZ to successive pixels. Let Z(Xn) be the Z value at pixel Xn. Then ...
Z(Xl)
=
21
Z(X1
+
1)
=
Zl
+
mZ
Z(X1
+
2)
=
Zl
+
2*mZ
Z(X1
+
N)
=
Zl
+
N*mZ
Z(X1
+
dX)
=
Zl
+.
dX*mZ
=
Z(X2)
Figure 9-1 illustrates this Z-value interpolation.
(r,
g,
b,
x, y, z
= 4000)
3000 - 2400
mZ =
12 PIXELS
(r",
gO, b", x",
y", z"
= 1000)
Figure 9-1. Z-Buffer Interpolation
9-23
8
o
CO)
240329i

Advertisement

Table of Contents
loading

Table of Contents