# Clipping

#### The operation to discard only the parts of triangles that in some way partially or fully fall outside the view volume.

```if (primitive isn't trivially rejected)
and if (primitive is trivially accepted)
draw it
else
clip it and draw that part of the triangle that's inside the view volume
```

### Sutherland-Hodgeman Clipping : a 6 pass algorithm

Taking Sutherland-Hodgeman as an example, this algorithm can work in either 2D (four clipping boundaries) or in 3D (six clipping boundaries--left, right, top, bottom, near, far). It works by examining a triangle one boundary at a time, and in some sense is a "multi-pass" algorithm, in that it initially clips against the first clip boundary. It then takes the newly clipped polygon and compares it to the next clip boundary, re-clips if necessary, and ultimately does six "passes" in order to clip a triangle against the six sides of the 3D unit cube.

### Retesselation

Once a triangle has been clipped, it must be retesselated, or made into a new set of triangles. Take for example the diagram where you see a single triangle being clipped whose remaining visible portion now forms a quadrilateral. The clipper must now determine the intersection points of each side of the triangle with that clipping boundary, and then draws new triangles that will be part of the final scene.

 Web www.vrarchitect.net