[edges,idx,edgemap]=uniqedges(elem) return the unique edge list from a surface or tetrahedral mesh author: Qianqian Fang, <q.fang at neu.edu> input: elem: a list of elements, each row is a list of nodes for an element. elem can have 2, 3 or 4 columns output: edge: unique edges in the mesh, denoted by a pair of node indices idx: index of the output in the raw edge list (returned by meshedge) edgemap: index of the raw edges in the output list (for triangular mesh) -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0001 function [edges,idx,edgemap]=uniqedges(elem) 0002 % 0003 % [edges,idx,edgemap]=uniqedges(elem) 0004 % 0005 % return the unique edge list from a surface or tetrahedral mesh 0006 % 0007 % author: Qianqian Fang, <q.fang at neu.edu> 0008 % 0009 % input: 0010 % elem: a list of elements, each row is a list of nodes for an element. 0011 % elem can have 2, 3 or 4 columns 0012 % 0013 % output: 0014 % edge: unique edges in the mesh, denoted by a pair of node indices 0015 % idx: index of the output in the raw edge list (returned by meshedge) 0016 % edgemap: index of the raw edges in the output list (for triangular mesh) 0017 % 0018 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net) 0019 % 0020 0021 if(size(elem)==2) 0022 edges=elem; 0023 elseif(size(elem)>=3) 0024 edges=meshedge(elem); 0025 else 0026 error('invalid input'); 0027 end 0028 0029 [uedges,idx,jdx]=unique(sort(edges,2),'rows'); 0030 edges=edges(idx,:); 0031 if(nargout>2) 0032 edgemap=reshape(jdx,[size(elem,1) nchoosek(size(elem,2),2)]); 0033 end