VizFwk: Discrete log legend: Added missing clamping

This commit is contained in:
Jacob Støren 2015-05-16 09:36:03 +02:00
parent f544528aee
commit 33148edef4

View File

@ -72,6 +72,7 @@ Color3ub ScalarMapperDiscreteLog::mapToColor(double scalarValue) const
double normSemiMaxVal = normalizedValue(levelUnderMax);
double adjustedNormVal = 0;
if (normSemiMaxVal != 0) adjustedNormVal = normDiscVal/normSemiMaxVal;
adjustedNormVal = cvf::Math::clamp(adjustedNormVal, 0.0, 1.0);
return colorFromUserColorGradient(adjustedNormVal);
}