32 #include<vcg/complex/complex.h>
34 #include<vcg/complex/algorithms/clean.h>
35 #include<vcg/complex/algorithms/smooth.h>
37 #include <wrap/io_trimesh/import.h>
38 #include <wrap/io_trimesh/export_ply.h>
48 struct MyUsedTypes :
public UsedTypes< Use<MyVertex>::AsVertexType, Use<MyFace>::AsFaceType>{};
49 class MyVertex :
public Vertex< MyUsedTypes, vertex::VFAdj, vertex::Coord3f, vertex::Normal3f, vertex::BitFlags >{};
50 class MyFace :
public Face < MyUsedTypes, face::VFAdj, face::Normal3f, face::VertexRef, face::BitFlags > {};
51 class MyMesh :
public vcg::tri::TriMesh<vector<MyVertex>, vector<MyFace> > {};
53 int main(
int argc,
char ** argv)
57 printf(
"Usage: trimesh_smooth <filename> <steps> <sigma> <fitstep>\n");
61 int Step= atoi(argv[2]);
66 int err = tri::io::Importer<MyMesh>::Open(m,argv[1]);
68 printf(
"Error in reading %s: '%s'\n",argv[1], tri::io::Importer<MyMesh>::ErrorMsg(err));
75 printf(
"Removed %i duplicate and %i unreferenced vertices from mesh %s\n",dup,unref,argv[1]);
79 for(
int i=0;i<Step;++i)
82 tri::Smooth<MyMesh>::VertexCoordPasoDoble(m,atoi(argv[3]),atof(argv[4]),atoi(argv[5]));
86 tri::io::ExporterPLY<MyMesh>::Save(m,
"out.ply");