From 1baabf65de493437bd376f0554916894fcc7d86f Mon Sep 17 00:00:00 2001 From: cnr-isti-vclab Date: Wed, 22 Nov 2006 13:42:06 +0000 Subject: [PATCH] First working release --- apps/sample/trimesh_hole/trimesh_hole.cpp | 97 +++++++++++++++++++++++ apps/sample/trimesh_hole/trimesh_hole.pro | 12 +++ 2 files changed, 109 insertions(+) create mode 100644 apps/sample/trimesh_hole/trimesh_hole.cpp create mode 100644 apps/sample/trimesh_hole/trimesh_hole.pro diff --git a/apps/sample/trimesh_hole/trimesh_hole.cpp b/apps/sample/trimesh_hole/trimesh_hole.cpp new file mode 100644 index 00000000..c6a9a4d5 --- /dev/null +++ b/apps/sample/trimesh_hole/trimesh_hole.cpp @@ -0,0 +1,97 @@ +#include + +#include +#include +#include +#include + +// topology computation +#include +#include + +// half edge iterators +#include + +// input output +#include +#include + + +#include + + +using namespace vcg; + + +class MyEdge; // dummy prototype never used +class MyFace; +class MyVertex; + +class MyVertex : public VertexSimp2< MyVertex, MyEdge, MyFace, vert::Coord3f, vert::BitFlags, vert::Normal3f >{}; +class MyFace : public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VertexRef,face::FFAdj, face::Mark, face::BitFlags, face::Normal3f > {}; + + +//class MyVertex:public Vertex{}; +//class MyFace : public FaceAFFM{}; + +class MyMesh : public tri::TriMesh< std::vector, std::vector >{}; + +int main(int argc,char ** argv){ + + if(argc<4) + { + printf( + "\n HoleFilling ("__DATE__")\n" + "Visual Computing Group I.S.T.I. C.N.R.\n" + "Usage: holefilling #algorithm filein.ply fileout.ply \n" + "#algorithm: \n" + " 1) Trivial Ear \n" + " 2) Leipa Ear \n" + " 3) Selfintersection Ear \n" + " 4) Real Leipa \n" + ); + exit(0); + } + int algorithm = atoi(argv[1]); + if(algorithm < 0 && algorithm > 4) + { + printf("Error on selecting algorithm %d\n",algorithm); + exit(0); + } + + MyMesh m; + + if(vcg::tri::io::ImporterPLY::Open(m,argv[2])!=0) + { + printf("Error reading file %s\n",argv[2]); + exit(0); + } + + + //update the face-face topology + vcg::tri::UpdateTopology::FaceFace(m); + tri::UpdateFlags::FaceBorderFromFF(m); + + //selecting the right algorithm + switch(algorithm) + { + case 1: + vcg::tri::holeFillingEar >(m,50,false); + break; + case 2: + vcg::tri::holeFillingEar >(m,500,false); + break; + case 3: + vcg::tri::holeFillingIntersection >(m,500,false); + break; + case 4: + vcg::tri::FillHoleMinimumWeight(m, false); + break; + } + + //vcg::tri::UpdateTopology::FaceFace(m); + + vcg::tri::io::ExporterPLY::Save(m,argv[3],false); + return 0; +} + diff --git a/apps/sample/trimesh_hole/trimesh_hole.pro b/apps/sample/trimesh_hole/trimesh_hole.pro new file mode 100644 index 00000000..abb01d8f --- /dev/null +++ b/apps/sample/trimesh_hole/trimesh_hole.pro @@ -0,0 +1,12 @@ +###################################################################### +# Automatically generated by qmake (2.00a) ven 24. giu 14:14:20 2005 +###################################################################### + +TARGET = trimesh_hole +LIBPATH += +DEPENDPATH += . +INCLUDEPATH += . ..\..\..\ +CONFIG += console stl +TEMPLATE = app +SOURCES += trimesh_hole.cpp ..\..\..\wrap\ply\plylib.cpp +HEADERS += ..\..\..\vcg\wrap\ply\plylib.h \ No newline at end of file