%% Using alphaShape Objects
% This example shows how to change an alpha shape object and compute useful quantities that describe the alpha shape.
% Create and plot a set of 2-D points.

rng(4)
x = randn(50,1);
y = randn(50,1);
plot(x,y,'.')

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

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

%
% Change the alpha radius to 0.5 to tighten the boundary around the set of points.

shp.Alpha = 0.5;
plot(shp)

%
% Query the number of regions that make up the new alpha shape.

numRegions(shp)

%
% Suppress the smaller of the two regions.

shp.RegionThreshold = 1;
plot(shp)

%
% Compute the perimeter and area of the remaining region.

regionperims = perimeter(shp)
regionareas = area(shp)

% Copyright 2015 The MathWorks, Inc.