[cgma-dev] r3716 - cgm/trunk/itaps

jvporter at wisc.edu jvporter at wisc.edu
Fri Mar 26 22:41:05 CDT 2010


Author: jvporter
Date: 2010-03-26 22:41:04 -0500 (Fri, 26 Mar 2010)
New Revision: 3716

Modified:
   cgm/trunk/itaps/iGeom_CGMA.cc
Log:
Avoid floating point exceptions in iGeom_getPntRayIntsct when direction 
has at least one zero coordinate (it will probably still crash with 
Cubit, though)


Modified: cgm/trunk/itaps/iGeom_CGMA.cc
===================================================================
--- cgm/trunk/itaps/iGeom_CGMA.cc	2010-03-26 21:18:41 UTC (rev 3715)
+++ cgm/trunk/itaps/iGeom_CGMA.cc	2010-03-27 03:41:04 UTC (rev 3716)
@@ -6444,7 +6444,8 @@
   return CUBIT_SUCCESS;
 }
 
-/** Smits' algorithm */
+/** We could use Smits' algorithm here, but only if we turned of
+    floating-point exceptions */
 static inline void box_min_max( double dir,
                                 double min,
                                 double max,
@@ -6452,7 +6453,11 @@
                                 double& tmin,
                                 double& tmax )
 {
-  if (dir >= 0.0) {
+  if (dir == 0) {
+    tmin = -INFINITY;
+    tmax = INFINITY;
+  }
+  else if (dir > 0.0) {
     tmin = (min - pt) / dir;
     tmax = (max - pt) / dir;
   }



More information about the cgma-dev mailing list