%% Overlapping Polygons
% Create and plot a 1-by-3 vector of polygons, then determine which pairs of polygons overlap.

p1 = polyshape([0 0 1 1],[1 0 0 1]);
p2 = polyshape([0.75 1.25 1.25 0.75],[0.25 0.25 0.75 0.75]);
p3 = polyshape([1.25 1.25 1.75 1.75],[0.75 1.25 1.25 0.75]);
polyvec = [p1 p2 p3];
plot(polyvec)
TF = overlaps(polyvec)

% Since the third polygon does not overlap either the first or second polygon, TF(1,3), TF(2,3), TF(3,1), and TF(3,2) are 0. The single point shared by the second and third polygon is not considered an overlapping region.
% Copyright 2012 The MathWorks, Inc.