n Cohen_Sutherland algorithm, the left (L bit ) bit of the region code of a point (X,Y) is '1' if ...................... Select one: X< X_WindowMIN X< X_WindowMAX X > X_WindowMIN X>X_WindowMAX code example

Example 1: Cohen Sutherland Line Clipping Algorithm: In the algorithm, first of all, it is detected whether line lies inside the screen or it is outside the screen. All lines come under any one of the following categories: Visible Not Visible Clipping Case

Cohen Sutherland Line Clipping Algorithm:
In the algorithm, first of all, it is detected whether line lies inside the screen or it is outside the screen. All lines come under any one of the following categories:

Visible
Not Visible
Clipping Case

Example 2: cohen sutherland algorithm

There are three possible cases for any given line.

Completely inside the given rectangle : Bitwise OR of region of two end points of line is 0 (Both points are inside the rectangle)
Completely outside the given rectangle : Both endpoints share at least one outside region which implies that the line does not cross the visible region. (bitwise AND of endpoints != 0).
Partially inside the window : Both endpoints are in different regions. In this case, the algorithm finds one of the two points that is outside the rectangular region. The intersection of the line from outside point and rectangular window becomes new corner point and the algorithm repeats

Tags:

Misc Example