%% Convex Hull of 3-D Random Points
% Compute the convex hull of a set of random points located within a unit cube in 3-D space. Specify two outputs with convexHull to also compute the volume bounded by the convex hull.

rng default
X = rand(25,3);
dt = DelaunayTri(X);
[ch,v] = convexHull(dt)

% Plot the convex hull.

trisurf(ch,dt.X(:,1),dt.X(:,2),dt.X(:,3),'FaceColor','cyan')

% Copyright 2020 The MathWorks, Inc.