0001 function [edges] = mne_mesh_edges(faces)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 me = 'MESH_EDGES';
0017
0018 if nargin == 0
0019 eval(['help ',lower(me)])
0020 return
0021 end
0022
0023 faces = double(faces);
0024 npoints = max(faces(:));
0025 nfaces = size(faces,1);
0026 edges = sparse(faces(:,1),faces(:,2),ones(1,nfaces),npoints,npoints);
0027 edges = edges + sparse(faces(:,2),faces(:,3),ones(1,nfaces),npoints,npoints);
0028 edges = edges + sparse(faces(:,3),faces(:,1),ones(1,nfaces),npoints,npoints);
0029
0030 edges = edges + edges';
0031
0032 end