Subversion Repositories gelsvn

Rev

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

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