Graphics Reference
In-Depth Information
ε
P
P
P
n
n
n
C
B
C
B
C
B
A
A
E
E
E
D
D
Figure 8.13 A potential problem with the modified clipping algorithm is that the resulting
pieces (shown in dark gray) may overlap.
plane is that an intersection point is computed only for an edge with one endpoint
in front of and the other endpoint behind the plane. Thanks to the thickness of the
plane, a limit is therefore placed on how parallel to the plane the edge can become,
which greatly increases the accuracy of the intersection point. Chapter 11 discusses
these floating-point issues further.
For most applications, the set of rules presented in Table 8.1 works fine, but it is
important to be aware that the two resulting polygon pieces may overlap in some
cases. Consider the quad ABCD of Figure 8.13. When it is split against the plane, the
subtriangle BCE will end up in both outputs.
For robust clipping of the polygon, so that no overlap exists between the generated
pieces, a full set of all nine possible cases is necessary. Such a set is outlined inTable 8.2.
An implementation of these nine rules might look as follows.
Table 8.2 The final modified clipping algorithm for robustly clipping a polygon against a
thick plane.
Front Polygon
Back Polygon
A (previous vertex)
B (current vertex)
Output
Output
In front
In front
B
None
On
In front
B
None
Behind
In front
I , B
I
In front
On
B
None
On
On
B
None
Behind
On
B
B
In front
Behind
I
I , B
On
Behind
None
A , B
Behind
Behind
None
B
 
Search WWH ::




Custom Search