%% Buffer Polygon
% Create a polygon with a solid boundary and a hole boundary. Then, create a buffer at a distance of 0.1 from the boundaries. By default the buffer has rounded joints.

polyin = polyshape({[0 0 1 3],[0.5 1.5 1.5 0.5]},{[0 3 3 0],[0.5 0.5 1.5 1.5]});
plot(polyin)
polyout1 = polybuffer(polyin,0.1);
hold on
plot(polyout1)
hold off

%
% Create a buffer using a miter limit of 2. The miter limit controls the pointiness of the joints.

polyout2 = polybuffer(polyin,0.1,'JointType','miter','MiterLimit',2);
plot(polyin)
hold on
plot(polyout2)

% Copyright 2012 The MathWorks, Inc.