return myScaleSpn->value();
}
-void VisuGUI_CutPlanesPane::setScaleFactor(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;
- }
+void VisuGUI_CutPlanesPane::setScaleFactor(double theFactor)
+{
+ double step = 0.1;
+ if (fabs(theFactor) > numeric_limits<double>::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));
}
- myScaleSpn->setLineStep(i);
+ myScaleSpn->setLineStep(step);
myScaleSpn->setValue(theFactor);
-
}
-
void VisuGUI_CutPlanesPane::createPlanes()
{
if (VISU::GetActiveViewWindow<SVTK_ViewWindow>() == NULL) return;
void VisuGUI_DeformedShapeAndScalarMapDlg::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<double>::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);
}
*/
void VisuGUI_VectorsDlg::setScaleFactor( double theFactor )
{
- double i=0.1;
- 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<double>::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->setValue( theFactor );
+ ScalFact->setLineStep(step);
+ ScalFact->setValue(theFactor);
}
/*!