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

    %% Plot Tetrahedrons of 3-D Delaunay Triangulation
% Generate a 3-D Delaunay triangulation, then use |tetramesh| to
% visualize the tetrahedrons.

% Copyright 2015 The MathWorks, Inc.

d = [-1 1];
[x,y,z] = meshgrid(d,d,d); % a cube
x = [x(:);0];
y = [y(:);0];
z = [z(:);0];
%%
% |[x,y,z]| are corners of a cube plus the center.
%%
DT = delaunayTriangulation(x,y,z);
tetramesh(DT);
camorbit(20,0)