#include #include #include #include #include #include #include // to clean up a mesh #include #include // input output #include #include using namespace vcg; using namespace std; class MyFace; class MyVertex; struct MyUsedTypes : public UsedTypes< Use::AsVertexType, Use::AsFaceType>{}; class MyVertex : public Vertex< MyUsedTypes, vertex::VFAdj, vertex::Coord3f, vertex::Normal3f, vertex::BitFlags >{}; class MyFace : public Face < MyUsedTypes, face::VFAdj, face::Normal3f, face::VertexRef, face::BitFlags > {}; class MyMesh : public vcg::tri::TriMesh, vector > {}; int main(int argc,char ** argv) { if(argc<4) { printf("Usage: trimesh_smooth \n"); return 0; } MyMesh m; //open a mesh int err = tri::io::Importer::Open(m,argv[1]); if(err) { // all the importers return 0 in case of success 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]); int Step= atoi(argv[2]); tri::UpdateTopology::VertexFace(m); for(int i=0;i::PerFaceNormalized(m); tri::Smooth::VertexCoordPasoDobleFast(m,atoi(argv[3]),atof(argv[4]),atoi(argv[5])); } //LaplacianSmooth(m,atoi(argv[2])); tri::io::ExporterPLY::Save(m,"out.ply"); return 0; }