%% Compute Triangulation for 3-D Point Cloud
% Create 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');

%
% Create and plot an alpha shape for the point cloud using an alpha radius of 1.

shp = alphaShape(P,1);
plot(shp)

%
% Use alphaTriangulation to recover the triangulation that defines the domain of the alpha shape.

tri = alphaTriangulation(shp);

%
% Find the total number of tetrahedra that make up the alpha shape.

numtetrahedra = size(tri,1)

% Copyright 2015 The MathWorks, Inc.