From 461494706f0eee1b78db219c8b841ba5b80c2458 Mon Sep 17 00:00:00 2001 From: mzn Date: Fri, 26 Aug 2005 12:05:18 +0000 Subject: [PATCH] Fix for problem: SIGFPE at cut lines edition. --- src/VISU_I/VISU_CutLines_i.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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){ -- 2.39.2