Motorola DSP96002 User Manual

Page 606

Advertising
background image

MOTOROLA

DSP96002 USER’S MANUAL

B-87

Substituting the value of t results in the determinant

y2 = | y2 w2-y2 |

| y1 w1-y1 |

-------------------

(w1-x1) - (w2-x2)

The equations for z2 and w2 are analogous. Since w2 has the same denominator as x2, y2 and z2, and

these will be divided by w2 in the perspective transformation, the division shown above does not need to

be performed.

Lines 151-162 determine which planes that the point is outside and call the appropriate clipping routines.

These routines (lines 520-617) calculate the determinants and return with the resulting coordinates in the

data registers.

The resulting point is transformed using the perspective transformation, scaled and translated in lines 168-

186. A code (-1.0) is stored in the display list to indicate that the next line to be drawn is not joined with

the current one. Control is then transferred to the trivial reject loop.

TRIVIAL REJECT LOOP

The trivial reject loop starts with the {1x4}{4x4} matrix multiplication to transform the input point to clipping

space. Next, the line joining the current point and the previously rejected point is tested for trivial rejection.

As mentioned earlier, trivial rejection occurs whenever both of the endpoints lie outside of one clipping

plane.

A sticky bit called Local Reject (LR) is defined as bit 5 of the CCR. It is cleared by the FCMP s,d instruction

whenever s <= d. In other words, the LR bit is cleared whenever the FCMP instruction finds the coordinate

inside of the boundary.

An additional instruction, FCMPG, is needed because trivial rejection occurs when both points are outside

of any boundary plane. Thus, an additional sticky bit called Reject (R) (bit 6 of the CCR) is used to "re-

member" that a trivial reject has occurred after comparisons against one boundary plane. The FCMPG

instruction affects R and is performed as the last comparison to a boundary plane. When FCMPG s,d is

executed, the R flag is cleared if the previous point was outside of the boundary (LR is set) and the current

point is outside of the boundary (s > d). The FCMPG instruction also resets the LR bit to 1 for comparison

to the next boundary plane.

To perform the trivial reject test, the LR and R bits are set to 1. The two points are tested against the X = -

W boundary plane and then tested against the X = W plane etc. The first point is tested using FCMP and

the second point is tested using FCMPG to clear the R bit if both comparisons were outside of the boundary.

At the end of these comparisons, if the R bit is 0, the line was trivially rejected. With this definition, the

trivial rejection test can be generalized to a polygon with any number of points. The execution time is of

order 6N cycles where N is the number of points.

The lines 225-236 perform the trivial reject test. Should the line be trivially rejected, the new coordinates

are stored for the next comparison and the reject loop repeats.

If the line is not trivially rejected, a check is made to determine if the current point is accepted. If so, control

is transferred to the reject loop single point clip routine. Otherwise the double point routine is entered.

REJECT LOOP SINGLE POINT CLIPPING CODE

Advertising