## Weiler-Atherton Polygon Clipping:When the clipped polygons have two or more separate sections, then it is the concave polygon handled by this algorithm. The vertex-processing procedures for window boundaries are modified so that concave polygon is displayed. Let the clipping window be initially called clip polygon and the polygon to be clipped the subject polygon. We start with an arbitrary vertex of the subject polygon and trace around its border in the clockwise direction until an intersection with the clip polygon is encountered: 1. If the edge enters the clip polygon, record the intersection point and continue to trace the subject polygon. 2. If the edge leaves the clip polygon, record the intersection point and make a right turn to follow the clip polygon in the same manner (i.e., treat the clip polygon as subject polygon and the subject polygon as clip polygon and proceed as before). Whenever our path of traversal forms a sub-polygon we output the sub-polygon as part of the overall result. We then continue to trace the rest of the original subject polygon from a recorded intersection point that marks the beginning of a not-yet traced edge or portion of an edge. The algorithm terminates when the entire border of the original subject polygon has been traced exactly once.
Next TopicPointing & Positioning Techniques |