diff --git a/apps/metro/sampling.h b/apps/metro/sampling.h index 15e79f63..d4a55617 100644 --- a/apps/metro/sampling.h +++ b/apps/metro/sampling.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.20 2005/11/12 06:44:29 cignoni +Changed GetClosest -> GetClosestFace + Revision 1.19 2005/10/02 23:11:50 cignoni Changed the core for distance computation. Current version uses the lib flexible search structures. @@ -274,9 +277,9 @@ inline double Sampling::ComputeMeshArea(MetroMesh & mesh) for(face=mesh.face.begin(); face != mesh.face.end(); face++) if(!(*face).IsD()) - area += face->Area(); + area += face->DoubleArea(); - return area; + return area/2.0; } template @@ -455,7 +458,7 @@ void Sampling::MontecarloFaceSampling() if(!(*fi).IsD()) { // compute # samples in the current face. - n_samples_decimal += fi->Area() * n_samples_per_area_unit; + n_samples_decimal += 0.5*fi->DoubleArea() * n_samples_per_area_unit; n_samples = (int) n_samples_decimal; // for every sample p_i in T... @@ -529,7 +532,7 @@ void Sampling::SubdivFaceSampling() for(fi=S1.face.begin(); fi != S1.face.end(); fi++) { // compute # samples in the current face. - n_samples_decimal += fi->Area() * n_samples_per_area_unit; + n_samples_decimal += 0.5*fi->DoubleArea() * n_samples_per_area_unit; n_samples = (int) n_samples_decimal; if(n_samples) { @@ -578,7 +581,7 @@ void Sampling::SimilarFaceSampling() for(fi=S1.face.begin(); fi != S1.face.end(); fi++) { // compute # samples in the current face. - n_samples_decimal += fi->Area() * n_samples_per_area_unit; + n_samples_decimal += 0.5*fi->DoubleArea() * n_samples_per_area_unit; n_samples = (int) n_samples_decimal; if(n_samples) { diff --git a/vcg/simplex/face/distance.h b/vcg/simplex/face/distance.h index db845640..44869c26 100644 --- a/vcg/simplex/face/distance.h +++ b/vcg/simplex/face/distance.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.9 2005/09/28 19:35:06 m_di_benedetto +Added class PointDistanceFunctor. + Revision 1.8 2005/09/14 12:58:44 pietroni changed min calls to Min of math.h of vcglib @@ -140,7 +143,7 @@ namespace vcg { // vicini (come prodotto vettore) // Nota: si potrebbe rendere un pochino piu' veloce sostituendo Area() // con il prodotto vettore dei due edge in 2d lungo il piano migliore. - if( (b=vcg::math::Min(b0,vcg::math::Min(b1,b2))) < EPSILON*Area(f)) + if( (b=vcg::math::Min(b0,vcg::math::Min(b1,b2))) < EPSILON*DoubleArea(f)) { ScalarType bt; if(b==b0) bt = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); @@ -174,7 +177,7 @@ namespace vcg { if(dist>b2) { dist = b2; return true; } else return false; } - if( (b=vcg::math::Min(b0,vcg::math::Min(b1,b2))) < EPSILON*Area(f)) + if( (b=vcg::math::Min(b0,vcg::math::Min(b1,b2))) < EPSILON*DoubleArea(f)) { ScalarType bt; if(b==b0) bt = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p); @@ -208,7 +211,7 @@ namespace vcg { if(dist>b2) { dist = b2; return true; } else return false; } - if( (b=vcg::math::Min(b0,vcg::math::Min(b1,b2))) < EPSILON*Area(f)) + if( (b=vcg::math::Min(b0,vcg::math::Min(b1,b2))) < EPSILON*DoubleArea(f)) { ScalarType bt; if(b==b0) bt = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p);