This function takes the wireframe model created by readmesh and extracts one of the faces (fcnmb) into an indices matrix (fci) mapped on to indices matrix srf which, in turn, maps on to vtx. It also creates a matrix (fcsrf) which directly maps this face into vtx. Version 2.4 B.D.Grieve - 23/01/2002 srf = The boundary surfaces vtx = The vertices matrix fc = The face numbers to which each surface belong fcnmb = The number of the face to be extracted fcsrf = The indices into the vtx matrix for this face fci = The indices into the srf matrix of this face
0001 function[fcsrf,fci] = ng_extract_face(srf,vtx,fc,fcnmb) 0002 0003 % This function takes the wireframe model created by readmesh 0004 % and extracts one of the faces (fcnmb) into an indices 0005 % matrix (fci) mapped on to indices matrix srf which, in turn, 0006 % maps on to vtx. It also creates a matrix (fcsrf) which 0007 % directly maps this face into vtx. 0008 % 0009 % Version 2.4 0010 % B.D.Grieve - 23/01/2002 0011 % 0012 % 0013 % srf = The boundary surfaces 0014 % vtx = The vertices matrix 0015 % fc = The face numbers to which each surface belong 0016 % fcnmb = The number of the face to be extracted 0017 % fcsrf = The indices into the vtx matrix for this face 0018 % fci = The indices into the srf matrix of this face 0019 0020 fci = find( fc == fcnmb ); 0021 fcsrf= srf(fci,:); 0022 0023 return 0024 % OLDER, COMPLICATED CODE 0025 fcsrf = []; 0026 fci = []; 0027 for loop1 = 1:size(fc,1) 0028 if fc(loop1)==fcnmb 0029 fcsrf = [fcsrf; srf(loop1,:)]; % Concatenate fcsrf to map directly with vtx for this face 0030 fci = [fci; loop1]; % Concatenate fci with srf indices for this face 0031 end 0032 end