Home > vbmeg > external > iso2mesh > surfpart.m

surfpart

PURPOSE ^

SYNOPSIS ^

function elist=surfpart(f,loopedge)

DESCRIPTION ^

 elist=surfpart(f,loopedge)

 partition a triangular surface using a closed loop defined by existing edges

 author: Qianqian Fang, <q.fang at neu.edu>
 date: 2012/02/09

 input:
      f: input, surface face element list, dimension (be,3)
      loopedge: a 2-column array, specifying a closed loop in CCW order

 output:
      elist: list of triangles that is enclosed by the loop

 -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function elist=surfpart(f,loopedge)
0002 %
0003 % elist=surfpart(f,loopedge)
0004 %
0005 % partition a triangular surface using a closed loop defined by existing edges
0006 %
0007 % author: Qianqian Fang, <q.fang at neu.edu>
0008 % date: 2012/02/09
0009 %
0010 % input:
0011 %      f: input, surface face element list, dimension (be,3)
0012 %      loopedge: a 2-column array, specifying a closed loop in CCW order
0013 %
0014 % output:
0015 %      elist: list of triangles that is enclosed by the loop
0016 %
0017 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0018 %
0019 
0020 elist=[];
0021 if(isempty(f) || isempty(loopedge))
0022     return;
0023 end
0024 
0025 if(size(f,2)==3)
0026     edges=[f(:,[1,2]);
0027            f(:,[2,3]);
0028            f(:,[3,1])];             % create all the edges
0029 elseif(size(f,2)==4)
0030     edges=[f(:,[1,2]);
0031            f(:,[2,3]);
0032            f(:,[3,4]);
0033            f(:,[4,1])];             % create all the edges
0034 else
0035     error('surfpart only supports triangular and quadrilateral elements');
0036 end
0037 
0038 [elist,front]=advancefront(edges,loopedge);
0039 while(~isempty(front))
0040     [elist0,front0]=advancefront(edges,front);
0041     elist=unique([elist;elist0]);
0042     front=front0;
0043 end

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