Sutherland Hodgeman Algorithm-Polygon Clipping
Sutherland Hodgeman Algorithm-Polygon Clipping
.
Outline
• Polygon Clipping
• Weiler Atherton
• Summary
Polygon Fill Area Clipping
• Typically support only fill areas that are polygons, and convex
• Cannot directly apply a line clipping because the result would not be a
closed polyline
Polygon Fill Area Clipping
• Clip a polygon fill area by determining the new shape for the polygon
as each clipping-window edge is processed
Create a new vertex list at each clipping boundary, and then pass this
new vertex list to the next boundary clipper
Polygon Clipping Algo:Sutherland-Hodgeman
• Send the pair of endpoints for each successive polygon line segment
through the series of clippers (left, right, bottom, and top)
• Operating in parallel, as a clipper completes the processing of one
pair of vertices, the next pair of endpoints is processed
• There are four possible cases
1. The first edge endpoint is outside and the second endpoint is inside
2. Both endpoints are inside
3. The first endpoint is inside and the second endpoint is outside
4. Both endpoints are outside
Polygon Clipping Algo:Sutherland-Hodgeman
• Send the pair of endpoints for each successive polygon line segment
through the series of clippers (left, right, bottom, and top)
• Operating in parallel, as a clipper completes the processing of one
pair of vertices, the next pair of endpoints is processed
• There are four possible cases
1. The first edge endpoint is outside and the second endpoint is inside
2. Both endpoints are inside
3. The first endpoint is inside and the second endpoint is outside
4. Both endpoints are outside
Sutherland-Hodgeman Algorithm(Cont.….)
• Passing of vertices from one clipping stage to the next, the output
from each clipper can be formulated
1. If the first input vertex is outside and the second vertex is inside, the intersection
point with the border and the second vertex are sent to the next clipper
2. If both input vertices are inside, only the second vertex is sent to the next clipper
3. If the first vertex is inside and the second vertex is outside, the intersection point is
sent to the next clipper
4. If both input vertices are outside, no vertices are sen t
Sutherland-Hodgeman Algorithm(Cont.….)
Sutherland-Hodgeman Algorithm(Cont.….)
Sutherland-Hodgeman Algorithm(Cont.….)
Issues in Clipping
Summary
● It correctly clips convex polygons
● But display extraneous lines for concave polygons
Resources
• https://en.wikipedia.org/wiki/Sutherland-hodgeman-algorithm
• https:// www.tutorialandexample.com/polygon-clipping/
• https://iq.opengenus.org/sutherland-hodgeman-algorithm