Mercurial > hg > svcore
diff base/MagnitudeRange.h @ 1527:710e6250a401 zoom
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 17 Sep 2018 13:51:14 +0100 |
parents | 48e9f538e6e9 |
children | bbfb5a1e4b84 |
line wrap: on
line diff
--- a/base/MagnitudeRange.h Mon Dec 12 15:18:52 2016 +0000 +++ b/base/MagnitudeRange.h Mon Sep 17 13:51:14 2018 +0100 @@ -29,7 +29,7 @@ MagnitudeRange(float min, float max) : m_min(min), m_max(max) { } bool operator==(const MagnitudeRange &r) { - return r.m_min == m_min && r.m_max == m_max; + return r.m_min == m_min && r.m_max == m_max; } bool operator!=(const MagnitudeRange &r) { return !(*this == r); @@ -37,20 +37,20 @@ bool isSet() const { return (m_min != 0.f || m_max != 0.f); } void set(float min, float max) { - m_min = min; - m_max = max; - if (m_max < m_min) m_max = m_min; + m_min = min; + m_max = max; + if (m_max < m_min) m_max = m_min; } bool sample(float f) { - bool changed = false; - if (isSet()) { - if (f < m_min) { m_min = f; changed = true; } - if (f > m_max) { m_max = f; changed = true; } - } else { - m_max = m_min = f; - changed = true; - } - return changed; + bool changed = false; + if (isSet()) { + if (f < m_min) { m_min = f; changed = true; } + if (f > m_max) { m_max = f; changed = true; } + } else { + m_max = m_min = f; + changed = true; + } + return changed; } bool sample(const std::vector<float> &ff) { bool changed = false; @@ -62,16 +62,16 @@ return changed; } bool sample(const MagnitudeRange &r) { - bool changed = false; - if (isSet()) { - if (r.m_min < m_min) { m_min = r.m_min; changed = true; } - if (r.m_max > m_max) { m_max = r.m_max; changed = true; } - } else { - m_min = r.m_min; - m_max = r.m_max; - changed = true; - } - return changed; + bool changed = false; + if (isSet()) { + if (r.m_min < m_min) { m_min = r.m_min; changed = true; } + if (r.m_max > m_max) { m_max = r.m_max; changed = true; } + } else { + m_min = r.m_min; + m_max = r.m_max; + changed = true; + } + return changed; } float getMin() const { return m_min; } float getMax() const { return m_max; }