quaternion: ensure tests don't use >2PI radian parameters

This commit is contained in:
Danny Robson 2020-01-01 06:54:25 +11:00
parent 5251c9b071
commit 5d0f879ad4
2 changed files with 4 additions and 4 deletions

View File

@ -181,7 +181,7 @@ test_mq_euler (cruft::TAP::logger &tap)
{ 0, 1, 0, "y-axis" }, { 0, 1, 0, "y-axis" },
{ 0, 0, 1, "z-axis" }, { 0, 0, 1, "z-axis" },
{ 1, 1, 1, "ones" }, { 1, 1, 1, "ones" },
{ 9, 9, 9, "nines" } { 3, 3, 3, "threes" }
}; };
for (auto t: TESTS) { for (auto t: TESTS) {

View File

@ -198,9 +198,9 @@ main (void)
constexpr auto PI2 = 2 * cruft::pi<float>; constexpr auto PI2 = 2 * cruft::pi<float>;
auto matrix = ( auto matrix = (
cruft::quaternionf::angle_axis (t.euler[2], { 0, 0, 1 }) * cruft::quaternionf::angle_axis (std::fmod (t.euler[2], PI2), { 0, 0, 1 }) *
cruft::quaternionf::angle_axis (t.euler[1], { 0, 1, 0 }) * cruft::quaternionf::angle_axis (std::fmod (t.euler[1], PI2), { 0, 1, 0 }) *
cruft::quaternionf::angle_axis (t.euler[0], { 1, 0, 0 }) cruft::quaternionf::angle_axis (std::fmod (t.euler[0], PI2), { 1, 0, 0 })
).as_matrix (); ).as_matrix ();
auto euler = to_euler (matrix); auto euler = to_euler (matrix);