Corrected use of Area with the unambiguous DoubleArea

This commit is contained in:
Paolo Cignoni 2006-01-22 10:06:23 +00:00
parent 92c21e838d
commit 381ce72a56
2 changed files with 14 additions and 8 deletions

View File

@ -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<MetroMesh>::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 <class MetroMesh>
@ -455,7 +458,7 @@ void Sampling<MetroMesh>::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<MetroMesh>::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<MetroMesh>::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)
{

View File

@ -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<ScalarType> 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<ScalarType>(b0,vcg::math::Min<ScalarType>(b1,b2))) < EPSILON*Area(f))
if( (b=vcg::math::Min<ScalarType>(b0,vcg::math::Min<ScalarType>(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<ScalarType>(b0,vcg::math::Min<ScalarType>(b1,b2))) < EPSILON*Area(f))
if( (b=vcg::math::Min<ScalarType>(b0,vcg::math::Min<ScalarType>(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<ScalarType>(b0,vcg::math::Min<ScalarType>(b1,b2))) < EPSILON*Area(f))
if( (b=vcg::math::Min<ScalarType>(b0,vcg::math::Min<ScalarType>(b1,b2))) < EPSILON*DoubleArea(f))
{
ScalarType bt;
if(b==b0) bt = PSDist(q,f.V(1)->cP(),f.V(2)->cP(),p);