Subversion Repositories gelsvn

Rev

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

Rev 183 Rev 191
Line 32... Line 32...
32
	{
32
	{
33
 
33
 
34
			template<class T>
34
			template<class T>
35
			Vec3f push_vertex(const RGrid<T>& grid, const Vec3f& pos0, float iso)
35
			Vec3f push_vertex(const RGrid<T>& grid, const Vec3f& pos0, float iso)
36
			{
36
			{
37
					typedef typename RGrid<T>::DataType DataType;
-
 
38
					Geometry::TrilinFilter<Geometry::RGrid<T> > inter(&grid);
37
					Geometry::TrilinFilter<Geometry::RGrid<T> > inter(&grid);
39
					Vec3f pos = pos0;
38
					Vec3f pos = pos0;
40
					for(int i=0;i<100;++i)
39
					for(int i=0;i<100;++i)
41
							if(inter.in_domain(pos))
40
							if(inter.in_domain(pos))
42
							{
41
							{
43
									float val = inter(pos)-iso;
42
									float val = inter(pos)-iso;
44
									DataType gx,gy,gz;
-
 
45
									inter.grad(pos, gx, gy, gz);
-
 
46
									Vec3f grad(gx,gy,gz);
43
									Vec3f grad = inter.grad(pos);
47
									float sqlen_grad = sqr_length(grad);
44
									float sqlen_grad = sqr_length(grad);
48
									Vec3f d1 = - val * grad/sqlen_grad;
45
									Vec3f d1 = - val * grad/sqlen_grad;
49
									Vec3f p_half = pos + d1;
46
									Vec3f p_half = pos + d1;
50
									
47
									
51
									Vec3f d2 = 
48
									Vec3f d2 = 
Line 512... Line 509...
512
		CubeGrid<T> cube_grid(voxel_grid, iso);
509
		CubeGrid<T> cube_grid(voxel_grid, iso);
513
		vector<Vec3f> face_positions;
510
		vector<Vec3f> face_positions;
514
		cube_grid.cuberille_mesh(voxel_grid, mani, push, false, face_positions);
511
		cube_grid.cuberille_mesh(voxel_grid, mani, push, false, face_positions);
515
	}
512
	}
516
 
513
 
517
	template void mc_polygonize<unsigned char>(const RGrid<unsigned char>&,
514
		template void mc_polygonize<unsigned char>(const RGrid<unsigned char>&,
518
																							 Manifold&, float);
515
																							 Manifold&, float);
519
	template void mc_polygonize<float>(const RGrid<float>&,
516
		template void mc_polygonize<float>(const RGrid<float>&, Manifold&, float);
520
																			 Manifold&, float);
-
 
521
 
517
 
-
 
518
		template void cuberille_polygonize<unsigned short>(const RGrid<unsigned short>&,
-
 
519
																											Manifold&, float, bool);
522
	template void cuberille_polygonize<unsigned char>(const RGrid<unsigned char>&,
520
		template void cuberille_polygonize<unsigned char>(const RGrid<unsigned char>&,
523
																										Manifold&, float, bool);
521
																											Manifold&, float, bool);
524
	template void cuberille_polygonize<float>(const RGrid<float>&,
522
		template void cuberille_polygonize<float>(const RGrid<float>&,
525
																						Manifold&, float, bool);
523
																							Manifold&, float, bool);
526
 
524
 
527
}
525
}
528
	
526
	
529
 
527
 
530
 
528