From 0675da467ac4680a9c2f22b3dfb3769df3c66896 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 24 Sep 2016 10:46:46 +0200 Subject: [PATCH] Optimized quaternion log function #554 --- glm/gtx/quaternion.inl | 4 ++-- readme.md | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/glm/gtx/quaternion.inl b/glm/gtx/quaternion.inl index 1a31e947..c86ec187 100644 --- a/glm/gtx/quaternion.inl +++ b/glm/gtx/quaternion.inl @@ -71,9 +71,9 @@ namespace glm } else { - T QuatLen = sqrt(Vec3Len * Vec3Len + q.w * q.w); T t = atan(Vec3Len, T(q.w)) / Vec3Len; - return tquat(log(QuatLen), t * q.x, t * q.y, t * q.z); + T QuatLen2 = Vec3Len * Vec3Len + q.w * q.w; + return tquat(static_cast(0.5) * log(QuatLen2), t * q.x, t * q.y, t * q.z); } } diff --git a/readme.md b/readme.md index f71333b9..efe14e2a 100644 --- a/readme.md +++ b/readme.md @@ -52,6 +52,9 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) ## Release notes #### [GLM 0.9.8.1](https://github.com/g-truc/glm/tree/0.9.8) - 2016-XX-XX +##### Improvements: +- Optimized quaternion log function #554 + ##### Fixes: - Fixed GCC warning filtering, replaced -pedantic by -Wpedantic - Fixed SIMD faceforward bug. #549