|
一、凸多边形
x = rand(10,1)
y = rand(10,1)
dt = delaunayTriangulation(x,y)
[k a] = convexHull(dt)
plot(dt.Points(:,1),dt.Points(:,2), '.', 'markersize',10); hold on;
plot(dt.Points(k,1),dt.Points(k,2), 'r'); hold off;
得到
k = 4
10
7
9
4
a =
0.4075
二、凸多面体
X = rand(25,3);
dt = delaunayTriangulation(X);
[ch v] = convexHull(dt);
trisurf(ch, dt.Points(:,1),dt.Points(:,2),dt.Points(:,3), 'FaceColor', 'cyan')
>> %体积
v =
0.4133
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-12-26 10:01
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社