4 ms·
What jumped to my mind is that if you detect the vertical and horizontal lines - O(n) - and call those corners 'm'. You can then just run the O(n^2) bit on m ra
by willvarfar 15y ago
What jumped to my mind is that if you detect the vertical and horizontal lines - O(n) - and call those corners 'm'. You can then just run the O(n^2) bit on m rather than the whole n. Worst case n=m, but usually m will be massively smaller.
http://stackoverflow.com/questions/289779/calculating-a-boundary-around-several-linked-rectangles/294549#294549 http://stackoverflow.com/questions/289779/calculating-a-boun...