diff options
Diffstat (limited to 'boost/geometry/util/math.hpp')
-rw-r--r-- | boost/geometry/util/math.hpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/boost/geometry/util/math.hpp b/boost/geometry/util/math.hpp index 234cfa1ed0..b1c3648c98 100644 --- a/boost/geometry/util/math.hpp +++ b/boost/geometry/util/math.hpp @@ -71,6 +71,19 @@ inline T const& greatest(T const& v1, T const& v2, T const& v3, T const& v4, T c } +template <typename T> +inline T bounded(T const& v, T const& lower, T const& upper) +{ + return (std::min)((std::max)(v, lower), upper); +} + +template <typename T> +inline T bounded(T const& v, T const& lower) +{ + return (std::max)(v, lower); +} + + template <typename T, bool IsFloatingPoint = boost::is_floating_point<T>::value> struct abs @@ -518,7 +531,7 @@ inline T scaled_epsilon(T const& value) } -// Maybe replace this by boost equals or boost ublas numeric equals or so +// Maybe replace this by boost equals or so /*! \brief returns true if both arguments are equal. |