Subversion Repositories gelsvn

Rev

Rev 61 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61 Rev 64
Line 23... Line 23...
23
#include "Util/HashTable.h"
23
#include "Util/HashTable.h"
24
#include "Util/HashKey.h"
24
#include "Util/HashKey.h"
25
 
25
 
26
#include "fair_polygonize.h"
26
#include "fair_polygonize.h"
27
 
27
 
28
namespace Polygonization
28
namespace Geometry
29
{
29
{
30
	using namespace HMesh;
30
	using namespace HMesh;
31
	using namespace HMeshUtil;
31
	using namespace HMeshUtil;
32
	using namespace CMP;
32
	using namespace CMP;
33
	using namespace Geometry;
-
 
34
	using namespace CGLA;
33
	using namespace CGLA;
35
	using namespace std;
34
	using namespace std;
36
 
35
 
37
	namespace 
36
	namespace 
38
	{
37
	{
Line 337... Line 336...
337
							const int N = verts.size();
336
							const int N = verts.size();
338
							for(int i=0;i<N-2;++i)
337
							for(int i=0;i<N-2;++i)
339
								for(int j=i+2;j<N; ++j)
338
								for(int j=i+2;j<N; ++j)
340
									if(!is_connected(verts[i], verts[j]))
339
									if(!is_connected(verts[i], verts[j]))
341
										vpairs.push_back(pair<int,int>(i,j));
340
										vpairs.push_back(pair<int,int>(i,j));
-
 
341
							if(vpairs.empty() && N > 3)
342
								
342
							{
-
 
343
									cout << __FILE__ << __LINE__ << " " << N << endl;
-
 
344
									for(int i=0;i<N-2;++i)
-
 
345
											for(int j=i+2;j<N; ++j)
-
 
346
											{
-
 
347
													cout << "i=" << i << " j=" << j << " ";
-
 
348
													cout << &*verts[i] << " " << &*verts[j] << " ";
-
 
349
													cout << is_connected(verts[i], verts[j]) << endl;
-
 
350
											}
-
 
351
							}
-
 
352
 
343
							if(!vpairs.empty())
353
							if(!vpairs.empty())
344
								{
354
								{
345
									float min_val=FLT_MAX;
355
									float min_val=FLT_MAX;
346
									int min_k = -1;
356
									int min_k = -1;
347
									for(int k=0;k<vpairs.size(); ++k)
357
									for(int k=0;k<vpairs.size(); ++k)
Line 455... Line 465...
455
											 bool invert_contour)
465
											 bool invert_contour)
456
	{
466
	{
457
		Mesher<T> m(&voxel_grid, &mani, iso, invert_contour);
467
		Mesher<T> m(&voxel_grid, &mani, iso, invert_contour);
458
		m.process_cubes();
468
		m.process_cubes();
459
		m.create_faces();
469
		m.create_faces();
460
 		m.remove_duplicates();
-
 
461
		m.triangulate(iso);
470
		m.triangulate(iso);
-
 
471
 		m.remove_duplicates();
462
		//m.push_vertices(iso);
472
		//m.push_vertices(iso);
463
	}
473
	}
464
 
474
 
465
	template void fair_polygonize<unsigned char>(const RGrid<unsigned char>&,
475
	template void fair_polygonize<unsigned char>(const RGrid<unsigned char>&,
466
																							 Manifold&, float, bool);
476
																							 Manifold&, float, bool);