#include #include #include #include // to clean up a mesh #include #include // input output #include #include using namespace vcg; class MyFace; class MyEdge; class MyVertex:public Vertex{}; class MyFace :public FaceFN{}; class MyMesh: public tri::TriMesh< std::vector, std::vector >{}; int main(int argc,char ** argv) { if(argc<3) { printf("Usage: trimesh_smooth \n"); return 0; } MyMesh m; //open a mesh int err = tri::io::Importer::Open(m,argv[1]); if(err) { printf("Error in reading %s: '%s'\n",argv[1],tri::io::Importer::ErrorMsg(err)); exit(-1); } // some cleaning to get rid of bad file formats like stl that duplicate vertexes.. int dup = tri::Clean::RemoveDuplicateVertex(m); int unref = tri::Clean::RemoveUnreferencedVertex(m); printf("Removed %i duplicate and %i unreferenced vertices from mesh %s\n",dup,unref,argv[1]); LaplacianSmooth(m,atoi(argv[2])); tri::io::ExporterPLY::Save(m,"out.ply"); return 0; }