# Sutherland-Hodgeman Polygon Clipping Algorithm

By | March 12, 2022

## Sutherland-Hodgeman Polygon Clipping Algorithm

Sutherland-Hodgeman Polygon Clipping Algorithm: This algorithm was purposed by Sutherland and Hodgeman in 1974 to determine which portions of the polygon were visible within a window and clipping out the portions that are outside the window.

This algorithm accepts as input a series of polygon vertices, V1, V2, …. Vn. These vertices define polygon edges from Vi, to Vi+1 and from Vn to V1.

The algorithm clips a polygon by processing the polygon boundary as a whole against each window edge. It means all the vertices are processed for clipping against each individual clip boundary of clipping window one by one.

It means starting with the initial set of vertices, the polygon is first clipped against left window boundary and a new set of vertices is produced.

This set is given as input to next clipping boundary and the polygon is clipped against right clipping boundary to produce a new set of vertices and is then clipped against bottom and top clipping boundary to produce final set of vertices . [Left-Right-Bottom-Top] Thus, at each step a new set of output vertices is generated and is passed to the next window boundary clipper. When all the vertices of a given polygon are processed against any clipping side, there could be any one of the following four possibilities for a successive pair of two vertices of polygon:

### Case 1: out → in :

If the starting vertex is outside the window boundary and ending vertex is inside then we preserve or save both point of intersection of polygon edge with window boundary and ending vertex in the output vertex list.

Case 2 : in → in :

If both the starting and ending vertices are inside the window boundary then only the ending vertex is preserved or saved in output vertex list. Case 3: in → out :

If the starting vertex is inside the window and ending vertex is outside then only the point of intersection of polygon edge with window boundary is saved in output list.

Case 4: out → out :

If both the starting and ending vertices are outside the window boundary then nothing is added or saved in the output vertex list.

### Example of Sutherland-Hodgeman Polygon Clipping Algorithm

Let us consider a polygon with vertices P1, P2, P3, P4, P5. Inside in a viewing window. Applying Sutherland-Hodgeman Polygon Clipping Algorithm on this polygon, we get:

### Clipping polygon engaged left window boundary:

Here the input vertex list is P1, P2, P3, P4 P5 and the edges are P1P2, P2P3, P3P4, P4P5 and P5P1. Now, consider all the edge with respect to (w.r.t.) left window boundary.

### Clipping polygon engaged right window boundary:

Here the input vertex list is P1′, P2, P3, P4, P5, P5′ and the edges are P1’P2, P2P3, P3P4, P4P5, P5P5′ and P5’P1′. Now, consider all the edge with respect to (w.r.t.) right window boundary. There will be no changes because all edges lies inside the right clipping window.

### Clipping polygon engaged bottom window boundary:

Here the input vertex list is P1′, P2, P3, P4, P5, P5′ and the edges are P1’P2, P2P3, P3P4, P4P5 and P5P5′. Now, consider all the edge with respect to (w.r.t.) bottom window boundary.

### Clipping polygon engaged top window boundary:

Here the input vertex list is P1′, P2, P3, P4, P4′, P5” and the edges are P1’P2, P2P3, P3P4, P4P4′, P4’P5” and P5”P1. Now, consider all the edge with respect to (w.r.t.) top window boundary. Here the input vertex list is P1′, P2, P3, P4, P5, P5′ and the edges are P1’P2, P2P3, P3P4, P4P5, P5P5′ and P5’P1′. Now, consider all the edge with respect to (w.r.t.) right window boundary. There will be no changes because all edges lies inside the top clipping window.

### Final output using Sutherland-Hodgeman Polygon Clipping Algorithm will be: ### Limitations of Sutherland-Hodgeman Polygon Clipping Algorithm

1. In some concave polygons, the theorem creates extra edges while clipping. 