I have two GPS locations. For each I am creating a bounding box in a different range. Each bounding box has min/max latitude and min/max longitude.
Need to implement a method to detect if those two boxes overlap (don't mind the overlap range.. only true/false). Also, this method will be integrated in a long loop so I am looking for the most efficient way to do it.
note: when saying overlap I mean - "there is at least one single point on the map that is contained in both bounding boxes".
Any ideas?
It's enough to check if one of the corners of one rectangle is within the other rectangle. This is true of these two hold:
This check should take no time at all to do, so efficiency isn't a problem. Also, the order of the arguments is irrelevant.