Title: Implementation of Polygon Clipping Algorithm.
Problem Statement: Implement Cohen Sutherland Hodgeman polygon clipping method to
clip the polygon with respect to the viewport and window. Use mouse click, keyboard
interface.
Objective: Understanding the concept of Polygon clipping
Theory:
Polygon Clipping – Cohen Sutherland Hodgeman
The process of selecting ,enlarging and viewing the picture with different views is
called windowing .A process which divides each element of the picture into its visible and
invisible portions allowing the invisible portion to be discarded is called clipping Procedure
that identifies the portion of a picture that are either inside or outside. The region against
which an object is to be clipped is called clip window
A polygon can be clipped by processing its boundary as a whole against each window
edge. This is achieved by processing all polygon vertices against each clip rectangle boundary in turn.
Begging with the original set of polygon vertices, we could first clip the polygon against the left
rectangle boundary to procedure a new sequence of vertices. Sutherland and Hodgman's polygon-
clipping algorithm uses a divide-and-conquer strategy: It solves a series of simple and identical
problems that, when combined, solve the overall problem. The simple problem is to clip a polygon
against a single infinite clip edge. Four clip edges, each defining one boundary of the clip rectangle,
successively clip a polygon against a clip rectangle
Processing all polygon vertices against each clip rectangle boundary in turn
Pass each pair of adjacent polygon vertices to a window boundary clipper
There are four cases:
• Intermediate output vertex list
• Once all vertices have been processed for one clip window boundary,
it is generated.
• The output list of vertices is clipped against the next window boundary.
• It can be eliminated by a pipeline of clipping routine.
• Convex polygons are correctly clipped.
• If the clipped polygon is concave
Split the concave polygon
Example:
Conclusion: In This way we have studied and implemented Sutherland-Hodgeman Polygon
Clipping Algorithm.