Clipping is the process of removing parts of graphics primitives (lines, polygons) that lie outside a defined viewing area or window.
Remove portions of a line outside the clip window.
Common algorithms:
Cohen–Sutherland Algorithm
Liang–Barsky Algorithm
Remove portions of a polygon outside the clip window.
Common algorithms:
Sutherland–Hodgman Algorithm
Weiler–Atherton Algorithm
Assign a 4-bit code to each endpoint based on position relative to window.
Use logical AND/OR operations to decide if line is:
Polygonal fill is the process of coloring the interior of a polygon.
Process the polygon row by row (scanlines).
Steps:
Efficient and widely used.
For a polygon with vertices:
Determine Ymin and Ymax.
For each scanline from Ymin to Ymax:
| Concept | Purpose | Common Algorithms | Notes |
|---|---|---|---|
| Clipping | Remove parts outside view | Cohen–Sutherland, Liang–Barsky, Sutherland–Hodgman | Improves efficiency and avoids drawing invisible pixels |
| Polygon Fill | Color the interior of polygon | Scan-line, Flood fill, Boundary fill | Scan-line most efficient for convex & concave polygons |
Key Points:
Open this section to load past papers