Robust way to calculate volume of a 3D polygon given a triangulation
7 ビュー (過去 30 日間)
古いコメントを表示
I am looking for a way to calculate the volume of this shape. I export this shape to a professional finite element software which gives the volume as 4.0821e-8 so that is the number I am looking for. I currently use the following:
i1 = tri(:,1);
i2 = tri(:,2);
i3 = tri(:,3);
% vectors of triangle base
v1 = [p2(i1,1)-p2(i2,1) p2(i1,2)-p2(i2,2) p2(i1,3)-p2(i2,3)];
v2 = [p2(i1,1)-p2(i3,1) p2(i1,2)-p2(i3,2) p2(i1,3)-p2(i3,3)];
A = 1/2*cross(v1,v2,2); % surface of a triangle
V = 1/3*dot(A,[x(i1) y(i1) z(i1)],2); % volume of a triangle
V = sum(abs(V))
But it gives a different value. How can I find the volume robustly? I have attached a mat file with the variables tri and p2 such that ths plots the shape:
trisurf(tri,p2(:,1),p2(:,2),p2(:,3),'facecolor','c','edgecolor','b')
1 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Triangulation Representation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!