Browse Source

Added test gor issue #199

Christophe Riccio 11 năm trước cách đây
mục cha
commit
a2b70690c1

+ 1 - 1
glm/gtx/quaternion.inl

@@ -87,7 +87,7 @@ namespace glm
 			T Vec3Len = sqrt(q.x * q.x + q.y * q.y + q.z * q.z);
 			T Vec3Len = sqrt(q.x * q.x + q.y * q.y + q.z * q.z);
 			T QuatLen = sqrt(Vec3Len * Vec3Len + q.w * q.w);
 			T QuatLen = sqrt(Vec3Len * Vec3Len + q.w * q.w);
 			T t = atan(Vec3Len, T(q.w)) / Vec3Len;
 			T t = atan(Vec3Len, T(q.w)) / Vec3Len;
-			return detail::tquat<T, P>(t * q.x, t * q.y, t * q.z, log(QuatLen));
+			return detail::tquat<T, P>(log(QuatLen), t * q.x, t * q.y, t * q.z);
 		}
 		}
 	}
 	}
 
 

+ 12 - 0
test/gtx/gtx_quaternion.cpp

@@ -87,10 +87,22 @@ int test_rotation()
 	return Error;
 	return Error;
 }
 }
 
 
+int test_log()
+{
+	int Error(0);
+	
+	glm::quat q;
+	glm::quat p = glm::log(q);
+	glm::quat r = glm::exp(p);
+
+	return Error;
+}
+
 int main()
 int main()
 {
 {
 	int Error(0);
 	int Error(0);
 
 
+	Error += test_log();
 	Error += test_rotation();
 	Error += test_rotation();
 	Error += test_quat_fastMix();
 	Error += test_quat_fastMix();
 	Error += test_quat_shortMix();
 	Error += test_quat_shortMix();