Subversion Repositories gelsvn

Rev

Rev 365 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 365 Rev 367
Line 1... Line 1...
1
#include <iostream>
1
#include <iostream>
2
 
2
 
-
 
3
#include "Util/ArgExtracter.h"
3
#include "CGLA/Vec3f.h"
4
#include "CGLA/Vec3f.h"
4
#include "HMesh/quadric_simplify.h"
5
#include "HMesh/quadric_simplify.h"
5
#include "HMesh/x3d_save.h"
6
#include "HMesh/x3d_save.h"
6
#include "HMesh/x3d_load.h"
7
#include "HMesh/x3d_load.h"
7
#include "HMesh/obj_load.h"
8
#include "HMesh/obj_load.h"
Line 11... Line 12...
11
#include "HMesh/triangulate.h"
12
#include "HMesh/triangulate.h"
12
 
13
 
13
using namespace std;
14
using namespace std;
14
using namespace CGLA;
15
using namespace CGLA;
15
using namespace HMesh;
16
using namespace HMesh;
-
 
17
using namespace Util;
16
 
18
 
17
int main(int argc, char** argv)
19
int main(int argc, char** argv)
18
{
20
{
-
 
21
	ArgExtracter ae(argc, argv);
-
 
22
 
-
 
23
	float singular_thresh = 0.0001;
-
 
24
	ae.extract("-s", singular_thresh);
-
 
25
	float keep_fraction = 0.01;
-
 
26
	ae.extract("-f", keep_fraction);
-
 
27
	int choose_optimal_positions = true;
-
 
28
	ae.extract("-o", choose_optimal_positions);
-
 
29
	
19
    Manifold m;
30
    Manifold m;
20
	
31
	
21
    string file;
32
    string file;
22
    if(argc>1)
33
    if(ae.no_remaining_args()>0)
23
        file = argv[1];
34
        file = ae.get_last_arg();
24
    else
35
    else
25
        file = "../../data/bunny-little.x3d";
36
        file = "../../data/bunny-little.x3d";
26
	
37
	
27
	if(file.substr(file.length()-4,file.length())==".obj")
38
	if(file.substr(file.length()-4,file.length())==".obj")
28
	{
39
	{
Line 53... Line 64...
53
		avg_length += length(h);
64
		avg_length += length(h);
54
	}
65
	}
55
	avg_length /= m.no_halfedges();
66
	avg_length /= m.no_halfedges();
56
	
67
	
57
	cout << "Perform quadric based simplification ... " << endl;
68
	cout << "Perform quadric based simplification ... " << endl;
58
	quadric_simplify(m,0.1);
-
 
59
	quadric_simplify(m,atof(argv[2]));
69
	quadric_simplify(m,keep_fraction,singular_thresh,choose_optimal_positions);
60
	
70
	
61
	cout << "Removing caps and needles ... " << endl;
71
	cout << "Removing caps and needles ... " << endl;
62
	remove_caps_from_trimesh(m, static_cast<float>(M_PI) * 0.85f);
72
	remove_caps_from_trimesh(m, static_cast<float>(M_PI) * 0.85f);
63
	remove_needles_from_trimesh(m, 0.1 * avg_length);
73
	remove_needles_from_trimesh(m, 0.1 * avg_length);
64
    
74