From: jfa Date: Tue, 16 Dec 2008 08:48:26 +0000 (+0000) Subject: Bug 0020075: EDF VISU 905: Impossible to create a deformed shape. X-Git-Tag: V4_1_4sp2~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0a15ea435cf60c6031e576ac1e6a38c3dde37e05;p=modules%2Fvisu.git Bug 0020075: EDF VISU 905: Impossible to create a deformed shape. --- 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); }