Browse Source

Add tau constant ##1153

christophe 2 years ago
parent
commit
85f2e6b998
2 changed files with 11 additions and 0 deletions
  1. 5 0
      glm/gtc/constants.hpp
  2. 6 0
      glm/gtc/constants.inl

+ 5 - 0
glm/gtc/constants.hpp

@@ -39,6 +39,11 @@ namespace glm
 	template<typename genType>
 	GLM_FUNC_DECL GLM_CONSTEXPR genType two_pi();
 
+	/// Return unit-circle circumference, or pi * 2.
+	/// @see gtc_constants
+	template<typename genType>
+	GLM_FUNC_DECL GLM_CONSTEXPR genType tau() { return glm::two_pi<genType>(); }
+
 	/// Return square root of pi.
 	/// @see gtc_constants
 	template<typename genType>

+ 6 - 0
glm/gtc/constants.inl

@@ -20,6 +20,12 @@ namespace glm
 		return genType(6.28318530717958647692528676655900576);
 	}
 
+	template<typename genType>
+	GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType tau()
+	{
+		return two_pi<genType>();
+	}
+
 	template<typename genType>
 	GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_pi()
 	{