[MOAB-dev] r6025 - MOAB/trunk/tools/mbcslam
iulian at mcs.anl.gov
iulian at mcs.anl.gov
Wed Mar 6 14:57:17 CST 2013
Author: iulian
Date: 2013-03-06 14:57:17 -0600 (Wed, 06 Mar 2013)
New Revision: 6025
Modified:
MOAB/trunk/tools/mbcslam/CslamUtils.cpp
Log:
due to rounding errors, this quantity under a sqrt, in l'Huiller formula, could turn negative
Modified: MOAB/trunk/tools/mbcslam/CslamUtils.cpp
===================================================================
--- MOAB/trunk/tools/mbcslam/CslamUtils.cpp 2013-03-06 18:58:38 UTC (rev 6024)
+++ MOAB/trunk/tools/mbcslam/CslamUtils.cpp 2013-03-06 20:57:17 UTC (rev 6025)
@@ -708,7 +708,10 @@
if ((vA*vB)%vC < 0)
sign = -1;
double s = (a+b+c)/2;
- double E = 4*atan(sqrt(tan(s/2)*tan((s-a)/2)*tan((s-b)/2)*tan((s-c)/2)));
+ double tmp = tan(s/2)*tan((s-a)/2)*tan((s-b)/2)*tan((s-c)/2);
+ if (tmp<0.)
+ tmp = 0.;
+ double E = 4*atan(sqrt(tmp));
return sign * E * Radius*Radius;
}
More information about the moab-dev
mailing list