MATLAB: How to calculate Area of overlapping polygons inside square

areaMATLABoverlappolygon

I have requirement to calculate percentage of area covered by polygons inside square(Green Border) for matlab plot.
Logic used is Area coverage= Area of outer square- area of each polygon- polygon overlapping area
I am stuck at finding overlapping area as there are more than 3 polygons overlapping. I am using intersect function for finding intersection
Is there any better method for this requirement(Can Non-plotted are be measured?)

Best Answer

Take the union of all the polyshape objects representing your polygons
Make a polyshape representing the interior and boundary of your square and intersect that square with the union polyshape.
This results in one final polyshape whose area you can compute.
Related Question