From: ptv Date: Fri, 24 Apr 2009 09:17:41 +0000 (+0000) Subject: Debug FPE exception X-Git-Tag: V5_1_2rc1~26 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5a24b4aac106a02f1111f0ab1783fc004a05528a;p=modules%2Fgui.git Debug FPE exception --- diff --git a/src/VTKViewer/VTKViewer_Trihedron.cxx b/src/VTKViewer/VTKViewer_Trihedron.cxx index 067dfecf6..90e832a70 100755 --- a/src/VTKViewer/VTKViewer_Trihedron.cxx +++ b/src/VTKViewer/VTKViewer_Trihedron.cxx @@ -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); } }