www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/UsingAlphaShapeObjectsExample.m

    %% Using alphaShape Objects
% This example shows how to change an alpha shape object and compute useful
% quantities that describe the alpha shape.

% Copyright 2015 The MathWorks, Inc.


%%
% Create and plot a set of 2-D points.
x = gallery('normaldata',50,1,1);
y = gallery('normaldata',50,1,2);
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)