]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Bug VISU200819999 - SIGFPE on Sweep functionality
authorouv <ouv@opencascade.com>
Tue, 24 Jun 2008 07:49:04 +0000 (07:49 +0000)
committerouv <ouv@opencascade.com>
Tue, 24 Jun 2008 07:49:04 +0000 (07:49 +0000)
src/PIPELINE/VISU_DeformedShapePL.cxx
src/PIPELINE/VISU_XYPlotActor.cxx

index d1e8d6f381497c90d5a0a4a4e1f4516cde379aff..816c474b277d79934f9643b0e444eb4a2475026d 100644 (file)
@@ -109,7 +109,7 @@ VISU_DeformedShapePL
       aVolume *= aVol;
     }
   }
-  if( fabs(idim) < 1.0 / VTK_LARGE_FLOAT )
+  if( aNbElem == 0 || fabs(idim) < 1.0 / VTK_LARGE_FLOAT )
     return 0.0; // to avoid division by zero
   aVolume /= aNbElem;
   return pow(aVolume, vtkFloatingPointType(1.0/idim));
index e7f912a3b6007b2146f2dde227267a3772108cfa..c4818b41c55bd0815aed26382d025e2f5ed3243a 100644 (file)
@@ -1493,9 +1493,9 @@ void VISU_XYPlotActor::CreatePlotData(int *pos, int *pos2Extern, double xRange[2
               }
 
             numLinePts++;
-            xyz[0] = pos[0] + 
+            xyz[0] = fabs( xRange[1] - xRange[0] ) < 1.0 / VTK_LARGE_FLOAT ? pos[0] : pos[0] + 
               (xyz[0]-xRange[0])/(xRange[1]-xRange[0])*(pos2[0]-pos[0]);
-            xyz[1] = pos[1] + 
+            xyz[1] = fabs( yRange[1] - yRange[0] ) < 1.0 / VTK_LARGE_FLOAT ? pos[1] : pos[1] + 
               (xyz[1]-yRange[0])/(yRange[1]-yRange[0])*(pos2[1]-pos[1]);
             id = pts->InsertNextPoint(xyz);
             lines->InsertCellPoint(id);
@@ -1511,9 +1511,9 @@ void VISU_XYPlotActor::CreatePlotData(int *pos, int *pos2Extern, double xRange[2
             }
 
           numLinePts++;
-          xyz[0] = pos[0] + 
+          xyz[0] = fabs( xRange[1] - xRange[0] ) < 1.0 / VTK_LARGE_FLOAT ? pos[0] : pos[0] + 
             (xyz[0]-xRange[0])/(xRange[1]-xRange[0])*(pos2[0]-pos[0]);
-          xyz[1] = pos[1] + 
+          xyz[1] = fabs( yRange[1] - yRange[0] ) < 1.0 / VTK_LARGE_FLOAT ? pos[1] : pos[1] + 
             (xyz[1]-yRange[0])/(yRange[1]-yRange[0])*(pos2[1]-pos[1]);
           id = pts->InsertNextPoint(xyz);
           lines->InsertCellPoint(id);
@@ -1608,9 +1608,9 @@ void VISU_XYPlotActor::CreatePlotData(int *pos, int *pos2Extern, double xRange[2
               clippingRequired = 1;
               }
             numLinePts++;
-            xyz[0] = pos[0] + 
+            xyz[0] = fabs( xRange[1] - xRange[0] ) < 1.0 / VTK_LARGE_FLOAT ? pos[0] : pos[0] + 
               (xyz[0]-xRange[0])/(xRange[1]-xRange[0])*(pos2[0]-pos[0]);
-            xyz[1] = pos[1] + 
+            xyz[1] = fabs( yRange[1] - yRange[0] ) < 1.0 / VTK_LARGE_FLOAT ? pos[1] : pos[1] + 
               (xyz[1]-yRange[0])/(yRange[1]-yRange[0])*(pos2[1]-pos[1]);
             id = pts->InsertNextPoint(xyz);
             lines->InsertCellPoint(id);
@@ -1625,9 +1625,9 @@ void VISU_XYPlotActor::CreatePlotData(int *pos, int *pos2Extern, double xRange[2
             clippingRequired = 1;
             }    
           numLinePts++;
-          xyz[0] = pos[0] +
+          xyz[0] = fabs( xRange[1] - xRange[0] ) < 1.0 / VTK_LARGE_FLOAT ? pos[0] : pos[0] +
             (xyz[0]-xRange[0])/(xRange[1]-xRange[0])*(pos2[0]-pos[0]);
-          xyz[1] = pos[1] +
+          xyz[1] = fabs( yRange[1] - yRange[0] ) < 1.0 / VTK_LARGE_FLOAT ? pos[1] : pos[1] +
             (xyz[1]-yRange[0])/(yRange[1]-yRange[0])*(pos2[1]-pos[1]);
           id = pts->InsertNextPoint(xyz);
           lines->InsertCellPoint(id);