How can one efficiently test if an axis-aligned rectangle R intersects a nice quadrilateral Q?
- Nice means: Q is convex (not a chevron) and non-selfintersecting (not a bowtie, not degenerate).
- Just 2D.
- Just yes/no. I don't need the actual region of intersection.
- Edit: Q and R may be open or closed, whatever's convenient.
Obviously one could test, for each edge of Q, whether it intersects R. That reduces the problem to How to test if a line segment intersects an axis-aligned rectange in 2D?.
But just like R's axis-alignedness is exploited by Liang-Barsky to be faster than Cohen-Sutherland, Q's properties might be exploited to get something faster than running Liang-Barsky multiple times.
Thus, the polygon-rectangle intersection algorithms Sutherland–Hodgman, Vatti, and Greiner-Hormann, all of which let Q be nonconvex, are unlikely to be optimal.
Area of rectangle-rectangle intersection looks promising, even though it doesn't exploit R's axis-alignedness.