Please note that the content of this book primarily consists of articles
available from Wikipedia or other free sources online. The
Sutherland-Hodgman algorithm is used for clipping polygons. It works by
extending each line of the convex clip polygon in turn and selecting
only vertices from the subject polygon that are on the visible side.The
algorithm begins with an input list of all vertices in the subject
polygon. Next, one side of the clip polygon is extended infinitely in
both directions, and the path of the subject polygon is traversed.
Vertices from the input list are inserted into an output list if they
lie on the visible side of the extended clip polygon line, and new
vertices are added to the output list where the subject polygon path
crosses the extended clip polygon line.