]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Debug FPE exception
authorptv <ptv@opencascade.com>
Fri, 24 Apr 2009 09:17:41 +0000 (09:17 +0000)
committerptv <ptv@opencascade.com>
Fri, 24 Apr 2009 09:17:41 +0000 (09:17 +0000)
src/VTKViewer/VTKViewer_Trihedron.cxx

index 067dfecf689f73778e549b101d9227c373940cc2..90e832a7088d3285d177bd74b755b1eab09b3c18 100755 (executable)
@@ -82,13 +82,13 @@ void VTKViewer_UnScaledActor::Render(vtkRenderer *theRenderer)
     aDataSet->Update();
     vtkFloatingPointType aLength = aDataSet->GetLength();
     vtkFloatingPointType aPrecision = 1.0E-3;
+    vtkFloatingPointType aZeroTol   = 1.0E-12;
     vtkFloatingPointType anOldScale = GetScale()[0];
-    vtkFloatingPointType aScale;
-    if (aSize[1] > aSize[0])
-      aScale = mySize*aWorldDiag/aWinDiag/aLength*sqrt(vtkFloatingPointType(aSize[0])/vtkFloatingPointType(aSize[1]));
-    else
-      aScale = mySize*aWorldDiag/aWinDiag/aLength*sqrt(vtkFloatingPointType(aSize[1])/vtkFloatingPointType(aSize[0]));
-    if(aScale != 0.0&& fabs(aScale - anOldScale)/aScale > aPrecision){
+    vtkFloatingPointType aScale = anOldScale;
+    vtkFloatingPointType aMaxSize = (vtkFloatingPointType)fmax(aSize[1],aSize[0]);
+    if (fabs(aWinDiag) > aZeroTol && fabs(aLength) > aZeroTol && fabs(aMaxSize) > aZeroTol)
+      aScale = mySize*aWorldDiag/aWinDiag/aLength*sqrt(vtkFloatingPointType(fmin(aSize[1],aSize[0]))/aMaxSize);
+    if(fabs(aScale) > aZeroTol && fabs(aScale - anOldScale)/aScale > aPrecision){
       SetScale(aScale);
     }
   }