%% Vector of Polygons
% Create a vector containing two polygons.

polyarray1 = polyshape([0 0 1 1],[1 0 0 1]);
polyarray2 = polyshape([0.75 1.25 1.25 0.75],[0.25 0.25 0.75 0.75]);
poly1 = [polyarray1 polyarray2]
plot(poly1(1))
hold on
plot(poly1(2))
figure

%
% Compute the intersection of the elements of poly1.

polyout = intersect(poly1)
plot(polyout)
xlim([-0.2 1.4]);
ylim([-0.2 1.2]);

% Copyright 2012 The MathWorks, Inc.