$search
00001 /* 00002 James R. Diebel 00003 Stanford University 00004 00005 Started: 18 January 2005 00006 00007 off2msh.cc - Utility to convert a OFF file to a mesh (MSH) file 00008 00009 Depends on: 00010 - Mesh class (mesh.hh) 00011 -- Vec3d class (vec3d.hh) 00012 -- Vert class (vert.hh) 00013 -- Edge class (edge.hh) 00014 -- Face class (face.hh) 00015 - Timer class (timer.hh) 00016 - TriMesh class (trimesh.h) 00017 */ 00018 00019 00020 #include <iostream> 00021 #include "bmtk/mesh.hh" 00022 #include "bmtk/timer.hh" 00023 #include <trimesh/trimesh.h> 00024 00025 using namespace std; 00026 using namespace bmtk; 00027 00028 int main (int argc, char *argv[]) { 00029 // if bad command line args, give usage instructions and exit 00030 if (argc < 3) { 00031 cout << endl 00032 << "Usage: om2msh infile.om outfile.msh" << endl 00033 << " infile.om must be a .OM file" << endl 00034 << " outfile.msh is the name of the output msh file" << endl; 00035 exit(1); 00036 } 00037 00038 // create empty Mesh and then fill it with data from ply file 00039 Mesh m; 00040 int nv - 00041 // parse TriMesh into standard vertex and face lists 00042 float* v = new float[3*nv]; 00043 int* f = new int[3*nf]; 00044 float tempFloat; 00045 for (int i=0;i<nv;i++) { 00046 for (int j=0;j<3;j++) { 00047 fin >> tempFloat; 00048 v[3*i+j] = tempFloat; 00049 } 00050 } 00051 for (int i=0;i<nf;i++) { 00052 fin >> tempInt; 00053 for (int j=0;j<3;j++) { 00054 fin >> tempInt; 00055 f[3*i+j] = tempInt; 00056 } 00057 } 00058 00059 00060 // output it to the specified file 00061 fm->writeMesh(argv[2]); 00062 //m.writeMesh(argv[2]); 00063 00064 return 0; 00065 }