Revision: 56644
          http://sourceforge.net/p/brlcad/code/56644
Author:   starseeker
Date:     2013-08-06 20:38:33 +0000 (Tue, 06 Aug 2013)
Log Message:
-----------
Clear the warnings about floating point comparisons from gdiam.hpp

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

Modified: brlcad/trunk/src/other/libgdiam/gdiam.hpp
===================================================================
--- brlcad/trunk/src/other/libgdiam/gdiam.hpp   2013-08-06 20:09:37 UTC (rev 
56643)
+++ brlcad/trunk/src/other/libgdiam/gdiam.hpp   2013-08-06 20:38:33 UTC (rev 
56644)
@@ -43,6 +43,10 @@
 typedef  gdiam_real  * gdiam_point;
 typedef  const gdiam_real  * gdiam_point_cnt;
 
+#define SMALL_DOUBLE 1.0e-37
+#define GDIAM_NEAR_ZERO(val) (((val) > - SMALL_DOUBLE) && ((val) < 
SMALL_DOUBLE))
+
+
 #ifndef __MINMAX_DEFINED
 #define __MINMAX_DEFINED
 
@@ -70,7 +74,7 @@
 inline void  pnt_normalize( gdiam_point  pnt )
 {
     gdiam_real  len = pnt_length( pnt );
-    if  ( len == 0.0 )
+    if  ( GDIAM_NEAR_ZERO(len) )
         return;
 
     pnt[ 0 ] /= len;
@@ -173,9 +177,9 @@
                           const gdiam_point  q ) 
 {
     // Assuming here the GDIAM_DIM == 3 !!!!
-    return  ( ( p[ 0 ] == q[ 0 ] )
-              &&  ( p[ 1 ] == q[ 1 ] )
-              &&  ( p[ 2 ] == q[ 2 ] ) );
+    return  ( GDIAM_NEAR_ZERO(p[0] - q[0])
+              &&  GDIAM_NEAR_ZERO(p[1] - q[1])
+              &&  GDIAM_NEAR_ZERO(p[2] - q[2]) ) ;
 }
 
 inline void  pnt_scale_and_add( gdiam_point  dest,

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