function [A,n]=dispersity(V,C); % [A,n]=dispersity(V,C) % Computes the areas, 'A', and number of sides, 'n', of cells of a cellular structure with vertices 'V', with % individual cells 'C' % The areas are computed by using the formula on http://mathworld.wolfram.com/PolygonArea.html % A - Vector of reals containing areas of individual cells in 'C' % n - Number of sides(neighbors) to the individual cell. % V - List of x-y coordinates of vertices in cellular structure % C - Cell array of vertex indices comprising individual cells % %For bugs, comments, etc. please contact Kapil Krishan : %kkrishan@uci.edu %www.physics.uci.edu/~foams %version: I A=zeros(size(C,1),1); n=zeros(size(C,1),1); for ic=1:size(C,1) V_cell=V(C{ic},:); area_det=(det(V_cell([end 1],:))); for icc=1:size(V_cell,1)-1 area_det=area_det+(det(V_cell([icc icc+1],:))); end A(ic)=abs(area_det)/2; n(ic)=length(C{ic}); end