diff base/RangeMapper.cpp @ 341:db8fcd280234

* Fix log range mapper bug
author Chris Cannam
date Mon, 26 Nov 2007 13:33:14 +0000
parents 2b40f83e7627
children ca3b91119482
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 << " -> "