0024640: Broken logic of check of variable for zero in IntCurvesFace_Intersector...
authorabv <abv@opencascade.com>
Wed, 19 Feb 2014 04:54:49 +0000 (08:54 +0400)
committerapn <apn@opencascade.com>
Thu, 20 Feb 2014 12:25:53 +0000 (16:25 +0400)
The check is fixed to avoid FPE division by zero

src/IntCurvesFace/IntCurvesFace_Intersector.cxx

index 4a1c680..0f93db9 100644 (file)
@@ -95,7 +95,7 @@ IntCurvesFace_Intersector::IntCurvesFace_Intersector(const TopoDS_Face& Face,
     Standard_Boolean bFlag;
     //
     {
-      Standard_Real dU, dV, dA, dB, aR, aTresh; 
+      Standard_Real dU, dV, dA, dB, aTresh; 
       bFlag=Standard_True;
       //
       aTresh=100.;
@@ -108,15 +108,9 @@ IntCurvesFace_Intersector::IntCurvesFace_Intersector(const TopoDS_Face& Face,
        dB=dU;
       }
       //
-      aR=dA/dB;
-      if (dB<Precision::PConfusion()) {
+      if (dB < Precision::PConfusion() || dA > dB * aTresh) {
        bFlag=!bFlag;
       }
-      else {
-       if (aR>aTresh) {
-         bFlag=!bFlag;
-       }
-      }
     }
     //
     if (bFlag) {