%% Shrink Factor Effect on 3-D Boundary
% Create and plot a set of random 3-D points.

rng default;
P = rand(30,3);
plot3(P(:,1),P(:,2),P(:,3),'.')
grid on

%
% Compute two boundaries: one with a shrink factor of 0 and the other with a shrink factor of 1.

k = boundary(P,0);
j = boundary(P,1);

%
% Compare the shrink factors by plotting the original points and the two boundaries side-by-side.

subplot(1,2,1);
plot3(P(:,1),P(:,2),P(:,3),'.','MarkerSize',10)
hold on
trisurf(k,P(:,1),P(:,2),P(:,3),'FaceColor','red','FaceAlpha',0.1)
axis equal
title('Shrink Factor = 0')

subplot(1,2,2);
plot3(P(:,1),P(:,2),P(:,3),'.','MarkerSize',10)
hold on
trisurf(j,P(:,1),P(:,2),P(:,3),'FaceColor','red','FaceAlpha',0.1)
axis equal
title('Shrink Factor = 1')

% Copyright 2015 The MathWorks, Inc.