Clipping: Introduction To Computer Graphic S
Clipping: Introduction To Computer Graphic S
Clipping: Introduction To Computer Graphic S
Clipping
Clipping
Chapter 13, Section 10
Line Clipping
• Clipping endpoints
(Xmax , Ymax)
(Xmin , Ymin)
xmin < x < xmax and ymin < y < ymax point inside
Clip Rectangle
Cohen-Sutherland Algorithm
• If we can neither trivially reject/accept,
divide and conquer
• subdivide line into two segments; then T/A
or T/R one or both segments:
D
C
B I
A H
Clip G
rectangle F
E
– use a clip edge to cut line
– use outcodes to choose edge that is crossed
• Edges where the two outcodes differ at that
particular bit are crossed
– pick an order for checking edges
until done
x = xmin
B A
y = ymin
y = ymin – 1/2
y = ymin – 1
Sutherland-Hodgman Polygon
Clipping
Cyrus-Beck/Liang-Barsky
Parametric Line Clipping-1
• Use parametric line formulation
P(t) = P0 + (P1 – P0)t
• Determine where the line intersects the
infinite line formed by each edge by solving
for t 4 times. Decide which of these
intersections actually occur on the rectangle
• Examine t: