Quaternion self test fixed.

The self-test expects a unit quaternion. The Quaternion vector<3>
constructor uses the vector as-is, expecting it to be potentially the
output from an existing Quaternion. MakeQuaternion is the right function
for build a unit quaternion, so the self-test should actually use this.

This error had been hidden due to building with NDEBUG, which ifdefs out
the self-test. The code was probably changed during the refactoring
process.
This commit is contained in:
Kyle Isom 2023-10-21 19:53:22 -07:00
parent f393f8614f
commit 168ee430f4
1 changed files with 4 additions and 4 deletions

View File

@ -75,13 +75,13 @@ QuaternionSelfTest()
Vector3F yAxis {0.0, 1.0, 0.0};
float angle = M_PI / 2;
Quaternionf p = quaternionf(yAxis, angle);
Quaternionf p = MakeQuaternion(yAxis, angle);
Quaternionf q;
Vector3F vr {0.0, 0.0, 1.0};
assert(p.isUnitQuaternion());
std::cerr << p.rotate(v) << std::endl;
assert(p.rotate(v) == vr);
p.SetEpsilon(0.0001);
assert(p.IsUnitQuaternion());
assert(p.Rotate(v) == vr);
assert(p * q == p);
#endif
}