Removes invisible parts of lines efficiently.
Uses a defined rectangular clipping window.
Maintains exact visual accuracy while rendering.
Improves system rendering performance drastically.
Line is completely inside the clipping window boundaries.
Line is partially inside, requiring intersection calculation.
Line is completely outside any region of the view window.
Divides coordinate space into 9 distinct regions with 4-bit Outcodes.
Quickly flags trivial accepts and rejects by analyzing endpoints.
Every region receives a 4-bit binary code (TBRL)
Assign 4-bit region codes to both line endpoints.
If both codes are `0000` → Trivially Accept.
If AND of codes ≠ `0000` → Trivially Reject.
Else → Find intersection, clip, and repeat.
Uses the parametric equation of a line.
Examines "t" (0 to 1) instead of coordinates.
Analyzes distance to window edges.
Faster than standard Cohen-Sutherland.
A line segment can be defined parametrically:
Valid t ranges from 0 to 1
Define directional p and q values.
Calculate parameter t = q / p for edges.
Find valid t₁ (entry) and t₂ (exit).
If t₁ < t₂, clip.
Else, reject line.