[MOAB-dev] r4353 - MOAB/trunk/src

bmsmith6 at wisc.edu bmsmith6 at wisc.edu
Sat Dec 11 09:13:43 CST 2010


Author: bmsmith
Date: 2010-12-11 09:13:43 -0600 (Sat, 11 Dec 2010)
New Revision: 4353

Modified:
   MOAB/trunk/src/GeomUtil.cpp
Log:
Fix minor bugs and compiler warning.



Modified: MOAB/trunk/src/GeomUtil.cpp
===================================================================
--- MOAB/trunk/src/GeomUtil.cpp	2010-12-10 18:51:46 UTC (rev 4352)
+++ MOAB/trunk/src/GeomUtil.cpp	2010-12-11 15:13:43 UTC (rev 4353)
@@ -239,10 +239,13 @@
 			      pip2*inverse_sum*vertices[1]);
 
   // To minimize numerical error, get index of largest magnitude direction.
-  int idx;
+  int idx = 0;
   double max_abs_dir = 0;
   for(unsigned int i=0; i<3; ++i) {
-    if( fabs(direction[i]) > max_abs_dir ) idx = i;
+    if( fabs(direction[i]) > max_abs_dir ) {
+      idx = i;
+      max_abs_dir = fabs(direction[i]);
+    }
   } 
   const double dist = (intersection[idx]-origin[idx])/direction[idx];
 
@@ -251,7 +254,7 @@
     if(type) *type = NONE;
     return false;
   }
-  if(neg_ray_len && *neg_ray_len>dist) {
+  if(neg_ray_len && *neg_ray_len>=dist) {
     if(type) *type = NONE;
     return false;
 
























More information about the moab-dev mailing list