Improvement in the Algorithm of Cohen-Surtherland Segment Clipping
-
Graphical Abstract
-
Abstract
In the algorithm of Cohen-Sutherland segment clipping, two terminal points of the clipped segment are encoded respectively according to the areas in which they locate. Using the codes the segments which do not intersect with any boundary of the clipping window or its extending would be determined rapidly. But the idea that studies every terminal point respectively makes no use of the segment information and brings on the inefficient work for the segment which intersect with the boundaries of the window or their extendings. Here much improvement is made to make good use of the information of the segment itself. Some assistant lines are created to partition the clipping window, then according to the feature of the area which the clipped segment belongs to, the relationship of the location between the segment and the window can be distinguished well and truly. So the calculation of the cross-points is performed only when it is needed. This means a faster clipping algorithm. And the idea in the paper would hold true for other clipping algorithms.
-
-