Quaternion/Vector: Small refactor for review: put more comments, switched type conversions, took out default destination vector because confusing

This commit is contained in:
Matthias Grob
2017-12-04 13:27:58 +01:00
parent af2610ec04
commit f835d39017
3 changed files with 10 additions and 9 deletions
+4 -5
View File
@@ -40,12 +40,11 @@ int main()
TEST(fabs(q(3) - 4) < eps);
// quaternion ctor: vector to vector
Vector3f v1(0.f, 0.f, 1.f);
// identity & default destination vector test
Quatf quat_v(v1);
TEST(isEqual(quat_v.conjugate(v1), v1));
// identity test
Quatf quat_v(v,v);
TEST(isEqual(quat_v.conjugate(v), v));
// random test (vector norm can not be preserved with a pure rotation)
v1 = Vector3f(-80.1f, 1.5f, -6.89f);
Vector3f v1(-80.1f, 1.5f, -6.89f);
quat_v = Quatf(v1, v);
TEST(isEqual(quat_v.conjugate(v1).normalized() * v.norm(), v));
// special 180 degree case 1