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
00032 #include<vcg/simplex/face/topology.h>
00033 #include<vcg/complex/trimesh/base.h>
00034
00035
00036 #include<wrap/io_trimesh/import.h>
00037 #include<wrap/io_trimesh/export.h>
00038
00039
00040 #include<vcg/complex/trimesh/update/topology.h>
00041
00042
00043 #include<vcg/complex/trimesh/update/normal.h>
00044
00045 using namespace vcg;
00046 using namespace std;
00047
00048 class MyEdge;
00049 class MyFace;
00050 class MyVertex;
00051 struct MyUsedTypes : public UsedTypes< Use<MyVertex> ::AsVertexType,
00052 Use<MyEdge> ::AsEdgeType,
00053 Use<MyFace> ::AsFaceType>{};
00054
00055 class MyVertex : public Vertex<MyUsedTypes, vertex::Coord3f, vertex::Normal3f, vertex::BitFlags >{};
00056 class MyFace : public Face< MyUsedTypes, face::FFAdj, face::VertexRef, face::BitFlags > {};
00057 class MyEdge : public Edge<MyUsedTypes>{};
00058 class MyMesh : public tri::TriMesh< vector<MyVertex>, vector<MyFace> , vector<MyEdge> > {};
00059
00060 int main( int argc, char **argv )
00061 {
00062 if(argc<2)
00063 {
00064 printf("Usage trimesh_base <meshfilename.ply>\n");
00065 return -1;
00066 }
00067
00068 MyMesh m;
00069
00070 if(tri::io::ImporterPLY<MyMesh>::Open(m,argv[1])!=0)
00071 {
00072 printf("Error reading file %s\n",argv[1]);
00073 exit(0);
00074 }
00075
00076 tri::UpdateTopology<MyMesh>::FaceFace(m);
00077 tri::UpdateFlags<MyMesh>::FaceBorderFromFF(m);
00078 tri::UpdateNormals<MyMesh>::PerVertexNormalized(m);
00079 printf("Input mesh vn:%i fn:%i\n",m.vn,m.fn);
00080 printf( "Mesh has %i vert and %i faces\n", m.vn, m.fn );
00081
00082 return 0;
00083 }