Home > matGeom > meshes3d > meshFaceAdjacency.m

meshFaceAdjacency

PURPOSE ^

MESHFACEADJACENCY Compute adjacency list of face around each face.

SYNOPSIS ^

function adjList = meshFaceAdjacency(vertices, edges, faces)

DESCRIPTION ^

MESHFACEADJACENCY Compute adjacency list of face around each face.


   Example
     % Create a sample 3D mesh
     [v, e, f] = createDodecahedron;
     adjList = meshFaceAdjacency(v, e, f);
     figure; hold on; axis equal; view([100 40]);
     drawMesh(v, f);
     % draw sample face in a different color
     drawMesh(v, f(1, :), 'faceColor', 'b');
     % draw the neighbors of a sample face
     drawMesh(v, f(adjList{1}, :), 'faceColor', 'g')

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function adjList = meshFaceAdjacency(vertices, edges, faces)
0002 %MESHFACEADJACENCY Compute adjacency list of face around each face.
0003 %
0004 %
0005 %   Example
0006 %     % Create a sample 3D mesh
0007 %     [v, e, f] = createDodecahedron;
0008 %     adjList = meshFaceAdjacency(v, e, f);
0009 %     figure; hold on; axis equal; view([100 40]);
0010 %     drawMesh(v, f);
0011 %     % draw sample face in a different color
0012 %     drawMesh(v, f(1, :), 'faceColor', 'b');
0013 %     % draw the neighbors of a sample face
0014 %     drawMesh(v, f(adjList{1}, :), 'faceColor', 'g')
0015 %
0016 %
0017 
0018 % ------
0019 % Author: David Legland
0020 % e-mail: david.legland@grignon.inra.fr
0021 % Created: 2010-10-04,    using Matlab 7.9.0.529 (R2009b)
0022 % Copyright 2010 INRA - Cepia Software Platform.
0023 
0024 
0025 edgeFaceList = meshEdgeFaces(vertices, edges, faces);
0026 
0027 % allocate memory for adjacency list
0028 nFaces = max(edgeFaceList(:));
0029 adjList = cell(1, nFaces);
0030 
0031 % iterate over edges to populate adjacency list
0032 for iEdge = 1:size(edgeFaceList)
0033     f1 = edgeFaceList(iEdge, 1);
0034     f2 = edgeFaceList(iEdge, 2);
0035     adjList{f1} = [adjList{f1} f2];
0036     adjList{f2} = [adjList{f2} f1];
0037 end

Generated on Wed 16-Feb-2022 15:10:47 by m2html © 2003-2019