5.Clipping 
Before clipping 
After clipping 
Point Clipping

Point Clipping
Line ClippingIf both points lie inside the window

Point Clipping
Line ClippingIf both points lie inside the window
If both points lie outside the same boundary

Point Clipping
If both points lie inside the window
If both points lie outside the same boundary
If segment crosses one or more boundaries

Cohen  Sutherland Line Clipping

Cohen  Sutherland Line Clipping

Cohen  Sutherland Line Clipping

Cohen  Sutherland Line Clipping

Cohen  Sutherland Line Clipping

Cohen  Sutherland Line Clipping

Cohen  Sutherland Line Clipping

Cohen  Sutherland Line Clipping

Cohen  Sutherland Line Clipping

Cohen  Sutherland Line Clipping

Cohen  Sutherland Line Clipping: AlgorithmFor each line segment (1) compute clip codes (2) if both are 0 0 0 0 accept line segment else if c_{1} & c_{2} != 0 discard line segment else /* c_{1} & c_{2} = 0 */ clip against left clip against right clip against bottom clip against top if anything remains accept clipped segment 
Cohen  Sutherland: Multiple Intersections 
Cohen  Sutherland: Multiple Intersections

Cohen  Sutherland: Multiple Intersections

Cohen  Sutherland: Multiple Intersections

Parametric Line Clipping (Cyrus  Beck)

Parametric Line Clipping (Cyrus  Beck)

Parametric Line Clipping (Cyrus  Beck)
Compute t for each clip rectangle edge Discard values of t outside [0, 1] Classify other candidates more carefully (t_{L})

Parametric Line Clipping (Cyrus  Beck) 
Cyrus  Beck: Classifying Intersections 
Cyrus  Beck: Classifying IntersectionsPotentially entering Intersection (PE) N_{i} ^{.} D < 0 (angle > 90^{o}) => t_{L} Potentially leaving Intersection (PL) N_{i} ^{.} D > 0 (angle < 90^{o}) => t_{T} 
Cyrus  Beck: Classifying IntersectionsPotentially entering Intersection (PE) N_{i} D < 0 (angle > 90^{o}) => t_{L} Potentially leaving Intersection (PL) N_{i} D > 0 (angle < 90^{o}) => t_{T} 
Cyrus  Beck: Classifying IntersectionsPotentially entering Intersection (PE) N_{i} D < 0 (angle > 90^{o}) => t_{L} Potentially leaving Intersection (PL) N_{i} D > 0 (angle < 90^{o}) => t_{r} Clipped Segment Defined by: [PE_{max}, PL_{min}] where PE_{max} = MAX ( 0, all PEs ) PL_{min} = MIN ( 1, all PLs ) if PL_{min} < PE_{max} reject line 
Cyrus  Beck Line Clipping: AlgorithmRecalculate N_{i} and select a P_{Ei} for each edge for ( each line segment to be clipped) { if ( P_{1} == P_{0} ) line is degenerate so clip as a point; else { t_{E} = 0; t_{L} = 1; for ( each candidate intersection with a clip edge ) { if ( N_{i} ^{.}D != 0 ) { /* ignore edges parallel to line */ calculate t; use sign of N_{i} ^{.} D to categorize as PE or PL; if ( PE ) t_{E} = max ( t_{E} , t ); if ( PL ) t_{L} = min ( t_{L} , t ); } } if ( t_{E} > t_{L} ) return null; else return P(t_{E}) and P(t_{L}) as true clip intersections; } } 
Polygon Clipping

Polygon Clipping

Polygon Clipping

Polygon Clipping

Polygon Clipping

