Subversion Repositories gelsvn

Rev

Rev 26 | Rev 34 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
23 jab 1
 
2
#include <iostream>
3
 
4
#include "CGLA/Vec3f.h"
33 jab 5
#include "HMeshUtil/quadric_simplify.h"
23 jab 6
#include "HMeshUtil/x3d_save.h"
7
#include "HMeshUtil/x3d_load.h"
8
#include "HMeshUtil/caps_and_needles.h"
9
 
10
 
11
using namespace std;
12
using namespace CGLA;
13
using namespace HMeshUtil;
14
using namespace HMesh;
15
 
16
int main(int argc, char** argv)
17
{
18
 
19
	Manifold m;
20
	x3d_load(argv[1], m);
21
 
22
	Vec3f p0, p7;
23
	m.get_bbox(p0, p7);
24
	Vec3f d = p7-p0;
25
	float s = 1.0/d.max_coord();
26
	cout << p0 << p7 << d << s << endl;
27
 
28
 	for(VertexIter vi = m.vertices_begin(); vi != m.vertices_end(); ++vi)
29
 		{
30
 			vi->set_pos((vi->get_pos() - p0) * s);
31
 		}
32
 
33 jab 33
	cout << "Perform quadric based simplification ... " << endl;
34
	quadric_simplify(m,atoi(argv[2]));
23 jab 35
 
36
	cout << "Removing caps and needles ... " << endl;
37
	remove_caps_from_trimesh(m, M_PI * 0.85);
38
	remove_needles_from_trimesh(m, 1e-4);
39
 
40
	cout << "Validity: " << m.is_valid() << endl;
41
	cout << "Now saving ... " << endl;
42
	x3d_save("decimated.x3d", m);
43
}