%% Surface of 3-D Triangulation
% You can use the freeBoundary function to extract the facets of a 3-D triangulation that cover the surface of an object.
% Load a 3-D triangulation.

load tetmesh
TR = triangulation(tet,X);

%
% Compute the boundary triangulation.

[F,P] = freeBoundary(TR);

%
% Plot the boundary triangulation.

trisurf(F,P(:,1),P(:,2),P(:,3), ...
       'FaceColor','cyan','FaceAlpha',0.8);

% Copyright 2015 The MathWorks, Inc.