Subversion Repositories gelsvn

Rev

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

Rev 373 Rev 382
Line 2... Line 2...
2
 
2
 
3
#include "Util/ArgExtracter.h"
3
#include "Util/ArgExtracter.h"
4
#include "CGLA/Vec3f.h"
4
#include "CGLA/Vec3f.h"
5
#include "HMesh/quadric_simplify.h"
5
#include "HMesh/quadric_simplify.h"
6
#include "HMesh/x3d_save.h"
6
#include "HMesh/x3d_save.h"
7
#include "HMesh/x3d_load.h"
-
 
8
#include "HMesh/obj_load.h"
7
#include "HMesh/load.h"
9
#include "HMesh/obj_save.h"
8
#include "HMesh/obj_save.h"
10
#include "HMesh/caps_and_needles.h"
9
#include "HMesh/caps_and_needles.h"
11
#include "HMesh/close_holes.h"
10
#include "HMesh/close_holes.h"
12
#include "HMesh/triangulate.h"
11
#include "HMesh/triangulate.h"
13
 
12
 
Line 33... Line 32...
33
    if(ae.no_remaining_args()>0)
32
    if(ae.no_remaining_args()>0)
34
        file = ae.get_last_arg();
33
        file = ae.get_last_arg();
35
    else
34
    else
36
        file = "../../data/bunny-little.x3d";
35
        file = "../../data/bunny-little.x3d";
37
	
36
	
-
 
37
	load(file, m);
-
 
38
			
38
	if(file.substr(file.length()-4,file.length())==".obj")
39
	if(ae.extract("-c"))
39
	{
40
	{
-
 
41
		cout << "Closing holes" << endl;
40
		obj_load(file, m);
42
		close_holes(m);
41
	}
43
	}
42
	else
-
 
43
		x3d_load(file, m);
-
 
44
				
-
 
45
	shortest_edge_triangulate(m);
44
	shortest_edge_triangulate(m);
46
	
45
	
-
 
46
 
-
 
47
	
47
	Vec3f p0, p7;
48
	Vec3f p0, p7;
48
	m.get_bbox(p0, p7);
49
	m.get_bbox(p0, p7);
49
	Vec3f d = p7-p0;
50
	Vec3f d = p7-p0;
50
	float s = 1.0/d.max_coord();
51
	float s = 1.0/d.max_coord();
51
	cout << p0 << p7 << d << s << endl;
52
	cout << p0 << p7 << d << s << endl;
Line 70... Line 71...
70
	
71
	
71
	cout << "Removing caps and needles ... " << endl;
72
	cout << "Removing caps and needles ... " << endl;
72
	remove_caps_from_trimesh(m, static_cast<float>(M_PI) * 0.85f);
73
	remove_caps_from_trimesh(m, static_cast<float>(M_PI) * 0.85f);
73
	remove_needles_from_trimesh(m, 0.1 * avg_length);
74
	remove_needles_from_trimesh(m, 0.1 * avg_length);
74
    
75
    
75
	cout << "Closing holes" << endl;
-
 
76
	close_holes(m);
-
 
77
	triangulate(m);
-
 
78
    cout << "Validity: " << m.is_valid() << endl;
76
    cout << "Validity: " << m.is_valid() << endl;
79
    cout << "Now saving ... " << endl;
77
    cout << "Now saving ... " << endl;
80
    obj_save("decimated.obj", m);
78
    obj_save("decimated.obj", m);
81
}
79
}