MESHFACEEDGES Computes edge indices of each face. FE = meshFaceEdges(V, E, F) Returns a 1-by-NF cell array containing for each face, the set of edge indices corresponding to adjacent edges. Example meshFaceEdges See also meshes3d, meshEdgeFaces
0001 function FE = meshFaceEdges(vertices, edges, faces) 0002 %MESHFACEEDGES Computes edge indices of each face. 0003 % 0004 % FE = meshFaceEdges(V, E, F) 0005 % Returns a 1-by-NF cell array containing for each face, the set of edge 0006 % indices corresponding to adjacent edges. 0007 % 0008 % Example 0009 % meshFaceEdges 0010 % 0011 % See also 0012 % meshes3d, meshEdgeFaces 0013 0014 % ------ 0015 % Author: David Legland 0016 % E-mail: david.legland@inrae.fr 0017 % Created: 2013-08-22, using Matlab 7.9.0.529 (R2009b) 0018 % Copyright 2013-2024 INRA - Cepia Software Platform 0019 0020 nFaces = meshFaceNumber(vertices, faces); 0021 0022 FE = cell(nFaces, 1); 0023 0024 % impose ordering of edge indices 0025 edges = sort(edges, 2); 0026 0027 for iFace = 1:nFaces 0028 % extract vertex indices of current face 0029 face = meshFace(faces, iFace); 0030 nv = length(face); 0031 0032 % for each couple of adjacent vertices, find the index of the matching 0033 % row in the edges array 0034 fei = zeros(1, nv); 0035 for iEdge = 1:nv 0036 % compute index of each edge vertex 0037 edge = sort([face(iEdge) face(mod(iEdge, nv) + 1)]); 0038 v1 = edge(1); 0039 v2 = edge(2); 0040 0041 % find the matching row 0042 ind = find(edges(:,1) == v1 & edges(:,2) == v2); 0043 fei(iEdge) = ind; 0044 0045 end 0046 FE{iFace} = fei; 0047 end