Professional Documents
Culture Documents
CLIPPING
A polygon may be represented as a number of line segments
connected end to end to form a closed figure.
There may be mainly two types of polygon:-
Convex Polygon- A polygon is called convex if the line joining
any two interior points of the polygon lie completely inside the
polygon.
Concave Polygon- A polygon is called if the line joining any two
interior points of the polygon lie outside the polygon.
WEILER-ATHERTON POLYGON
CLIPPING
In this clipping algorithm, the vertex processing procedure
for the window boundaries are modified so that concave
polygons are displayed correctly.
Also there is no extra clipping done outside the clip
window.
It also works for arbitrary shapes.
The basic idea behind Weiler-Atherton Algorithm is
that instead of always proceeding around the polygon
edges as vertices are processed, we sometimes follow
the window boundaries.
STEPS OF THE ALOGORITHM
Determine the intersection points of the given subject polygon
with the clipping window.
Traverse clockwise in the polygon and prepare the following
four list:
Entering List: This list contains all those intersection which are
encountered while entering the clip window.
Leaving List: This list contains all those intersection which are
encountered while leaving the clip window.
Subject Polygon List: This list contains all the vertices of the
subject polygon and also the intersection points.
Clip window List: This list contains all the vertices of the
clipping window and also the intersection points.
We traverse through the last two list by following the below two rules:
RULE1: For outside to inside pain of vertices,(entering list) we follow the
subject polygon list.
RULE2: For inside to outside pair of vertices, (leaving list) follow the clip
window list.
For e.g. we have the following polygon to clip