A fast two-dimensional line clipping algorithm via line encoding

Abstract Clipping of lines is an important operation in most graphics applications. Two main types of line clipping algorithms have been proposed, namely the encoding approach (with the Cohen-Sutherland algorithm as a representative) and the parametric approach (with the Liang-Barsky and the Cyrus-Beck algorithms as representatives.) The technique described in this paper is a new encoding approach. Unlike the Cohen-Sutherland algorithm, which encodes the end points of a line, the line is encoded. Based on the line code, appropriate clipping actions are performed. Experimental results demonstrate that the proposed algorithm outperforms the Cohen-Sutherland, the Liang-Barsky and the Cyrus-Beck algorithms.