Mercurial > hg > svcore
diff base/LogRange.cpp @ 464:9525c9d7e54d
* Add vertical zoom and pan to time-value layer.
Still some defects, particularly in logarithmic mode.
Now need to get this in note layer as well!
* Some fixes to log colouring in segmentation mode of time-value layer.
author | Chris Cannam |
---|---|
date | Fri, 24 Oct 2008 14:52:40 +0000 |
parents | 2268963dabd1 |
children | 1405f4a2caf3 |
line wrap: on
line diff
--- a/base/LogRange.cpp Thu Oct 23 16:32:00 2008 +0000 +++ b/base/LogRange.cpp Fri Oct 24 14:52:40 2008 +0000 @@ -16,6 +16,7 @@ #include "LogRange.h" #include <algorithm> +#include <iostream> #include <cmath> void @@ -24,6 +25,8 @@ if (min > max) std::swap(min, max); if (max == min) max = min + 1; +// std::cerr << "LogRange::mapRange: min = " << min << ", max = " << max << std::endl; + if (min >= 0.f) { max = log10f(max); // we know max != 0 @@ -31,6 +34,8 @@ if (min == 0.f) min = std::min(logthresh, max); else min = log10f(min); +// std::cerr << "LogRange::mapRange: positive: min = " << min << ", max = " << max << std::endl; + } else if (max <= 0.f) { min = log10f(-min); // we know min != 0 @@ -40,12 +45,16 @@ std::swap(min, max); +// std::cerr << "LogRange::mapRange: negative: min = " << min << ", max = " << max << std::endl; + } else { // min < 0 and max > 0 max = log10f(std::max(max, -min)); min = std::min(logthresh, max); + +// std::cerr << "LogRange::mapRange: spanning: min = " << min << ", max = " << max << std::endl; } if (min == max) min = max - 1;