I am looking for a way to calculate the common areas covered by multiple overlapping polygons. The polygons are all right-angled, if that helps makes things easier.
So for example:
BBBBB BBBBB AAA---BB AAA---BB AAAAAA AA--AA AA--AA LL LL LLLLLL LLLLLL
I would like to find the common area covered by A, B and L, which would equal: B = 5x4 = 20 + A = 6x5 = 30 + L = 4x2 + 6x2 = 20 = 70 minus overlapping areas: - 10 = 60 (common area covered by all polygons)
I need to be able to cater for situations where 3 or more polygons occupy the same area. Is there a suitable algorithm for this, which could take arrays of arrays of x/y co-ordinates as inputs? (sample Java source code would be very welcome).