Skip to content

Commit

Permalink
gni
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe-lunarg committed Jan 15, 2024
1 parent d2f9d8b commit ea58e55
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/gtc/gtc_quaternion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ static int test_quat_slerp()
// Testing standard, easy case
// Must be 45 degrees rotation on Y : 0 0.38 0 0.92
glm::quat Y45rot1 = glm::slerp(id, Y90rot, 0.5f);
Error += glm::all(glm::equal(Y45rot1, glm::quat(0.924f, 0.0f, 0.383f, 0.0f), 0.01f)) ? 0 : 1;

// Testing reverse case
// Must be 45 degrees rotation on Y : 0 0.38 0 0.92
Expand Down Expand Up @@ -181,6 +182,7 @@ static int test_quat_slerp()
// Testing almost equal quaternions (this test should pass through the linear interpolation)
// Must be 0 0.00X 0 0.99999
glm::quat almostid = glm::slerp(id, glm::angleAxis(0.1f, glm::vec3(0.0f, 1.0f, 0.0f)), 0.5f);
Error += glm::all(glm::equal(almostid, glm::quat(1.0f, 0.0f, 0.0f, 0.0f), 0.1f)) ? 0 : 1;

// Testing quaternions with opposite sign
{
Expand Down Expand Up @@ -295,9 +297,11 @@ static int test_mul()

glm::vec3 transformed0 = (temp1 * glm::vec3(0.0, 1.0, 0.0) * glm::inverse(temp1));
glm::vec3 temp4 = temp2 * transformed0 * glm::inverse(temp2);
Error += glm::all(glm::equal(temp4, glm::vec3(0.0f, -0.28f, -0.96f), 0.01f)) ? 0 : 1;

glm::quat temp5 = glm::normalize(temp1 * temp2);
glm::vec3 temp6 = temp5 * glm::vec3(0.0, 1.0, 0.0) * glm::inverse(temp5);
Error += glm::all(glm::equal(temp6, glm::vec3(-0.48f, 0.36f, -0.8f), 0.01f)) ? 0 : 1;

glm::quat temp7(1.0f, glm::vec3(0.0, 1.0, 0.0));

Expand Down

0 comments on commit ea58e55

Please sign in to comment.