From 5e9d001b2fcf140639969cab2da04f082f5a454a Mon Sep 17 00:00:00 2001 From: ganovelli Date: Tue, 13 Jul 2004 15:55:45 +0000 Subject: [PATCH] first draft created --- apps/tetra_decimator/main.cpp | 82 +++++++++ .../tetra_decimator/tetra_decimator.vcproj | 167 ++++++++++++++++++ 2 files changed, 249 insertions(+) create mode 100644 apps/tetra_decimator/main.cpp create mode 100644 apps/tetra_decimator/tetra_decimator/tetra_decimator.vcproj diff --git a/apps/tetra_decimator/main.cpp b/apps/tetra_decimator/main.cpp new file mode 100644 index 00000000..40fa78c8 --- /dev/null +++ b/apps/tetra_decimator/main.cpp @@ -0,0 +1,82 @@ + + +#include + +// stuff to define the mesh +#include +#include +#include + +// the trackball +#include + +// io +#include +#include +#include + + +class MyEdge; +class MyTetrahedron; +class MyFace; +class MyVertex:public vcg::VertexATVMVNf{} ; +class MyTetrahedron : public vcg::TetraATAVTQ{}; + +class MyTMesh: public vcg::tetra::Tetramesh< std::vector, std::vector >{}; + + +#include +#include + + +vcg::LocalOptimization loc; +vcg::tetra::TetraEdgeCollapse c; +MyTMesh mesh; + +int main(int,char**argv){ + + loc.m = & mesh; + + vcg::tetra::io::ImporterTS::Open(mesh,argv[1]); + printf("mesh loaded %d %d \n",mesh.vn,mesh.tn); +// vcg::tetra::io::ExporterPLY::Save(mesh,(string(argv[1])+string(".ply")).c_str()); + + + + vcg::tetra::TetraEdgeCollapse *_ ; + bool res; + do{ + vcg::tetra::UpdateTetraTopology + ::VTTopology(mesh.vert,mesh.tetra); + + vcg::tetra::UpdateTetraTopology + ::TTTopology(mesh.vert,mesh.tetra); + + vcg::tetra::UpdateTetraTopology + ::setExternalVertices(mesh.vert,mesh.tetra); + + _=new vcg::tetra::TetraEdgeCollapse(); + loc.h.push_back(vcg::LocalOptimization::HeapElem(_)); + + loc.Init(); + loc.SetTargetSimplices(10); + + res = loc.DoOptimization(); + + printf("ood %d\n bor %d\n vol %d \n lkv %d \n lke %d \n lkf %d \n", + FAIL::OFD(), + FAIL::BOR(), + FAIL::VOL(), + FAIL::LKV(), + FAIL::LKE(), + FAIL::LKF() + ); + printf("mesh %d %d \n",mesh.vn,mesh.tn); + }while(!res); + + + vcg::tetra::io::ExporterPLY::Save(mesh,"out.ply"); + + return 0; + +} diff --git a/apps/tetra_decimator/tetra_decimator/tetra_decimator.vcproj b/apps/tetra_decimator/tetra_decimator/tetra_decimator.vcproj new file mode 100644 index 00000000..b82d8c46 --- /dev/null +++ b/apps/tetra_decimator/tetra_decimator/tetra_decimator.vcproj @@ -0,0 +1,167 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +