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
00023
00024 #include<vcg/simplex/vertex/base.h>
00025 #include<vcg/simplex/vertex/component.h>
00026
00027 #include <vcg/complex/used_types.h>
00028
00029 #include<vcg/simplex/face/base.h>
00030 #include<vcg/simplex/face/component.h>
00031 #include<vcg/complex/complex.h>
00032 #include<vcg/complex/algorithms/create/platonic.h>
00033 #include<vcg/complex/algorithms/parametrization/poisson_solver.h>
00034 #include<vcg/complex/algorithms/update/texture.h>
00035 #include<wrap/io_trimesh/import_ply.h>
00036 #include<wrap/io_trimesh/export_ply.h>
00037
00038 using namespace vcg;
00039 using namespace std;
00040
00041 class MyEdge;
00042 class MyFace;
00043 class MyVertex;
00044 struct MyUsedTypes : public UsedTypes< Use<MyVertex> ::AsVertexType,
00045 Use<MyEdge> ::AsEdgeType,
00046 Use<MyFace> ::AsFaceType>{};
00047
00048 class MyVertex : public Vertex<MyUsedTypes, vertex::Coord3f, vertex::Normal3f, vertex::TexCoord2f, vertex::BitFlags >{};
00049 class MyFace : public Face< MyUsedTypes, face::VertexRef, face::BitFlags, face::FFAdj , face::WedgeTexCoord2f> {};
00050 class MyEdge : public Edge<MyUsedTypes>{};
00051 class MyMesh : public tri::TriMesh< vector<MyVertex>, vector<MyFace> , vector<MyEdge> > {};
00052
00053
00054 int main( int argc, char **argv )
00055 {
00056 MyMesh m;
00057 if(argc < 2 ) return -1;
00058
00059 printf("Reading %s\n",argv[1]);
00060 int ret= tri::io::ImporterPLY<MyMesh>::Open(m,argv[1]);
00061 if(ret!=0)
00062 {
00063 printf("Unable to open %s for '%s'\n",argv[1],tri::io::ImporterPLY<MyMesh>::ErrorMsg(ret));
00064 return -1;
00065 }
00066
00067 printf("Mesh has %i vn %i fn\n",m.VN(),m.FN());
00068 tri::PoissonSolver<MyMesh> PS(m);
00069
00070 if(!PS.IsFeaseable())
00071 {
00072 printf("mesh is not homeomorphic to a disk\n");
00073 return -1;
00074 } else
00075 printf("OK - mesh is homeomorphic to a disk\n");
00076
00077 PS.Init();
00078 PS.SetBorderAsFixed();
00079 PS.FixDefaultVertices();
00080 PS.SolvePoisson(true);
00081
00082 tri::UpdateTexture<MyMesh>::WedgeTexFromVertexTex(m);
00083 tri::io::ExporterPLY<MyMesh>::Save(m,"pippo.ply",tri::io::Mask::IOM_WEDGTEXCOORD);
00084
00085 return 0;
00086 }