From bfa6c9e192734a69ee19951c4881282e8e79274c Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 20 Sep 2017 17:57:44 +0200 Subject: [PATCH] - Added EXT_vector_relational: openBounded and closeBounded --- glm/ext/vector_relational.hpp | 20 ++++++++++++++++++++ glm/ext/vector_relational.inl | 12 ++++++++++++ readme.md | 1 + 3 files changed, 33 insertions(+) diff --git a/glm/ext/vector_relational.hpp b/glm/ext/vector_relational.hpp index a6920eaf..da133969 100644 --- a/glm/ext/vector_relational.hpp +++ b/glm/ext/vector_relational.hpp @@ -87,6 +87,26 @@ namespace glm template GLM_FUNC_DECL bool notEqual(genType const& x, genType const& y, genType const& epsilon); + /// Returns whether vector components values are within an interval. A open interval excludes its endpoints, and is denoted with square brackets. + /// + /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector + /// @tparam T Floating-point or integer scalar types + /// @tparam Q Value from qualifier enum + /// + /// @see ext_vector_relational + template + GLM_FUNC_DECL vec openBounded(vec const& Value, vec const& Min, vec const& Max); + + /// Returns whether vector components values are within an interval. A closed interval includes its endpoints, and is denoted with square brackets. + /// + /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector + /// @tparam T Floating-point or integer scalar types + /// @tparam Q Value from qualifier enum + /// + /// @see ext_vector_relational + template + GLM_FUNC_DECL vec closeBounded(vec const& Value, vec const& Min, vec const& Max); + /// @} }//namespace glm diff --git a/glm/ext/vector_relational.inl b/glm/ext/vector_relational.inl index 8532a022..3280dde4 100644 --- a/glm/ext/vector_relational.inl +++ b/glm/ext/vector_relational.inl @@ -43,4 +43,16 @@ namespace glm { return greaterThanEqual(abs(x - y), epsilon); } + + template + GLM_FUNC_QUALIFIER vec openBounded(vec const& Value, vec const& Min, vec const& Max) + { + return greaterThan(Value, Min) && lessThan(Value, Max); + } + + template + GLM_FUNC_QUALIFIER vec closeBounded(vec const& Value, vec const& Min, vec const& Max) + { + return greaterThanEqual(Value, Min) && lessThanEqual(Value, Max); + } }//namespace glm diff --git a/readme.md b/readme.md index 53bfc8e1..833006f5 100644 --- a/readme.md +++ b/readme.md @@ -64,6 +64,7 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate) - Added quatLookAt to GTX_quaternion #659 - Added fmin, fmax and fclamp to GTX_extended_min_max #372 - Added EXT_vector_relational: extend equal and notEqual to take an epsilon argument +- Added EXT_vector_relational: openBounded and closeBounded - Added EXT_vec1: *vec1 types - Added GTX_texture: levels function