Mercurial > hg > svgui
comparison layer/ColourScale.cpp @ 1253:822edd9bb665
Restrict colour 3d plot log scale range to 10 orders of magnitude
author | Chris Cannam |
---|---|
date | Tue, 28 Feb 2017 16:34:59 +0000 |
parents | c53ed1a6fcbd |
children | 6e724c81f18f |
comparison
equal
deleted
inserted
replaced
1252:b0b5776d2156 | 1253:822edd9bb665 |
---|---|
42 m_mappedMin = m_params.threshold; | 42 m_mappedMin = m_params.threshold; |
43 } | 43 } |
44 | 44 |
45 if (m_params.scaleType == ColourScaleType::Log) { | 45 if (m_params.scaleType == ColourScaleType::Log) { |
46 | 46 |
47 LogRange::mapRange(m_mappedMin, m_mappedMax); | 47 // When used in e.g. spectrogram, we have a range with a min |
48 // value of zero. The LogRange converts that to a threshold | |
49 // value of -10, so for a range of e.g. (0,1) we end up with | |
50 // (-10,0) as the mapped range. | |
51 // | |
52 // But in other contexts we could end up with a mapped range | |
53 // much larger than that if we have a small non-zero minimum | |
54 // value (less than 1e-10), or a particularly large | |
55 // maximum. That's unlikely to give us good results, so let's | |
56 // insist that the mapped log range has no more than 10 | |
57 // difference between min and max, to match the behaviour when | |
58 // min == 0 at the input. | |
59 // | |
60 double threshold = -10.0; | |
61 LogRange::mapRange(m_mappedMin, m_mappedMax, threshold); | |
62 if (m_mappedMin < m_mappedMax + threshold) { | |
63 m_mappedMin = m_mappedMax + threshold; | |
64 } | |
48 | 65 |
49 } else if (m_params.scaleType == ColourScaleType::PlusMinusOne) { | 66 } else if (m_params.scaleType == ColourScaleType::PlusMinusOne) { |
50 | 67 |
51 m_mappedMin = -1.0; | 68 m_mappedMin = -1.0; |
52 m_mappedMax = 1.0; | 69 m_mappedMax = 1.0; |