Subversion Repositories gelsvn

Rev

Details | Last modification | View Log | RSS feed

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