changeset 341:db8fcd280234

* Fix log range mapper bug
author Chris Cannam
date Mon, 26 Nov 2007 13:33:14 +0000
parents 516819f2b97b
children 4175a4930186
files base/RangeMapper.cpp
diffstat 1 files changed, 1 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/base/RangeMapper.cpp	Fri Nov 23 16:48:23 2007 +0000
+++ b/base/RangeMapper.cpp	Mon Nov 26 13:33:14 2007 +0000
@@ -76,9 +76,7 @@
 int
 LogRangeMapper::getPositionForValue(float value) const
 {
-    float mapped = m_ratio * log10(value);
-    int position = lrintf(((mapped - m_minlog) / (m_maxlog - m_minlog))
-                          * (m_maxpos - m_minpos));
+    int position = (log10(value) - m_minlog) * m_ratio + m_minpos;
     if (position < m_minpos) position = m_minpos;
     if (position > m_maxpos) position = m_maxpos;
 //    std::cerr << "LogRangeMapper::getPositionForValue: " << value << " -> "