%% Alpha Shape from 3-D Point Cloud
% Find the shape of a 3-D point cloud of data.
%
% Create and plot a set of 3-D points.

[x1,y1,z1] = sphere(24);
x1 = x1(:);
y1 = y1(:);
z1 = z1(:);
x2 = x1+5;
P = [x1 y1 z1; x2 y1 z1];
P = unique(P,'rows');
plot3(P(:,1),P(:,2),P(:,3),'.')
axis equal
grid on

%
% Compute a 3-D alpha shape using an alpha radius of 1.

shp = alphaShape(P(:,1),P(:,2),P(:,3),1);
plot(shp)
axis equal

% Copyright 2015 The MathWorks, Inc.