Graphics Reference
In-Depth Information
will be called a 2-bit point . A segment is called an x-y segment if its start point is an
x-bit point and its endpoint is a y-bit point.
Knowing the type of segment that one has is important for the algorithm. This is
why an extra bit is used in the encoding of points. It is stuck at the left end of the
original Cohen-Sutherland code. Below is an overview of the actions that are taken
in the TestForComplexCase procedure. Refer to Figure 3.15.
The 1-1 Segment Cases ( Segments a and b). Either the two points have the same
code (segment a ) and no turning point needs to be generated or they have different
codes (segment b ). In the latter case there is one turning point that can be handled
by the basic turning point test. The code for the corner for this turning point is com-
puted from the or of the two codes and a lookup table (the Tcc table in the code).
The 2-1 and 1-2 Segment Cases ( Segments c and d).
In this case one point of the
segment has a 1-bit code and the other, a 2-bit code.
(a) The endpoint is the point with the 1-bit code (segment c ): If both codes and
to a nonzero value (segment [ P , R ] in Figure 3.16(a)), there is no turning point. If both
Figure 3.15.
Turning point cases in Maillot
algorithm.
Figure 3.16.
Turning point tests.
Search WWH ::




Custom Search