From b7c42a5fc5e7f9bdc837092ca4e064f1abd9a454 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Tue, 6 Aug 2019 00:59:25 -0700 Subject: [PATCH] Add some notes to the SLERP test. --- test/quaternion_test.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/quaternion_test.cc b/test/quaternion_test.cc index 25d50e0..f419893 100644 --- a/test/quaternion_test.cc +++ b/test/quaternion_test.cc @@ -109,10 +109,15 @@ TEST(Quaterniond, Rotate) TEST(Quaterniond, ShortestSLERP) { + // Our starting point is an orientation that is yawed 45° - our + // orientation is pointed π/4 radians in the X axis. geom::Quaterniond p = geom::Quaterniond {0.382683, 0, 0, 0.92388}; + // Our ending point is an orientation that is yawed -45° - or + // pointed -π/4 radians in the X axis. geom::Quaterniond q = geom::Quaterniond {-0.382683, 0, 0, 0.92388}; - geom::Quaterniond r = geom::Quaterniond {0, 0, 0, 1}; - + // The halfway point should be oriented midway about the X axis. It turns + // out this is an identity quaternion. + geom::Quaterniond r; EXPECT_EQ(geom::ShortestSLERP(p, q, 0.0), p); EXPECT_EQ(geom::ShortestSLERP(p, q, 1.0), q);