area of patch triangle area = vb_mesh_area(V,F) --- Input V(n,1:3) : vertex of surface F(m,1:3) : patch index --- Output area(m) : area of patch triangle F(m,1:3) Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function [sarea, asum, adev] = vb_mesh_area(V,F) 0002 % area of patch triangle 0003 % area = vb_mesh_area(V,F) 0004 % --- Input 0005 % V(n,1:3) : vertex of surface 0006 % F(m,1:3) : patch index 0007 % --- Output 0008 % area(m) : area of patch triangle F(m,1:3) 0009 % 0010 % Copyright (C) 2011, ATR All Rights Reserved. 0011 % License : New BSD License(see VBMEG_LICENSE.txt) 0012 0013 Npatch = size(F,1); % number of patch 0014 0015 % 三角面3頂点のインデックス 0016 F1 = F(:,1); 0017 F2 = F(:,2); 0018 F3 = F(:,3); 0019 0020 % 3角面の法線ベクトル 0021 xxf = vb_cross2( V(F2,:)-V(F1,:) , V(F3,:)-V(F1,:) ); 0022 0023 sarea = sqrt(sum(xxf.^2,2)); 0024 0025 asum=sum(sarea)/Npatch; 0026 0027 adev=sqrt(sum((sarea-asum).^2)/Npatch);