www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/FindIncentersin2DDelaunayTriangulationExample.m

    %% Find Incenters in 2-D Delaunay Triangulation  

% Copyright 2015 The MathWorks, Inc.


%% 
% Create the Delaunay triangulation. 
x = [0 1 1 0 0.5]';
y = [0 0 1 1 0.5]';
DT = delaunayTriangulation(x,y);  

%% 
% Calculate incenters of the triangles 
IC = incenter(DT)  

%% 
% Plot the triangles and incenters.  
figure
triplot(DT)
axis equal
axis([-0.2 1.2 -0.2 1.2])
hold on 
plot(IC(:,1),IC(:,2),'*r') 
hold off