Mercurial > hg > svcore
comparison base/LogRange.cpp @ 1393:04abe8f73b22
Remove commented-out code
author | Chris Cannam |
---|---|
date | Tue, 28 Feb 2017 11:26:24 +0000 |
parents | 667e369cfeab |
children | 7e3532d56abb |
comparison
equal
deleted
inserted
replaced
1392:667e369cfeab | 1393:04abe8f73b22 |
---|---|
25 { | 25 { |
26 // ensure that max > min: | 26 // ensure that max > min: |
27 if (min > max) std::swap(min, max); | 27 if (min > max) std::swap(min, max); |
28 if (max == min) max = min + 1; | 28 if (max == min) max = min + 1; |
29 | 29 |
30 // cerr << "LogRange::mapRange: min = " << min << ", max = " << max << endl; | |
31 | |
32 if (min >= 0.0) { | 30 if (min >= 0.0) { |
33 | 31 |
34 // and max > min, so we know min >= 0 and max > 0 | 32 // and max > min, so we know min >= 0 and max > 0 |
35 | 33 |
36 max = log10(max); | 34 max = log10(max); |
37 | 35 |
38 if (min == 0.0) min = std::min(logthresh, max); | 36 if (min == 0.0) min = std::min(logthresh, max); |
39 else min = log10(min); | 37 else min = log10(min); |
40 | |
41 // cerr << "LogRange::mapRange: positive: min = " << min << ", max = " << max << endl; | |
42 | 38 |
43 } else if (max <= 0.0) { | 39 } else if (max <= 0.0) { |
44 | 40 |
45 // and max > min, so we know min < 0 and max <= 0 | 41 // and max > min, so we know min < 0 and max <= 0 |
46 | 42 |
48 | 44 |
49 if (max == 0.0) max = std::min(logthresh, min); | 45 if (max == 0.0) max = std::min(logthresh, min); |
50 else max = log10(-max); | 46 else max = log10(-max); |
51 | 47 |
52 std::swap(min, max); | 48 std::swap(min, max); |
53 | |
54 // cerr << "LogRange::mapRange: negative: min = " << min << ", max = " << max << endl; | |
55 | 49 |
56 } else { | 50 } else { |
57 | 51 |
58 // min < 0 and max > 0 | 52 // min < 0 and max > 0 |
59 | 53 |
60 max = log10(std::max(max, -min)); | 54 max = log10(std::max(max, -min)); |
61 min = std::min(logthresh, max); | 55 min = std::min(logthresh, max); |
62 | |
63 // cerr << "LogRange::mapRange: spanning: min = " << min << ", max = " << max << endl; | |
64 } | 56 } |
65 | 57 |
66 if (min == max) min = max - 1; | 58 if (min == max) min = max - 1; |
67 } | 59 } |
68 | 60 |