www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ConvexHullin3DSpaceExample.m
%% Convex Hull in 3-D Space % Use |convexHull| to calculate the convex hull of a set of random points % within a unit cube. % Copyright 2015 The MathWorks, Inc. %% % Create a Delaunay triangulation from a set of random points. P = gallery('uniformdata',[25,3],1); DT = delaunayTriangulation(P); %% % Calculate the convex hull and the volume bounded by the convex hull. [K,v] = convexHull(DT); %% % Examine the volume. v %% % Plot the convex hull. trisurf(K,DT.Points(:,1),DT.Points(:,2),DT.Points(:,3),... 'FaceColor','cyan')