saveoff(v,f,fname) save a surface mesh to Geomview Object File Format (OFF) author: Qianqian Fang, <q.fang at neu.edu> date: 2007/03/28 input: v: input, surface node list, dimension (nn,3) f: input, surface face element list, dimension (be,3) fname: output file name -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0001 function saveoff(v,f,fname) 0002 % 0003 % saveoff(v,f,fname) 0004 % 0005 % save a surface mesh to Geomview Object File Format (OFF) 0006 % 0007 % author: Qianqian Fang, <q.fang at neu.edu> 0008 % date: 2007/03/28 0009 % 0010 % input: 0011 % v: input, surface node list, dimension (nn,3) 0012 % f: input, surface face element list, dimension (be,3) 0013 % fname: output file name 0014 % 0015 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net) 0016 % 0017 0018 fid=fopen(fname,'wt'); 0019 if(fid==-1) 0020 error('You do not have permission to save mesh files.'); 0021 end 0022 fprintf(fid,'OFF\n'); 0023 fprintf(fid,'%d\t%d\t%d\n',length(v),length(f),0); 0024 fprintf(fid,'%.16f\t%.16f\t%.16f\n',v'); 0025 face=[size(f,2)*ones(size(f,1),1) f-1]; 0026 format=[repmat('%d\t',1,size(face,2)-1) '%d\n']; 0027 fprintf(fid,format,face'); 0028 fclose(fid); 0029