From: mzn Date: Fri, 26 Aug 2005 12:05:18 +0000 (+0000) Subject: Fix for problem: SIGFPE at cut lines edition. X-Git-Tag: T_3_0_2a1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=461494706f0eee1b78db219c8b841ba5b80c2458;p=modules%2Fvisu.git Fix for problem: SIGFPE at cut lines edition. --- diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index f2ee138e..d542b221 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -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){