Comparison Techniques:
There are many techniques for finding the relevancy and relative position of two polygons. Not all tests can be utilized with all hidden-surface algorithms, and some of the tests are not always conclusive. Sometimes we may use simple tests for many of the cases and resort to more expensive tests only while all else fails.
One technique that is frequently useful is called the minimax test or boxing test. This test checks if two polygons overlap. The test provides a quick method to find out if two polygons do not overlap. It surrounds each polygon along a box by determining its extents (minimum and maximum x and y coordinates) and then checks for the intersection for any two boxes in both of the X and Y directions. If two boxes do not intersect, their equivalent polygons do not overlap. In such a case, no further testing of the edges of the polygons is needed.
If the minimax test fails (two boxes intersect), the two polygons can or cannot overlap, as illustrated in Figure. Each edge of one polygon is compared against all of the edges of the other polygon to detect intersections. The minimax test may be applied first to any two edges to speed up this procedure.