%% Surface Feature Edges
% Find and plot the feature edges of a surface.
% Create a 2-D Delaunay triangulation.

x = [0 0 0 0 0 3 3 3 3 3 3 6 6 6 6 6 9 9 9 9 9 9]';
y = [0 2 4 6 8 0 1 3 5 7 8 0 2 4 6 8 0 1 3 5 7 8]';
DT = delaunayTriangulation(x,y);
T = DT.ConnectivityList;

%
% Add elevations to the triangulation to create a surface and plot the surface.

z = [0 0 0 0 0 2 2 2 2 2 2 0 0 0 0 0 0 0 0 0 0 0]';
trisurf(T,x,y,z,'FaceColor','cyan') 
axis equal

%
% Create a new triangulation on the elevated surface, and compute and plot its feature edges using a filter angle of \frac{\pi}{6}.

TR = triangulation(T,x,y,z);
F = featureEdges(TR,pi/6)';
plot3(x(F),y(F),z(F),'k','LineWidth',1.5); 
axis equal

% Copyright 2015 The MathWorks, Inc.