Home > vbmeg > functions > brain > vb_calc_patch_area.m

vb_calc_patch_area

PURPOSE ^

--- get area of patches

SYNOPSIS ^

function [xxA] = vb_calc_patch_area(V,F3,xxT)

DESCRIPTION ^

 --- get area of patches
  [xxA] = vb_calc_patch_area(V,F3,xxT)

 [history]
 2010-05-28 Taku Yoshioka
  Minor change (verbose level support)

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    [xxA] = vb_calc_patch_area(V,F3,xxT)
0002 % --- get area of patches
0003 %  [xxA] = vb_calc_patch_area(V,F3,xxT)
0004 %
0005 % [history]
0006 % 2010-05-28 Taku Yoshioka
0007 %  Minor change (verbose level support)
0008 %
0009 % Copyright (C) 2011, ATR All Rights Reserved.
0010 % License : New BSD License(see VBMEG_LICENSE.txt)
0011 
0012 tic;
0013 vb_disp_nonl('Patch area: ');
0014 
0015 Npatch  = size(F3,1); 
0016 Ndipole = size(V,1);
0017 FA        = zeros(Npatch,1);
0018 
0019 for i=1:Npatch,
0020   xpl   = vb_cross2(V(F3(i,2),:)-V(F3(i,1),:), V(F3(i,3),:)-V(F3(i,1),:));
0021   FA(i) = sqrt(xpl*xpl')/2;      % patch area by cross product
0022 end
0023 
0024 ix = find(FA<eps);
0025 
0026 if ~isempty(ix), 
0027   vb_disp('!! There are some abnormal areas '); 
0028   FA(ix)=0;
0029 end
0030 
0031 vb_disp_nonl(sprintf('%f[sec]\n',toc));
0032 
0033 %
0034 % --- Allocate area for each dipole
0035 %
0036 tic;
0037 vb_disp_nonl('Allocate triangle area to each vertex: ');
0038 
0039 xxA=zeros(Ndipole,1);
0040 
0041 for i=1:Ndipole,
0042     rix    = xxT{i};
0043     xxA(i) = sum(FA(rix))/3;        % 1/3 of total triangle area
0044 %    xxA(i) = sum(FA(rix))/length(rix);    % mean area
0045 end    
0046

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005