Browse Source

Fixed non-identity quaternions for equal vectors #234

Christophe Riccio 10 years ago
parent
commit
f92c1219ed
2 changed files with 4 additions and 0 deletions
  1. 3 0
      glm/gtx/quaternion.inl
  2. 1 0
      readme.md

+ 3 - 0
glm/gtx/quaternion.inl

@@ -249,6 +249,9 @@ namespace glm
 		T cosTheta = dot(orig, dest);
 		tvec3<T, P> rotationAxis;
 
+		if(cosTheta >= static_cast<T>(1) - epsilon<T>())
+			return quat();
+
 		if(cosTheta < static_cast<T>(-1) + epsilon<T>())
 		{
 			// special case when vectors in opposite directions :

+ 1 - 0
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: