eid=getintersecttri(tmppath) get the IDs of self-intersecting elements from tetgen call this when tetgen complains about self-intersection author: Qianqian Fang, <q.fang at neu.edu> input: tmppath: working dir, use mwpath('') in most cases output: eid: an array of all intersecting surface elements, one can read the corresponding node/elem by [no,el]=readoff(mwpath('post_vmesh.off')); -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0001 function eid=getintersecttri(tmppath) 0002 % 0003 % eid=getintersecttri(tmppath) 0004 % 0005 % get the IDs of self-intersecting elements from tetgen 0006 % call this when tetgen complains about self-intersection 0007 % 0008 % author: Qianqian Fang, <q.fang at neu.edu> 0009 % 0010 % input: 0011 % tmppath: working dir, use mwpath('') in most cases 0012 % 0013 % output: 0014 % eid: an array of all intersecting surface elements, 0015 % one can read the corresponding node/elem by 0016 % [no,el]=readoff(mwpath('post_vmesh.off')); 0017 % 0018 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net) 0019 % 0020 0021 exesuff=getexeext; 0022 exesuff=fallbackexeext(exesuff,'tetgen'); 0023 0024 [status,str] = system(['"' mcpath('tetgen') exesuff '" -d "' ... 0025 tmppath 'post_vmesh.poly"']) 0026 0027 eid=[]; 0028 if(status==0) 0029 id=regexp(str, ' #([0-9]+) ', 'tokens'); 0030 for j=1:length(id) 0031 eid(end+1)=str2num(id{j}{1}); 0032 end 0033 end 0034 eid=unique(eid);