Home > vbmeg > external > mne > mne_mesh_edges.m

mne_mesh_edges

PURPOSE ^

MESH_EDGES Returns sparse matrix with edges number

SYNOPSIS ^

function [edges] = mne_mesh_edges(faces)

DESCRIPTION ^

 MESH_EDGES   Returns sparse matrix with edges number

   SYNTAX
       [EDGES] = MESH_EDGES(FACES)

   faces : matrix of size [n_trianges, 3]
   edges : sparse matrix of size [n_vertices, n_vertices]

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [edges] = mne_mesh_edges(faces)
0002 
0003 % MESH_EDGES   Returns sparse matrix with edges number
0004 %
0005 %   SYNTAX
0006 %       [EDGES] = MESH_EDGES(FACES)
0007 %
0008 %   faces : matrix of size [n_trianges, 3]
0009 %   edges : sparse matrix of size [n_vertices, n_vertices]
0010 
0011 %
0012 %   Author : Alexandre Gramfort, MGH Martinos Center
0013 %   License : BSD 3-clause
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 %  function

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