Home > vbmeg > external > iso2mesh > removeisolatedsurf.m

removeisolatedsurf

PURPOSE ^

SYNOPSIS ^

function fnew=removeisolatedsurf(v,f,maxdiameter)

DESCRIPTION ^

 fnew=removeisolatedsurf(v,f,maxdiameter)

 remove disjointed surface fragment filtered by using mesh diameter

 author: Qianqian Fang, <q.fang at neu.edu>

 input:
    v: list of nodes of the input surface
    f: list of triangles of the input surface
    maxdiameter: maximum bounding box size for surface removal

 ouput:
    fnew: new face list after removing the components smaller than 
          maxdiameter

 -- 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 fnew=removeisolatedsurf(v,f,maxdiameter)
0002 %
0003 % fnew=removeisolatedsurf(v,f,maxdiameter)
0004 %
0005 % remove disjointed surface fragment filtered by using mesh diameter
0006 %
0007 % author: Qianqian Fang, <q.fang at neu.edu>
0008 %
0009 % input:
0010 %    v: list of nodes of the input surface
0011 %    f: list of triangles of the input surface
0012 %    maxdiameter: maximum bounding box size for surface removal
0013 %
0014 % ouput:
0015 %    fnew: new face list after removing the components smaller than
0016 %          maxdiameter
0017 %
0018 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0019 %
0020 
0021 fc=finddisconnsurf(f);
0022 for i=1:length(fc)
0023     xdia=v(fc{i},1);
0024     xdia=max(xdia(:))-min(xdia(:));
0025     if(xdia<=maxdiameter) fc{i}=[]; continue; end
0026     ydia=v(fc{i},2);
0027     ydia=max(ydia(:))-min(ydia(:));
0028     if(ydia<=maxdiameter) fc{i}=[]; continue; end
0029     zdia=v(fc{i},3);
0030     zdia=max(zdia(:))-min(zdia(:));
0031     if(zdia<=maxdiameter) fc{i}=[]; continue; end
0032 end
0033 fnew=[];
0034 for i=1:length(fc)
0035     if(length(fc{i})) fnew=[fnew;fc{i}]; end
0036 end
0037 if(size(fnew,1)~=size(f,1))
0038    fprintf(1,'removed %d elements of small isolated surfaces',size(f,1)-size(fnew,1)); 
0039 end

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