cleaned up a bit

This commit is contained in:
Paolo Cignoni 2009-10-27 21:43:01 +00:00
parent 4568a67fb6
commit 092211c82c
2 changed files with 77 additions and 52 deletions

View File

@ -1,52 +1,75 @@
#include <vector> /****************************************************************************
* VCGLib o o *
#include<vcg/simplex/vertex/base.h>// * Visual and Computer Graphics Library o o *
#include<vcg/simplex/vertex/component.h> * _ O _ *
#include<vcg/simplex/face/base.h>// * Copyright(C) 2004-2009 \/)\/ *
#include<vcg/simplex/face/component.h> * Visual Computing Lab /\/| *
#include<vcg/simplex/face/topology.h>// * ISTI - Italian National Research Council | *
#include<vcg/complex/trimesh/base.h>// * \ *
* All rights reserved. *
// input output * *
#include<wrap/io_trimesh/import.h> * This program is free software; you can redistribute it and/or modify *
#include<wrap/io_trimesh/export.h>//just in case * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
// topology computation * (at your option) any later version. *
#include<vcg/complex/trimesh/update/topology.h>// * *
#include<vcg/complex/trimesh/update/flag.h>// * This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
// half edge iterators * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
//#include<vcg/simplex/face/pos.h> * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
* for more details. *
// normals and curvature * *
#include<vcg/complex/trimesh/update/normal.h> //class UpdateNormals ****************************************************************************/
#include<vcg/complex/trimesh/update/curvature.h> //class curvature
#include<vcg/simplex/vertex/base.h>
using namespace vcg; #include<vcg/simplex/vertex/component.h>
using namespace std; #include<vcg/simplex/face/base.h>
#include<vcg/simplex/face/component.h>
class MyEdge; // dummy prototype #include<vcg/simplex/face/topology.h>
class MyFace; #include<vcg/complex/trimesh/base.h>
class MyVertex;
// input output
class MyVertex : public VertexSimp2< MyVertex, MyEdge, MyFace, vertex::Coord3f, vertex::Normal3f, vertex::BitFlags >{}; #include<wrap/io_trimesh/import.h>
class MyFace : public FaceSimp2 < MyVertex, MyEdge, MyFace, face::FFAdj, face::VertexRef, face::BitFlags > {}; #include<wrap/io_trimesh/export.h>
class MyMesh : public vcg::tri::TriMesh< vector<MyVertex>, vector<MyFace> > {};
// topology computation
int main( int argc, char **argv ) { #include<vcg/complex/trimesh/update/topology.h>
MyMesh m;
// this is the section with problems // normals
if(vcg::tri::io::ImporterPLY<MyMesh>::Open(m,argv[1])!=0) #include<vcg/complex/trimesh/update/normal.h> //class UpdateNormals
{
printf("Error reading file %s\n",argv[1]); using namespace vcg;
exit(0); using namespace std;
} // from here no problems
class MyEdge; // dummy prototype
vcg::tri::UpdateTopology<MyMesh>::FaceFace(m); class MyFace;
vcg::tri::UpdateFlags<MyMesh>::FaceBorderFromFF(m); class MyVertex;
vcg::tri::UpdateNormals<MyMesh>::PerVertexNormalized(m);
printf("Input mesh vn:%i fn:%i\n",m.vn,m.fn); class MyVertex : public VertexSimp2< MyVertex, MyEdge, MyFace, vertex::Coord3f, vertex::Normal3f, vertex::BitFlags >{};
printf( "Mesh has %i vert and %i faces\n", m.vn, m.fn ); class MyFace : public FaceSimp2 < MyVertex, MyEdge, MyFace, face::FFAdj, face::VertexRef, face::BitFlags > {};
class MyMesh : public vcg::tri::TriMesh< vector<MyVertex>, vector<MyFace> > {};
return 0;
} int main( int argc, char **argv )
{
if(argc<2)
{
printf("Usage trimesh_base <meshfilename.ply>\n");
return -1;
}
MyMesh m;
if(vcg::tri::io::ImporterPLY<MyMesh>::Open(m,argv[1])!=0)
{
printf("Error reading file %s\n",argv[1]);
exit(0);
}
vcg::tri::UpdateTopology<MyMesh>::FaceFace(m);
vcg::tri::UpdateFlags<MyMesh>::FaceBorderFromFF(m);
vcg::tri::UpdateNormals<MyMesh>::PerVertexNormalized(m);
printf("Input mesh vn:%i fn:%i\n",m.vn,m.fn);
printf( "Mesh has %i vert and %i faces\n", m.vn, m.fn );
return 0;
}

View File

@ -9,3 +9,5 @@ INCLUDEPATH += . ../../..
CONFIG += console stl CONFIG += console stl
TEMPLATE = app TEMPLATE = app
SOURCES += trimesh_base.cpp ../../../wrap/ply/plylib.cpp SOURCES += trimesh_base.cpp ../../../wrap/ply/plylib.cpp
# Mac specific Config required to avoid to make application bundles
CONFIG -= app_bundle