% ShowPoly
% Generates a random polygon with centroid (0,0) and explores the
% act of repeated midpoint connection

close all
% Generate a random polygon and briefly display it...
n = 30;
x = -1+2*rand(1,n); x = x-sum(x)/n;
y = -1+2*rand(1,n); y = y-sum(y)/n; 
DrawPoly(x,y)
pause(1)

% Obtain and display a sequence of polygons obtained by repeated
% connect-the-midpoints...
for k=1:200
    [xNew,yNew] = NewPoly(x,y);
    DrawPoly(xNew,yNew)
    pause(.05)
    x = xNew;
    y = yNew;
end
    

