Solid Polygon Clipping

Example 1

Window coordinates: Xl = 18, Xr = 50, Yt = 42, Yb = 0

Initial Polygon N = 5

X Y

10 10
30 10
30 40
20 50
10 40

Clip against Left edge :

1. s = 10, 40; p = 10, 10 reject p
2. s = 10, 10; p = 30, 10 Compute i = 18, 10 and save i and p
3. s = 30, 10; p = 30, 40 -> save p
4. s = 30, 40; p = 20, 50 -> save p (remember against left edge )
5. s = 20, 50; p = 10, 40 -> compute i = 18, 48 and save i

So polygon after clipping to left edge

X Y

18 10
30 10
30 40
20 50
18 48

Now clip against Top edge:

1. s = 18, 48; p = 18, 10 -> compute i = 18, 42 and save i and p
2. s = 18, 10; p = 30, 10 -> save p
3. s = 30, 10; p = 30, 40 -> save p
4. s = 30, 40; p = 20, 50 -> compute and save i = 28, 42
5. s = 20, 50; p = 18, 48 -> reject p

So output after clipping to Top edge (and final output since inside all other edges)

X Y N = 5

18 42
18 10
30 10
30 40
28 42


Go back to previous screen
HyperGraph Table of Contents.
HyperGraph Home page.

Last changed May 13, 1998, G. Scott Owen, owen@siggraph.org