I have complex polygons which I know the minimum x, minimum y, maximum x and maximum y. I also have another rectangle which I know the top left and bottom right vertices. Knowing this information, how can I know if these 2 bounding boxes are colliding? Thanks
Share
Try something like this:
You can do the same for any polygon, just iterate through all of its points and call
is_point_in_rectanglewith them. Since you only have a bounding box for the complex polygon, there is a chance that this method gives you a false positive (that is, the rectangle is inside the complex polygon’s bounding box but outside of the polygon itself). However, this restriction applies to any method where a complex shape is simplified to a bounding box.