Reputation: 11
I have 2 lists of bounding boxes (each bounding box is defined by x_min, y_min, x_max, y_max). Let's call them arr1, and arr2. I want to find out all the intersections of bounding boxes that happen in arr1 with bounding boxes in arr2 (I don't care about intra-array intersections)
I have tried a quadratic solution - for each bounding box in arr1, I go through every single bounding box in arr2 and see if there is an intersection.
But for my usecase - thousands of bounding boxes in each array - I need a sub-quadratic algorithm.
I'm pretty sure this has probably been solved by someone else at some point, but I can't seem to find any references to a canonical way of solving this problem. Is it for example possible to use K-D trees to solve this problem sub-quadratically? Any pointers will be appreciated
Upvotes: 1
Views: 49