Subversion Repositories gelsvn

Rev

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

Rev 362 Rev 363
Line 282... Line 282...
282
					{
282
					{
283
						Vec3d n(normal(f));
283
						Vec3d n(normal(f));
284
						double a = area(f);
284
						double a = area(f);
285
						q += QEM(p, n, a / 3.0);
285
						q += QEM(p, n, a / 3.0);
286
					}
286
					}
287
					else if (sqr_length(vn) > 0.0)
287
					if ((f == NULL_FACE_ITER || 
-
 
288
						vc.get_opp_halfedge()->face ==  NULL_FACE_ITER) && sqr_length(vn) > 0.0)
288
					{
289
					{
289
						Vec3d edge = Vec3d(vc.get_halfedge()->vert->pos)-p;
290
						Vec3d edge = Vec3d(vc.get_halfedge()->vert->pos)-p;
290
						double edge_len = sqr_length(edge); 
291
						double edge_len = sqr_length(edge); 
291
						if(edge_len > 0.0)
292
						if(edge_len > 0.0)
292
							{
293
							{
Line 316... Line 317...
316
			while(!sim_queue.empty() && work < max_work)
317
			while(!sim_queue.empty() && work < max_work)
317
			{
318
			{
318
				SimplifyRec simplify_record = sim_queue.top();
319
				SimplifyRec simplify_record = sim_queue.top();
319
				sim_queue.pop();
320
				sim_queue.pop();
320
				
321
				
321
				work += collapse(simplify_record);
322
				work += 2*collapse(simplify_record);
322
				if((work % 100) == 0)
323
				if((work % 100) == 0)
323
				{
324
				{
324
					cout << "work = " << work << endl;
325
					cout << "work = " << work << endl;
325
					cout << "sim Q size = " << sim_queue.size() << endl;
326
					cout << "sim Q size = " << sim_queue.size() << endl;
326
				}
327
				}
327
			}
328
			}
328
		}
329
		}
329
	}
330
	}
330
	
331
	
331
	void quadric_simplify(Manifold& m, int max_work, double singular_thresh, bool relocate_origin)
332
	void quadric_simplify(Manifold& m, double keep_fraction, double singular_thresh, bool relocate_origin)
332
	{
333
	{
333
		srand(1210);
334
		srand(1210);
-
 
335
		int F = m.no_faces();
-
 
336
		int max_work = max(0, F- static_cast<int>(keep_fraction * F));
334
		QuadricSimplifier qsim(m, singular_thresh, relocate_origin);
337
		QuadricSimplifier qsim(m, singular_thresh, relocate_origin);
335
		qsim.reduce(max_work);
338
		qsim.reduce(max_work);
336
	}
339
	}
337
	
340
	
338
}
341
}