From f92c1219edec83dafd5085dfeca07b61a35c07fb Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 31 Aug 2015 21:56:34 +0200 Subject: [PATCH] Fixed non-identity quaternions for equal vectors #234 --- glm/gtx/quaternion.inl | 3 +++ readme.md | 1 + 2 files changed, 4 insertions(+) diff --git a/glm/gtx/quaternion.inl b/glm/gtx/quaternion.inl index 7467b42d..b405cc5e 100644 --- a/glm/gtx/quaternion.inl +++ b/glm/gtx/quaternion.inl @@ -249,6 +249,9 @@ namespace glm T cosTheta = dot(orig, dest); tvec3 rotationAxis; + if(cosTheta >= static_cast(1) - epsilon()) + return quat(); + if(cosTheta < static_cast(-1) + epsilon()) { // special case when vectors in opposite directions : diff --git a/readme.md b/readme.md index 26a36c7e..9e06527e 100644 --- a/readme.md +++ b/readme.md @@ -55,6 +55,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) - Fixed strict alignment warnings #235 #370 - Fixed link errors on compilers not supported default function #377 - Fixed compilation warnings in vec4 +- Fixed non-identity quaternions for equal vectors #234 #### [GLM 0.9.7.0](https://github.com/g-truc/glm/releases/tag/0.9.7.0) - 2015-08-02 ##### Features: