From 71fcd082aa2f26d3eb38559791b4c34f92bd8856 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Tue, 18 Feb 2014 16:00:48 +1100 Subject: [PATCH] Allow range::normalise to return non-unit values --- range.cpp | 1 - range.hpp | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/range.cpp b/range.cpp index 240af69d..f0c74195 100644 --- a/range.cpp +++ b/range.cpp @@ -107,7 +107,6 @@ range::expand (T val) { template double range::normalise (T val) const { - CHECK_SOFT (val >= min && val <= max); return ((double)val - min) / ((double)max - min); } diff --git a/range.hpp b/range.hpp index 396a2dc0..e1ab4169 100644 --- a/range.hpp +++ b/range.hpp @@ -49,7 +49,9 @@ namespace util { /// Expand the range to include this value if necessary void expand (T val); - /// Normalise a number to [0, 1] within the range. Does not check bounds. + /// Normalise a number to [0, 1] within the range. Does not check + /// bounds, it is the caller's responsibility to clamp the result if + /// needed. double normalise (T val) const; range& operator*= (T);