Motorola DSP96002 User Manual
Page 605
B-86
DSP96002 USER’S MANUAL
MOTOROLA
n0 = 0.0 for z limit test and double point clipping
n5 = -1.0 for end of polyline marker
TRIVIAL ACCEPT LOOP
The transformation from object space to screen space is performed in lines 19-33. This is a {1x4}{4x4}
matrix multiplication but because the W coordinate of the {1x4} input vector {X Y Z W} is always equal to
one, four multiplications can be eliminated.
Lines 39-47 determine if the point is within the viewing pyramid. The FCMP s,d instruction is designed to
clear the sticky accept (A) bit (bit 7 in the CCR) whenever s > d. By switching the order of the operands,
the FCMP instruction can be used to test both the maximum and minimum boundaries of a window. To
test acceptance, the A bit is set in line 40 and the X and Y coordinates are compared to the boundaries -
W and W. The Z coordinate is compared to the boundaries 0 and W. If the A bit remains set, the point is
within the viewing pyramid and is transformed to screen coordinates.
If the A bit is clear, the reject loop is entered. Note that the A bit is only affected by the CMP, CMPG, FCMP
and FCMPG instructions.
The reciprocal 1/W is calculated in lines 53-58. The result is accurate to approximately 32 bits. It is multi-
plied by the X coordinate and then by the X scale to scale the data to the output screen. The coordinate
is then translated to screen space. The procedure is repeated for the Y coordinate and the coordinates
are added to the display list.
For additional points the accept loop code is almost identical to the first point code except that if the new
point is not within the viewing pyramid, a jump to a single point clipping routine is performed.
ACCEPT LOOP SINGLE POINT CLIPPING CODE
The method used for clipping a line when one point is inside the viewing pyramid and one point is outside
is a special case of a general clipping algorithm presented in [1] and is used in the double point clipping
code.
Suppose that the line between points P1 and P2 was rejected because the x coordinate of P2, x2, was
larger than w2. Then,
y2 = y1 + t (y2 - y1)
where
t = w1 - x1
---------------------
(w1 - x1) - (w2 - x2)