]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To avoid devision by zero
authorapo <apo@opencascade.com>
Fri, 2 Dec 2005 15:19:57 +0000 (15:19 +0000)
committerapo <apo@opencascade.com>
Fri, 2 Dec 2005 15:19:57 +0000 (15:19 +0000)
src/PIPELINE/VISU_DeformedShapePL.cxx
src/PIPELINE/VISU_GaussPointsPL.cxx

index 12847fa973e28c4411a097c109b3063e8a80e3b0..af4bf8bd149763f7ec0aaad58cdad3c12b53f0be 100644 (file)
@@ -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(){
index 0ec6d3a9b8ac398c691ff902cd6cda80ec074df8..dfa140a9f888fc18d0fedf34e4388aae1bc1290c 100644 (file)
@@ -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());