More Polygon Clipping (2D only)
Liang-Barsky Polygon Clipping Algorithm
- parametric, like their line clipper
- more efficient than checking each half plane
- corner-turning vertices!
Weiler Polygon Algorithm
- actually more general than needed here- can find unions and intersections of arbitrary sets of polygons
In general, the tricks are:
- elaborate all possible cases
- store intermediate results
- calculate nothing before it’s actually needed