Polygon Clipping
Polygon Clipping
Computer Graphics
POLYGON CLIPPING
Prepared By-
Vivek Kumar (2K19/CO/436)
Sahil Yadav (2K19/IT/114)
POLYGON-
“A Polygon can be described as the enclosed collection or group of the lines.”
In a polygon, all lines are connected. Lines can be a combination of edges and
vertices, which together form a polygon. A polygon refers to a two-dimensional
architecture made up of a number of straight lines.
1. Concave Polygon
2. Convex Polygon
Convex Polygon: The convex polygon does not have any part of its diagonals in its
exterior. In a convex polygon, all the angles should be less than 180° (angle<180°).
Concave Polygon: The concave polygon has at least one part of diagonal in its
exterior. In a concave polygon, at least one angle should be greater than 180° (angle
>180°).
Polygon Clipping
Polygon clipping is a process in which we only consider the part which is inside the
view pane or window. We will remove or clip the part that is outside the window. We
will use the following algorithms for polygon clipping–
TWO ALGO' :
• Sutherland-Hodgeman polygon clipping algorithm
This algorithm helps us to clip a filled area. The filled area may be a
convex polygon or concave polygon. This algorithm was introduced
to identify the visible surfaces. This algorithm helps to create
individual polygons in some cases. In the Weiler-Atherton
algorithm, we consider the view pane boundaries instead of edges
and vertices of the polygon.
Step 2: Now, create two more lists; one for subject polygon and
other for clip polygon.Fill both lists with intersection points and
vertices of the polygon.
Order of Subject Polygon list- Write down all the vertices of the
polygon in the subject polygon column.
Order of Clip Polygon list – Write down the points of the clipping
window.
Step 3: Insert the vertices in both lists in such a way that the
intersection point exists between the correct vertices.
Step 4: Now, start from the first vertex of the polygon. Select the first
intersection point as an entering point and follow the same process
until we reach the exiting point.
Step 5: We can move from clip polygon list to subject polygon list
and search for the finishing intersection point. Repeat the process
until we find the entering point.
Step 6: Now, the polygon is being clipped. Repeat the same process
until each point has been visited once.
Step 7: Stop.
Solution: Let us assume that the vertices of window = C1, C2, C3, C4
The vertices of polygon = ABCDEFG
First, create two lists, one for subject polygon and second for clip
polygon.
Iteration 1-
The First new list is- A’, B, C, D’, A’.
Iteration 2-