]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Fix for problem: SIGFPE at cut lines edition.
authormzn <mzn@opencascade.com>
Fri, 26 Aug 2005 12:05:18 +0000 (12:05 +0000)
committermzn <mzn@opencascade.com>
Fri, 26 Aug 2005 12:05:18 +0000 (12:05 +0000)
src/VISU_I/VISU_CutLines_i.cc

index f2ee138e5dfb80343b319470b4d868ad123077c7..d542b221b8865cf642f28e0852d631a71c1818d6 100644 (file)
@@ -36,6 +36,8 @@
 using namespace VISU;
 using namespace std;
 
+static float EPS_machine = 1.0E-7;
+
 #ifdef _DEBUG_
 static int MYDEBUG = 0;
 #else
@@ -298,10 +300,15 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){
       for(int i = 0; i < aNbPoints; i++){
        aDataSet->GetPoint(i,aPnt);
        Sub(aPnt,aBasePnt,aVect);
-       aDist = vtkMath::Dot(aVect,aDirLn) / aBoundPrjLn[2];
-       // the workaround
-       if(aDist < 0.0) aDist = 0.0; 
-       if(aDist > 1.0) aDist = 1.0;
+       if ( fabs(aBoundPrjLn[2]) < EPS_machine )
+         aDist = 0.5;
+       else
+         {
+           aDist = vtkMath::Dot(aVect,aDirLn) / aBoundPrjLn[2];
+           // the workaround
+           if(aDist < 0.0) aDist = 0.0; 
+           if(aDist > 1.0) aDist = 1.0;
+         }
        aXYMap[aDist] = aScalars->GetTuple1(i);
       }
       if(aFilter){