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

    %% Alpha Shape from 3-D Point Cloud
% Create and plot a set of 3-D points.

% Copyright 2015 The MathWorks, Inc.

[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