From: apo Date: Fri, 2 Dec 2005 15:19:57 +0000 (+0000) Subject: To avoid devision by zero X-Git-Tag: TG-D5-38-2003_D2005-20-12~75 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ff1479f34aa78998642b65d7024db5b206c022b9;p=modules%2Fvisu.git To avoid devision by zero --- diff --git a/src/PIPELINE/VISU_DeformedShapePL.cxx b/src/PIPELINE/VISU_DeformedShapePL.cxx index 12847fa9..af4bf8bd 100644 --- a/src/PIPELINE/VISU_DeformedShapePL.cxx +++ b/src/PIPELINE/VISU_DeformedShapePL.cxx @@ -86,7 +86,13 @@ void VISU_DeformedShapePL::Init(){ VISU_ScalarMapPL::Init(); float aScalarRange[2]; GetSourceRange(aScalarRange); - SetScale(GetScaleFactor(GetInput2())/aScalarRange[1]); + + vtkDataSet* aDataSet = GetInput2(); + float aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet ); + + static double EPS = 1.0 / VTK_LARGE_FLOAT; + if(std::abs(aScalarRange[1]) > EPS) + SetScale(aScaleFactor / aScalarRange[1]); } VISU_ScalarMapPL::THook* VISU_DeformedShapePL::DoHook(){ diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index 0ec6d3a9..dfa140a9 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -184,7 +184,12 @@ VISU_GaussPointsPL GetSourceRange(aScalarRange); vtkDataSet* aDataSet = GetParentMesh(); float aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet ); - SetScale( aScaleFactor / aScalarRange[1] ); + + static double EPS = 1.0 / VTK_LARGE_FLOAT; + if(std::abs(aScalarRange[1]) > EPS) + SetScale( aScaleFactor / aScalarRange[1] ); + else + SetScale(0.0); // Deformed Shape myPassFilter[0]->SetInput(myCellDataToPointData->GetUnstructuredGridOutput());