Windows should intersect if they share any point in space.
@sgillies This PR is an attempt to resolve #3111.
Before, two windows intersect if they had any common interior point. This changes that definition to mean that two windows intersect if they share any common point.
For example, a test the PR fails is:
Does Window(0, 0, 10, 10) intersect Window(10, 10, 10, 10)? With the old code, the answer was no. With the new code, the answer is yes and the intersection is Window(10, 10, 0, 0).
Another way to phrase this: Do windows intersect if the resulting intersectional area is 0?
What do you think?
@groutr first of all: what impact would this have for rasters? Do we want two windows that are exactly adjacent, like tile windows, to intersect? Second: I think we may be fighting floating point precision to see effects we want. For example, shapes that mathematically touch don't always touch when compare with GEOS.
@sgillies Great questions. You bring up a great point about adjacent windows. That would complicate the logic around tiling. Looking again at the issue raised in #3111, I see that the actual root cause is how to properly handle a zero area window. Can a zero area window intersect another window?
Do these two windows intersect?
Window(col_off=4, row_off=2, width=0, height=0) Window(col_off=0, row_off=0, width=10, height=10)
The old code checks to see if the two windows have a common area. The first window is clearly inside the second, but doesn't share common area.
Perhaps intersection could simply check if the offset point of one window is contained in the other window if the one of the windows is zero area.