From a3b5034d4e671793d1b35163127cb34bf9edd2dc Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 7 Dec 2011 12:37:22 +0000 Subject: [PATCH] Updated constants list --- glm/gtx/constants.hpp | 27 ++++++++++++++++++++++++++- glm/gtx/constants.inl | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/glm/gtx/constants.hpp b/glm/gtx/constants.hpp index 7ab75855..e7e2169a 100644 --- a/glm/gtx/constants.hpp +++ b/glm/gtx/constants.hpp @@ -58,6 +58,16 @@ namespace glm template T epsilon(); + /// Return 0. + /// @see gtx_constants + template + T zero(); + + /// Return 1. + /// @see gtx_constants + template + T one(); + /// Return the pi constant. /// @see gtx_constants template @@ -128,6 +138,16 @@ namespace glm template T root_two(); + /// Return sqrt(3). + /// @see gtx_constants + template + T root_three(); + + /// Return sqrt(5). + /// @see gtx_constants + template + T root_five(); + /// Return ln(2). /// @see gtx_constants template @@ -151,7 +171,12 @@ namespace glm /// Return 2 / 3. /// @see gtx_constants template - T twothirds(); + T two_thirds(); + + /// Return the golden ratio constant. + /// @see gtx_constants + template + T golden_ratio(); /// @} } //namespace glm diff --git a/glm/gtx/constants.inl b/glm/gtx/constants.inl index 0e696bfb..ffdebcf2 100644 --- a/glm/gtx/constants.inl +++ b/glm/gtx/constants.inl @@ -34,6 +34,18 @@ namespace glm return std::numeric_limits::epsilon(); } + template + GLM_FUNC_QUALIFIER T zero() + { + return T(0); + } + + template + GLM_FUNC_QUALIFIER T one() + { + return T(1); + } + template GLM_FUNC_QUALIFIER T pi() { @@ -118,6 +130,18 @@ namespace glm return T(1.41421356237309504880168872420969808); } + template + GLM_FUNC_QUALIFIER T root_three() + { + return T(1.73205080756887729352744634150587236); + } + + template + GLM_FUNC_QUALIFIER T root_five() + { + return T(2.23606797749978969640917366873127623); + } + template GLM_FUNC_QUALIFIER T ln_two() { @@ -139,12 +163,18 @@ namespace glm template GLM_FUNC_QUALIFIER T third() { - return T(0.333333333333333333); + return T(0.3333333333333333333333333333333333333333); } template - GLM_FUNC_QUALIFIER T twothirds() + GLM_FUNC_QUALIFIER T two_thirds() { - return T(0.666666666666666667); + return T(0.666666666666666666666666666666666666667); + } + + template + GLM_FUNC_QUALIFIER T golden_ratio() + { + return T(1.61803398874989484820458683436563811); } } //namespace glm