Home > vbmeg > external > iso2mesh > savegts.m

savegts

PURPOSE ^

SYNOPSIS ^

function nedge=savegts(v,f,fname,edges)

DESCRIPTION ^

 nedge=savegts(v,f,fname,edges)

 save a surface mesh to GNU Triangulated Surface Format (GTS)

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

 input:
      v: input, surface node list, dimension (nn,3)
      f: input, surface face element list, dimension (be,3)
      fname: output file name
      edges: edge list, if ignored, savegts will compute

 output:
      nedge: the number of unique edges in the mesh

 -- 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 nedge=savegts(v,f,fname,edges)
0002 %
0003 % nedge=savegts(v,f,fname,edges)
0004 %
0005 % save a surface mesh to GNU Triangulated Surface Format (GTS)
0006 %
0007 % author: Qianqian Fang, <q.fang at neu.edu>
0008 % date: 2011/02/23
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 %      edges: edge list, if ignored, savegts will compute
0015 %
0016 % output:
0017 %      nedge: the number of unique edges in the mesh
0018 %
0019 % -- this function is part of iso2mesh toolbox (http://iso2mesh.sf.net)
0020 %
0021 
0022 fid=fopen(fname,'wt');
0023 if(fid==-1)
0024     error('You do not have permission to save mesh files.');
0025 end
0026 v=v(:,1:3);
0027 f=f(:,1:3);
0028 [edges,idx,edgemap]=uniqedges(f);
0029 nedge=size(edges,1);
0030 
0031 fprintf(fid,'%d %d %d\n',size(v,1),nedge,size(f,1));
0032 fprintf(fid,'%.16f %.16f %.16f\n',v');
0033 fprintf(fid,'%d %d\n',edges');
0034 fprintf(fid,'%d %d %d\n',edgemap');
0035 fclose(fid);

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