Added update normal per vertex.

This commit is contained in:
Paolo Cignoni 2006-11-29 15:17:39 +00:00
parent eb0ae58b64
commit 7b0c0f6728
1 changed files with 12 additions and 11 deletions

View File

@ -8,6 +8,7 @@
// topology computation // topology computation
#include<vcg/complex/trimesh/update/topology.h> #include<vcg/complex/trimesh/update/topology.h>
#include <vcg/complex/trimesh/update/flag.h> #include <vcg/complex/trimesh/update/flag.h>
#include <vcg/complex/trimesh/update/normal.h>
// half edge iterators // half edge iterators
#include<vcg/simplex/face/pos.h> #include<vcg/simplex/face/pos.h>
@ -16,13 +17,10 @@
#include <wrap/io_trimesh/import_ply.h> #include <wrap/io_trimesh/import_ply.h>
#include <wrap/io_trimesh/export_ply.h> #include <wrap/io_trimesh/export_ply.h>
#include<vcg/complex/trimesh/hole.h> #include<vcg/complex/trimesh/hole.h>
using namespace vcg; using namespace vcg;
class MyEdge; // dummy prototype never used class MyEdge; // dummy prototype never used
class MyFace; class MyFace;
class MyVertex; class MyVertex;
@ -39,7 +37,7 @@ int main(int argc,char ** argv){
printf( printf(
"\n HoleFilling ("__DATE__")\n" "\n HoleFilling ("__DATE__")\n"
"Visual Computing Group I.S.T.I. C.N.R.\n" "Visual Computing Group I.S.T.I. C.N.R.\n"
"Usage: holefilling #algorithm filein.ply fileout.ply \n" "Usage: trimesh_hole #algorithm filein.ply fileout.ply \n"
"#algorithm: \n" "#algorithm: \n"
" 1) Trivial Ear \n" " 1) Trivial Ear \n"
" 2) Leipa Ear \n" " 2) Leipa Ear \n"
@ -52,7 +50,7 @@ int main(int argc,char ** argv){
int algorithm = atoi(argv[1]); int algorithm = atoi(argv[1]);
if(algorithm < 0 && algorithm > 4) if(algorithm < 0 && algorithm > 4)
{ {
printf("Error on selecting algorithm %d\n",algorithm); printf("Error in algorithm's selection\n",algorithm);
exit(0); exit(0);
} }
@ -67,22 +65,25 @@ int main(int argc,char ** argv){
//update the face-face topology //update the face-face topology
vcg::tri::UpdateTopology<MyMesh>::FaceFace(m); vcg::tri::UpdateTopology<MyMesh>::FaceFace(m);
vcg::tri::UpdateNormals<MyMesh>::PerVertex(m);
tri::UpdateFlags<MyMesh>::FaceBorderFromFF(m); tri::UpdateFlags<MyMesh>::FaceBorderFromFF(m);
//selecting the right algorithm vcg::tri::Hole<MyMesh> holeFiller;
switch(algorithm) switch(algorithm)
{ {
case 1: case 1:
vcg::tri::holeFillingEar<MyMesh, vcg::tri::TrivialEar<MyMesh> >(m,50,false);
holeFiller.EarCuttingFill<vcg::tri::TrivialEar<MyMesh> >(m,50,false);
break; break;
case 2: case 2:
vcg::tri::holeFillingEar<MyMesh, vcg::tri::MinimumWeightEar< MyMesh> >(m,500,false); holeFiller.EarCuttingFill<vcg::tri::MinimumWeightEar< MyMesh> >(m,500,false);
break; break;
case 3: case 3:
vcg::tri::holeFillingIntersection<MyMesh, vcg::tri::SelfIntersectionEar< MyMesh> >(m,500,false); holeFiller.EarCuttingIntersectionFill<vcg::tri::SelfIntersectionEar< MyMesh> >(m,500,false);
break; break;
case 4: case 4:
vcg::tri::FillHoleMinimumWeight<MyMesh>(m, false); holeFiller.MinimumWeightFill(m, false);
break; break;
} }