Mercurial > hg > svgui
comparison layer/Colour3DPlotLayer.cpp @ 1378:f08a3b8cdb9d
Avoid nan/inf values (and consequent crash) in colour scale range
author | Chris Cannam |
---|---|
date | Tue, 06 Nov 2018 13:35:47 +0000 |
parents | a1393b4384a5 |
children | c8a6fd3f9dff 79032214f79d |
comparison
equal
deleted
inserted
replaced
1377:d18ca558049e | 1378:f08a3b8cdb9d |
---|---|
1047 SVDEBUG << "Colour3DPlotLayer: rebuilding renderer, value range is " | 1047 SVDEBUG << "Colour3DPlotLayer: rebuilding renderer, value range is " |
1048 << minValue << " -> " << maxValue | 1048 << minValue << " -> " << maxValue |
1049 << " (model min = " << m_model->getMinimumLevel() | 1049 << " (model min = " << m_model->getMinimumLevel() |
1050 << ", max = " << m_model->getMaximumLevel() << ")" | 1050 << ", max = " << m_model->getMaximumLevel() << ")" |
1051 << endl; | 1051 << endl; |
1052 | 1052 |
1053 if (maxValue <= minValue) { | 1053 if (maxValue <= minValue) { |
1054 maxValue = minValue + 0.1f; | 1054 maxValue = minValue + 0.1f; |
1055 | |
1056 if (!(maxValue > minValue)) { // one of them must be NaN or Inf | |
1057 SVCERR << "WARNING: Colour3DPlotLayer::getRenderer: resetting " | |
1058 << "minValue and maxValue to zero and one" << endl; | |
1059 minValue = 0.f; | |
1060 maxValue = 1.f; | |
1061 } | |
1055 } | 1062 } |
1056 | 1063 |
1057 cparams.threshold = minValue; | 1064 cparams.threshold = minValue; |
1058 cparams.minValue = minValue; | 1065 cparams.minValue = minValue; |
1059 cparams.maxValue = maxValue; | 1066 cparams.maxValue = maxValue; |