File: main.cpp

package info (click to toggle)
meshlab 1.3.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 20,900 kB
  • ctags: 33,325
  • sloc: cpp: 224,813; ansic: 8,170; xml: 119; makefile: 78
file content (76 lines) | stat: -rw-r--r-- 2,029 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76


#include <vector>

// stuff to define the mesh
#include <vcg/simplex/vertex/with/atvmvn.h>
#include <vcg/complex/tetramesh/base.h>
#include <vcg/simplex/tetrahedron/with/atavtq.h>

// io
#include <wrap/io_tetramesh/import_ply.h>
#include <wrap/io_tetramesh/export_ply.h>
#include <wrap/io_tetramesh/import_ts.h>


class MyEdge;
class MyTetrahedron;
class MyFace;
class MyVertex:public vcg::VertexATVMVNf<DUMMYEDGETYPE , MyFace, MyTetrahedron>{} ;
class MyTetrahedron : public vcg::TetraATAVTQ<MyVertex,MyTetrahedron>{};

class MyTMesh: public vcg::tetra::Tetramesh< std::vector<MyVertex>, std::vector<MyTetrahedron > >{};


#include <vcg/complex/algorithms/local_optimization.h>
#include <vcg/complex/algorithms/local_optimization/tetra_edge_collapse.h>


vcg::LocalOptimization<MyTMesh> *loc;
//vcg::tetra::TetraEdgeCollapse<MyTMesh> c;
MyTMesh mesh;

int main(int,char**argv,int num_op){
	loc=new vcg::LocalOptimization<MyTMesh>(mesh);

	vcg::tetra::io::ImporterTS<MyTMesh>::Open(mesh,argv[1]);
	//vcg::tetra::io::ImporterTS<MyTMesh>::Open(mesh,"d:/sphere.ts");
	printf("mesh loaded %d %d \n",mesh.vn,mesh.tn);

	/*vcg::tetra::TetraEdgeCollapse<MyTMesh> *_ ;
	bool res;*/

	vcg::tetra::UpdateTetraTopology<MyTMesh::VertexContainer,MyTMesh::TetraContainer>
		::VTTopology(mesh.vert,mesh.tetra);

	vcg::tetra::UpdateTetraTopology<MyTMesh::VertexContainer,MyTMesh::TetraContainer>
		::TTTopology(mesh.vert,mesh.tetra);

	vcg::tetra::UpdateTetraTopology<MyTMesh::VertexContainer,MyTMesh::TetraContainer>
		::setExternalVertices(mesh.vert,mesh.tetra);

	vcg::tetra::TetraEdgeCollapse<MyTMesh>::Init(mesh,loc->h);
	
	bool res;
	do{
		loc->SetTargetOperations(num_op);
		
		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<MyTMesh>::Save(mesh,"out.ply");
	
	return 0;

}