Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00033 #include<vcg/complex/complex.h>
00034
00035 #include<wrap/io_trimesh/import_ply.h>
00036 #include<wrap/io_trimesh/export_ply.h>
00037
00038 #include<vcg/complex/algorithms/implicit_smooth.h>
00039
00040 using namespace vcg;
00041 using namespace std;
00042
00043 class MyEdge;
00044 class MyFace;
00045 class MyVertex;
00046 struct MyUsedTypes : public vcg::UsedTypes< vcg::Use<MyVertex> ::AsVertexType,
00047 vcg::Use<MyEdge> ::AsEdgeType,
00048 vcg::Use<MyFace> ::AsFaceType>{};
00049
00050 class MyVertex : public vcg::Vertex<MyUsedTypes, vcg::vertex::Coord3f, vcg::vertex::Normal3f, vcg::vertex::BitFlags >{};
00051 class MyFace : public vcg::Face< MyUsedTypes, vcg::face::FFAdj, vcg::face::Normal3f, vcg::face::VertexRef, vcg::face::BitFlags > {};
00052 class MyEdge : public vcg::Edge<MyUsedTypes>{};
00053 class MyMesh : public vcg::tri::TriMesh< std::vector<MyVertex>, std::vector<MyFace> , std::vector<MyEdge> > {};
00054
00055
00056 int main( int argc, char **argv )
00057 {
00058 MyMesh m;
00059 if(argc < 2 )
00060 {
00061 printf("Usage: trimesh_implicit_smooth mesh.ply\n");
00062 return -1;
00063 }
00064
00065 int ret= tri::io::ImporterPLY<MyMesh>::Open(m,argv[1]);
00066 if(ret!=0)
00067 {
00068 printf("Unable to open %s for '%s'\n",argv[1],tri::io::ImporterPLY<MyMesh>::ErrorMsg(ret));
00069 return -1;
00070 }
00071
00072 tri::UpdateTopology<MyMesh>::FaceFace(m);
00073
00074 ImplicitSmoother<MyMesh>::Parameter par;
00075 par.lambda = 0.5f;
00076 ImplicitSmoother<MyMesh>::Compute(m,par);
00077
00078 tri::io::ExporterPLY<MyMesh>::Save(m,"smooth.ply",tri::io::Mask::IOM_VERTCOLOR | tri::io::Mask::IOM_VERTQUALITY);
00079
00080 return 0;
00081 }