L = linspace(0,2.*pi,9); xv = 1.2*cos(L)';yv = 1.2*sin(L)';
xv = [xv ; xv(1)]; yv = [yv ; yv(1)];
A = polyarea(xv,yv);
plot(xv,yv); title(['Area = ' num2str(A)]); axis image
figure
dt = DelaunayTri(xv,yv)
triplot(dt);
vxlabels = arrayfun(@(n) {sprintf('P%d', n)}, (1:10)');
Hpl = text(xv, yv, vxlabels, 'FontWeight', 'bold', 'HorizontalAlignment',...
'center', 'BackgroundColor', 'none');
ic = incenters(dt);
numtri = size(dt,1);
trilabels = arrayfun(@(x) {sprintf('T%d', x)}, (1:numtri)');
Htl = text(ic(:,1), ic(:,2), trilabels, 'FontWeight', 'bold', ...
'HorizontalAlignment', 'center', 'Color', 'blue');
hold off
[k,a] = convhull(xv,yv)
dt =
DelaunayTri
Properties:
Constraints: []
X: [9x2 double]
Triangulation: [7x3 double]
Methods, Superclasses
k =
1
2
3
4
5
6
7
8
9
1
面积为
a =
4.0729
转载本文请联系原作者获取授权,同时请注明本文来自王福昌科学网博客。
收藏
分享
分享到: