%% Find Perimeter of 2-D Alpha Shape
% Create a set of 2-D points.

th = (pi/12:pi/12:2*pi)';
x1 = [reshape(cos(th)*(1:5), numel(cos(th)*(1:5)),1); 0];
y1 = [reshape(sin(th)*(1:5), numel(sin(th)*(1:5)),1); 0];
x = [x1; x1+15;];
y = [y1; y1];

%
% Create and plot an alpha shape using an alpha radius of 2.5.

shp = alphaShape(x,y,2.5);
plot(shp)

%
% Compute the perimeter of the alpha shape.

totalperim = perimeter(shp)

%
% Compute the perimeters of each of the two regions separately.

regionperims = perimeter(shp, 1:numRegions(shp))

% Copyright 2015 The MathWorks, Inc.