The algorithm divides a two-dimensional space into 9 regions and then efficiently determines the lines and portions of lines that are visible in the central region of interest (the viewport).
The algorithm was developed in 1967 during flight simulator work by Danny Cohen and Ivan Sutherland.
The bits in the 2D outcode represent: top, bottom, right, left.
For example, the outcode 1010 represents a point that is top-right of the viewport.
Note that the outcodes for endpoints must be recalculated on each iteration after the clipping occurs.