Subversion Repositories gelsvn

Rev

Rev 145 | Rev 169 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 145 Rev 157
1
#include "CGLA/Mat4x4f.h"
1
#include "CGLA/Mat4x4f.h"
2
#include "Util/ArgExtracter.h"
2
#include "Util/ArgExtracter.h"
3
#include "Geometry/RGrid.h"
3
#include "Geometry/RGrid.h"
4
#include "Geometry/load_raw.h"
4
#include "Geometry/load_raw.h"
5
#include "Geometry/save_raw.h"
5
#include "Geometry/save_raw.h"
6
#include "HMeshUtil/obj_save.h"
6
#include "HMesh/obj_save.h"
7
#include "HMeshUtil/x3d_save.h"
7
#include "HMesh/x3d_save.h"
8
#include "HMeshUtil/caps_and_needles.h"
8
#include "HMesh/caps_and_needles.h"
9
#include "HMeshUtil/fair_polygonize.h"
9
#include "HMesh/fair_polygonize.h"
10
 
10
 
11
using namespace CGLA;
11
using namespace CGLA;
12
using namespace HMeshUtil;
-
 
13
using namespace Util;
12
using namespace Util;
14
using namespace HMesh;
13
using namespace HMesh;
15
using namespace std;
14
using namespace std;
16
using namespace Geometry;
15
using namespace Geometry;
17
 
16
 
18
typedef RGrid<unsigned char> RGridb;
17
typedef RGrid<unsigned char> RGridb;
19
 
18
 
20
int main(int argc, char**argv)
19
int main(int argc, char**argv)
21
{
20
{
22
		ArgExtracter ae(argc, argv);
21
		ArgExtracter ae(argc, argv);
23
		float iso = 40;
22
		float iso = 40;
24
		ae.extract("-i", iso);
23
		ae.extract("-i", iso);
25
		int X  = 128;
24
		int X  = 128;
26
		ae.extract("-x", X);
25
		ae.extract("-x", X);
27
		int Y  = 128;
26
		int Y  = 128;
28
		ae.extract("-y", Y);
27
		ae.extract("-y", Y);
29
		int Z  = 62;
28
		int Z  = 62;
30
		ae.extract("-z", Z);
29
		ae.extract("-z", Z);
31
		string file;
30
		string file;
32
		if(ae.no_remaining_args()<2) 
31
		if(ae.no_remaining_args()<2) 
33
				file ="../../data/teddybear.raw";
32
				file ="../../data/teddybear.raw";
34
		else
33
		else
35
				file = ae.get_last_arg();
34
				file = ae.get_last_arg();
36
		
35
		
37
		RGridb grid(Vec3i(X,Y,Z));
36
		RGridb grid(Vec3i(X,Y,Z));
38
		cout << "loading " << file << endl;
37
		cout << "loading " << file << endl;
39
		load_raw(file,grid);
38
		load_raw(file,grid);
40
		
39
		
41
		
40
		
42
		cout << "Polygonizing, iso = " << iso << endl;
41
		cout << "Polygonizing, iso = " << iso << endl;
43
		Manifold mani;
42
		Manifold mani;
44
		fair_polygonize(grid, mani, iso);
43
		fair_polygonize(grid, mani, iso);
45
 
44
 
46
		cout << "Removing caps and needles ... " << endl;
45
		cout << "Removing caps and needles ... " << endl;
47
		remove_caps_from_trimesh(mani, M_PI * 0.85);
46
		remove_caps_from_trimesh(mani, M_PI * 0.85);
48
		remove_needles_from_trimesh(mani, 1e-2);
47
		remove_needles_from_trimesh(mani, 1e-2);
49
		
48
		
50
		cout << "Saving" << endl;
49
		cout << "Saving" << endl;
51
		obj_save("../../data/isosurf.obj", mani);
50
		obj_save("../../data/isosurf.obj", mani);
52
}
51
}
53
 
52