From 5757ed208206568dd0bcb377ea2ad39ef03e4ee0 Mon Sep 17 00:00:00 2001 From: admin Date: Tue, 16 Dec 2008 09:55:13 +0000 Subject: [PATCH] This commit was generated by cvs2git to create tag 'V4_1_4sp1'. Sprout from V4_1_0_maintainance 2008-12-01 12:38:14 UTC vsr 'Update copyright information' Cherrypick from V4_1_0_maintainance 2008-12-16 09:55:12 UTC jfa 'Bug 0020075: EDF VISU 905: Impossible to create a deformed shape.': src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx --- 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..e110c16e 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., double(degree)); } - ScalFact->setLineStep(i); - + ScalFact->setLineStep(step); ScalFact->setValue(theFactor); } -- 2.39.2