tm038 发表于 2011-3-11 17:21

matlab里面有专门的函数吗?

ChaChing 发表于 2011-3-13 21:01

Ref: http://www.mathworks.com/matlabcentral/fileexchange/3321-area-and-volume-of-a-3d-convex-hullfunction =area3d(v)
% compute volume and area of a convex hull of points v
% Malcolm A. MacIver, 2003

=convhulln(v);

%
% Basic formula for computing triangle area
% || = 2-norm, VN = vertex of triangle
% ||V1 X V2 + V2 X V3 + V3 X V1||/2

area= ...
sum(sqrt(sum(( ...
[v(K(:,1),2).*v(K(:,2),3) - v(K(:,1),3).*v(K(:,2),2) ...
v(K(:,1),3).*v(K(:,2),1) - v(K(:,1),1).*v(K(:,2),3)...
v(K(:,1),1).*v(K(:,2),2) - v(K(:,1),2).*v(K(:,2),1)] + ...
[v(K(:,2),2).*v(K(:,3),3) - v(K(:,2),3).*v(K(:,3),2) ...
v(K(:,2),3).*v(K(:,3),1) - v(K(:,2),1).*v(K(:,3),3)...
v(K(:,2),1).*v(K(:,3),2) - v(K(:,2),2).*v(K(:,3),1)] + ...
[v(K(:,3),2).*v(K(:,1),3) - v(K(:,3),3).*v(K(:,1),2) ...
v(K(:,3),3).*v(K(:,1),1) - v(K(:,3),1).*v(K(:,1),3)...
v(K(:,3),1).*v(K(:,1),2) - v(K(:,3),2).*v(K(:,1),1)]).^2,2))) ...
/2;
页: 1 [2]
查看完整版本: 如何用matlab计算体积