My problem: I have photo of book converted to edges with many long and short polylines and I try find contour of book: make four polylines, outline of book.
I am using boxes aligned to axis in my problem and I wanna change to tighter rotated boxes. I have set of polylines sorted by its length (sum of length of its segments). I determine box of longest polyline, and box of next polylines. If boxes intersects, I extend first box which is now union of old box and box of new polyline. If boxes not intersects, I skip polyline.
If I change boxes to rotated boxes, I can determine box by rotating calipers algorithm.
My asks:
- how to check if two rotated boxes intersects?
- how to fast compute union, is possible incremental way?
I'm not interested in the common part of the rectangles, but only in checking if rectangles have common part.
Also I am interested in maybe other way of grouping lying close to each other polylines (preferring the longest).