From 0a15ea435cf60c6031e576ac1e6a38c3dde37e05 Mon Sep 17 00:00:00 2001 From: jfa Date: Tue, 16 Dec 2008 08:48:26 +0000 Subject: [PATCH] Bug 0020075: EDF VISU 905: Impossible to create a deformed shape. --- src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx index e1042f3b..5dc0536e 100644 --- a/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx @@ -47,6 +47,8 @@ #include #include +//#include + using namespace std; /*! @@ -167,19 +169,18 @@ void VisuGUI_DeformedShapeDlg::initFromPrsObject (VISU::ColoredPrs3d_i* thePrs, void VisuGUI_DeformedShapeDlg::setFactor(double theFactor) { - double i=0.1; - if(theFactor!=0) { - while (1) { // Calculate Step & Precission - if ( int (theFactor/i) > 0) - break; - else { - i = i*0.1; - } + double step = 0.1; + if (fabs(theFactor) > numeric_limits::epsilon()) { + int degree = int(log10(fabs(theFactor))) - 1; + if (fabs(theFactor) < 1) { + // as logarithm value is negative in this case + // and it is truncated to the bigger integer + degree -= 1; } + step = pow(10, degree); } - ScalFact->setLineStep(i); - + ScalFact->setLineStep(step); ScalFact->setValue(theFactor); } -- 2.39.2