Graphics Clipping

The model of the whole scene is often bigger than the part we want to display - e.g. we are zoomed in on a tree, rather than looking at a whole map.

When we clip we are in ’clip space’ dealing with coordinates between w and -w (after we apply the perspective transform above), everything outside this range is clipped.

Screenshot%202014-09-09%2021.14.57.png

There are a number of algorithms for performing clipping

  • Cohen-Sutherland (line vs rect)
    • Checks if lines are inside, outside, or partially inside the viewport rectangle
  • Cyrus-Beck (line vs convex poly)
  • Sutherland-Hodgman (poly vs convex poly)
  • Weiler-Atherton (poly vs poly)

Perspective Division

After clipping we transform points back into valid points with a w of 1. This is necessary to allow us to draw them correctly.

Screenshot%202014-09-09%2021.15.01.png