Sutherland  Hodgeman: Polygon ClippingOriginal polygon 
Sutherland  Hodgeman: Polygon ClippingClip Left 
Sutherland  Hodgeman: Polygon ClippingClip Right 
Sutherland  Hodgeman: Polygon ClippingClip Bottom 
Sutherland  Hodgeman: Polygon ClippingClip Top 
Sutherland  Hodgeman Polygon Clipping: Algorithm 
Sutherland  Hodgeman Polygon Clipping: AlgorithmFor each boundary b in [ L, R, T, B ] if P_{1} outside and P_{2} inside output intersection output P_{2} 
Sutherland  Hodgeman Polygon Clipping: AlgorithmFor each boundary b in [ L, R, T, B ] if P_{1} outside and P_{2} inside output intersection output P_{2} if P_{1} inside and P_{2} inside output P_{2} 
Sutherland  Hodgeman Polygon Clipping: AlgorithmFor each boundary b in [ L, R, T, B ] if P_{1} outside and P_{2} inside output intersection output P_{2} if P_{1} inside and P_{2} inside output P_{2} if P_{1} inside and P_{2} outside output intersection 
Sutherland  Hodgeman Polygon Clipping: AlgorithmFor each boundary b in [ L, R, T, B ] if P_{1} outside and P_{2} inside output intersection output P_{2} if P_{1} inside and P_{2} inside output P_{2} if P_{1} inside and P_{2} outside output intersection if P_{1} outside and P_{2} outside do nothing 
Sutherland  Hodgeman Polygon Clipping: AlgorithmFor each boundary b in [ L, R, T, B ] if P_{1} outside and P_{2} inside output intersection output P_{2} if P_{1} inside and P_{2} inside output P_{2} if P_{1} inside and P_{2} outside output intersection if P_{1} outside and P_{2} outside do nothing 
Sutherland  Hodgeman : An Examplein > P_{1} P_{2} P_{3} P_{4} 
Sutherland  Hodgeman : An Examplein > [clip left] > P_{1}  in to in > P_{1} P_{2} P_{3} P_{4} 
Sutherland  Hodgeman : An Examplein > [clip left] > P_{1}  in to in > P_{1} P_{2}  in to out > P'_{2} P_{3} P_{4} 
Sutherland  Hodgeman : An Examplein > [clip left] > P_{1}  in to in > P_{1} P_{2}  in to out > P'_{2} P_{3}  out to out > x P_{4} 
Sutherland  Hodgeman : An Examplein > [clip left] > P_{1}  in to in > P_{1} P_{2}  in to out > P'_{2} P_{3}  out to out > x P_{4}  out to in > P'_{4} > P_{4} 
Sutherland  Hodgeman : An Examplein > [clip left] > [clip right] > P_{1}  in to in > P_{1}  in to in > P_{1} P_{2}  in to out > P'_{2}  in to in > P'_{2} P_{3}  out to out > x P_{4}  out to in > P'_{4}  in to in > P'_{4} > P_{4}  in to in > P_{4} 
Sutherland  Hodgeman : An Examplein > [clip left] > [clip right] > [clip bottom] > P_{1}  in to in > P_{1}  in to in > P_{1}  in to in > P_{1} P_{2}  in to out > P'_{2}  in to in > P'_{2} P_{3}  out to out > x P_{4}  out to in > P'_{4}  in to in > P'_{4} > P_{4}  in to in > P_{4} 
Sutherland  Hodgeman : An Examplein > [clip left] > [clip right] > [clip bottom] > P_{1}  in to in > P_{1}  in to in > P_{1}  in to in > P_{1} P_{2}  in to out > P'_{2}  in to in > P'_{2}  in to out > P''_{2} P_{3}  out to out > x P_{4}  out to in > P'_{4}  in to in > P'_{4} > P_{4}  in to in > P_{4} 
Sutherland  Hodgeman : An Examplein > [clip left] > [clip right] > [clip bottom] > P_{1}  in to in > P_{1}  in to in > P_{1}  in to in > P_{1} P_{2}  in to out > P'_{2}  in to in > P'_{2}  in to out > P''_{2} P_{3}  out to out > x P_{4}  out to in > P'_{4}  in to in > P'_{4}  out to in > P''_{4} > P'_{4} > P_{4}  in to in > P_{4} 
Sutherland  Hodgeman : An Examplein > [clip left] > [clip right] > [clip bottom] > P_{1}  in to in > P_{1}  in to in > P_{1}  in to in > P_{1} P_{2}  in to out > P'_{2}  in to in > P'_{2}  in to out > P''_{2} P_{3}  out to out > x P_{4}  out to in > P'_{4}  in to in > P'_{4}  out to in > P''_{4} > P'_{4} > P_{4}  in to in > P_{4}  in to in > P_{4} 
Sutherland  Hodgeman : An Examplein > [clip left] > [clip right] > [clip bottom] > [clip top] > out P_{1}  in to in > P_{1}  in to in > P_{1}  in to in > P_{1}  in to in > P_{1} P_{2}  in to out > P'_{2}  in to in > P'_{2}  in to out > P''_{2}  in to in > P''_{2} P_{3}  out to out > x P_{4}  out to in > P'_{4}  in to in > P'_{4}  out to in > P''_{4}  in to in > P''_{4} > P'_{4}  in to in > P'_{4} > P_{4}  in to in > P_{4}  in to in > P_{4}  in to in > P_{4} 
Made by dynaPage 0.2 