Open In App
Related Articles

Cohen-Sutherland vs. Liang-Barsky line clipping algorithm

Improve Article
Save Article
Like Article

Cohen-Sutherland Line Clipping Algorithm :
It is a line clipping algorithm. In which 2-D space (in which line resides) is divided into 9 regions and then the lines and portions of lines which are visible in the central region of interest are determined efficiently. It quickly detects and dispenses with two common and trivial cases. It was developed by Danny Cohen and Ivan Sutherland.

Liang-Barsky Line Clipping Algorithm :
It is also a line clipping algorithm. In this algorithm, the parametric equation of the line is used and four inequalities to find the range of the parameter for which the line is in the viewport are solved. It was developed by You-Dong Liang and Brian A. Barsky.

The below table points out the difference between both algorithms in detail.

S.NO.FactorsCohen Sutherland AlgorithmLiang-Barsky Algorithm
1.EfficiencyIt is less efficient.It is more efficient.
2.OperationsIn this Algorithm, each intersection requires both multiplication and a division.In this Algorithm, each update of parameters requires only one division.
3.ApproachIt follows the encoding approach.It follows the parametric approach.
4.CalculationIt repeatedly calculates intersection along a line path even though the line may be completely outside the clip window.In this, window intersections are calculated only once when final values have been computed.
5.UsesIt can be used only on a rectangular clip window.It can be used for 1-D, 2-D, 3-D line clipping and sometimes 4-D line clipping too.
Last Updated : 01 Jul, 2020
Like Article
Save Article
Similar Reads
Related Tutorials