From e637299192c72423ee55dda3749e51b896a7b1aa Mon Sep 17 00:00:00 2001 From: plasmacel Date: Fri, 21 Nov 2014 04:29:35 +0100 Subject: [PATCH] implement cot as tan(pi/2 - angle) --- glm/gtc/reciprocal.inl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/glm/gtc/reciprocal.inl b/glm/gtc/reciprocal.inl index 587f42a2..d43653d3 100644 --- a/glm/gtc/reciprocal.inl +++ b/glm/gtc/reciprocal.inl @@ -66,7 +66,9 @@ namespace glm GLM_FUNC_QUALIFIER genType cot(genType angle) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'cot' only accept floating-point values"); - return genType(1) / glm::tan(angle); + genType const pi_over_2 = genType(3.1415926535897932384626433832795 / 2.0); + + return glm::tan(pi_over_2 - angle); } template class vecType>