📜  cohen sutherland 算法 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:58.686000             🧑  作者: Mango

代码示例2
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