diff --git a/include/Rotation.h b/include/Rotation.h index 49f0958f5ec4dd0541c36ed6ce621cb64b8fc7e3..b1d67073bd1ac997cb1358d0ddfbdacd5bf4a007 100644 --- a/include/Rotation.h +++ b/include/Rotation.h @@ -7,8 +7,8 @@ namespace ale { enum RotationInterpolation { - slerp, // Spherical interpolation - nlerp // Normalized linear interpolation + SLERP, // Spherical interpolation + NLERP // Normalized linear interpolation }; /** diff --git a/src/Rotation.cpp b/src/Rotation.cpp index 46d68e0a0a7191860d6906af56315d3080b84b78..ef646ea0979b25f7b9e43d8e9099a3cd9ed5d087 100644 --- a/src/Rotation.cpp +++ b/src/Rotation.cpp @@ -249,10 +249,10 @@ namespace ale { ) const { Eigen::Quaterniond interpQuat; switch (interpType) { - case slerp: + case SLERP: interpQuat = m_impl->quat.slerp(t, nextRotation.m_impl->quat); break; - case nlerp: + case NLERP: interpQuat = Eigen::Quaterniond( linearInterpolate(m_impl->quat.w(), nextRotation.m_impl->quat.w(), t), linearInterpolate(m_impl->quat.x(), nextRotation.m_impl->quat.x(), t), diff --git a/tests/ctests/RotationTest.cpp b/tests/ctests/RotationTest.cpp index e8b839063dcb71974013f01922e52fa7257843d1..8b813409e684ae901981a3a11d3389b1f36b97fe 100644 --- a/tests/ctests/RotationTest.cpp +++ b/tests/ctests/RotationTest.cpp @@ -390,7 +390,7 @@ TEST(RotationTest, MultiplyRotation) { TEST(RotationTest, Slerp) { Rotation rotationOne(0.5, 0.5, 0.5, 0.5); Rotation rotationTwo(-0.5, 0.5, 0.5, 0.5); - Rotation interpRotation = rotationOne.interpolate(rotationTwo, 0.125, ale::slerp); + Rotation interpRotation = rotationOne.interpolate(rotationTwo, 0.125, ale::SLERP); vector<double> quat = interpRotation.toQuaternion(); ASSERT_EQ(quat.size(), 4); EXPECT_NEAR(quat[0], cos(M_PI * 3.0/8.0), 1e-10); @@ -402,7 +402,7 @@ TEST(RotationTest, Slerp) { TEST(RotationTest, SlerpExtrapolate) { Rotation rotationOne(0.5, 0.5, 0.5, 0.5); Rotation rotationTwo(-0.5, 0.5, 0.5, 0.5); - Rotation interpRotation = rotationOne.interpolate(rotationTwo, 1.125, ale::slerp); + Rotation interpRotation = rotationOne.interpolate(rotationTwo, 1.125, ale::SLERP); vector<double> quat = interpRotation.toQuaternion(); ASSERT_EQ(quat.size(), 4); EXPECT_NEAR(quat[0], cos(M_PI * 17.0/24.0), 1e-10); @@ -414,7 +414,7 @@ TEST(RotationTest, SlerpExtrapolate) { TEST(RotationTest, Nlerp) { Rotation rotationOne(0.5, 0.5, 0.5, 0.5); Rotation rotationTwo(-0.5, 0.5, 0.5, 0.5); - Rotation interpRotation = rotationOne.interpolate(rotationTwo, 0.125, ale::nlerp); + Rotation interpRotation = rotationOne.interpolate(rotationTwo, 0.125, ale::NLERP); double scaling = 8.0 / sqrt(57.0); vector<double> quat = interpRotation.toQuaternion(); ASSERT_EQ(quat.size(), 4); @@ -427,7 +427,7 @@ TEST(RotationTest, Nlerp) { TEST(RotationTest, NlerpExtrapolate) { Rotation rotationOne(0.5, 0.5, 0.5, 0.5); Rotation rotationTwo(-0.5, 0.5, 0.5, 0.5); - Rotation interpRotation = rotationOne.interpolate(rotationTwo, 1.125, ale::nlerp); + Rotation interpRotation = rotationOne.interpolate(rotationTwo, 1.125, ale::NLERP); double scaling = 8.0 / sqrt(73.0); vector<double> quat = interpRotation.toQuaternion(); ASSERT_EQ(quat.size(), 4);