MATLAB convhull
The convhull function calculates the indices of the convex hull encapsulating a set.
Contents
Usage
% Create a rectangular grid. [X,Y,Z] = meshgrid(linspace(-3,3,20), linspace(-3,3,20), linspace(-3,3,20)); % Identify the points within a region of integration. roi = (X>=0 & X<=sqrt(4-Z.^2-Y.^2)) & (Y>=0 & Y<=sqrt(4-Z.^2) & (Z>=0 & Z<=1)); % Calculate the convex hull of this ROI. K = convhull(X(roi), Y(roi), Z(roi));
K is now a 3-column matrix representing the indices that form the hull. This can be used with trisurf like:
trisurf(K, X(roi), Y(roi), Z(roi));
