quaternion: ensure tests don't use >2PI radian parameters
This commit is contained in:
parent
5251c9b071
commit
5d0f879ad4
@ -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) {
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user