Revision: 56682
          http://sourceforge.net/p/brlcad/code/56682
Author:   starseeker
Date:     2013-08-07 21:20:26 +0000 (Wed, 07 Aug 2013)
Log Message:
-----------
Don't use the same zero test everywhere

Modified Paths:
--------------
    brlcad/trunk/src/other/libgdiam/gdiam.cpp
    brlcad/trunk/src/other/libgdiam/gdiam.hpp

Modified: brlcad/trunk/src/other/libgdiam/gdiam.cpp
===================================================================
--- brlcad/trunk/src/other/libgdiam/gdiam.cpp   2013-08-07 21:09:12 UTC (rev 
56681)
+++ brlcad/trunk/src/other/libgdiam/gdiam.cpp   2013-08-07 21:20:26 UTC (rev 
56682)
@@ -1327,7 +1327,7 @@
         printf( "(%g, %g)\n", x, y );
     }
     bool  equal( const point2d  & pnt ) const {
-        return  ( ( GDIAM_NEAR_ZERO(x - pnt.x) )  &&  ( GDIAM_NEAR_ZERO(y - 
pnt.y) ) );
+        return  ( ( GDIAM_NEAR_ZERO_EPSILON(x - pnt.x, 1e-37) )  &&  ( 
GDIAM_NEAR_ZERO_EPSILON(y - pnt.y, 1e-37) ) );
     }
     bool  equal_real( const point2d  & pnt ) const {
         return  ( ( fabs( x - pnt.x ) < 1e-8 )
@@ -1442,7 +1442,7 @@
         * in the same answer (i.e. no way to decide (!(a < b) && (b < a))
         * for the sort) when those conditions are true. */
        if ((sgn == 0) && (GDIAM_NEAR_ZERO(len1 - len2)))
-          return  ( ( a->x < b->x ) || (GDIAM_NEAR_ZERO(a->x - b->x) && a->y < 
b->y) );
+          return  ( ( a->x < b->x ) || (GDIAM_NEAR_ZERO_EPSILON(a->x - b->x, 
1e-37) && a->y < b->y) );
 
         return (len1 > len2);
     }
@@ -1450,8 +1450,11 @@
            /*printf("comparing: %f,%f and %f,%f\n", a->x, a->y, b->x, b->y);*/
            if (!this->local_compare(a,b))
                    return (false);
-           else if (this->local_compare(b,a))
+           else if (this->local_compare(b,a)) {
                    printf("Problem - strick weak ordering failure!\n");
+                   this->local_compare(a,b);
+                   this->local_compare(b,a);
+           }
            return (true);
     }
 };

Modified: brlcad/trunk/src/other/libgdiam/gdiam.hpp
===================================================================
--- brlcad/trunk/src/other/libgdiam/gdiam.hpp   2013-08-07 21:09:12 UTC (rev 
56681)
+++ brlcad/trunk/src/other/libgdiam/gdiam.hpp   2013-08-07 21:20:26 UTC (rev 
56682)
@@ -45,6 +45,7 @@
 
 #define SMALL_DOUBLE 1.0e-6
 #define GDIAM_NEAR_ZERO(val) (((val) > - SMALL_DOUBLE) && ((val) < 
SMALL_DOUBLE))
+#define GDIAM_NEAR_ZERO_EPSILON(val, epsilon) (((val) > - epsilon) && ((val) < 
epsilon))
 
 
 #ifndef __MINMAX_DEFINED

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to