Added short and fast slerp tests
This commit is contained in:
parent
d082ecf8a3
commit
9b8783d3c3
@ -2,7 +2,7 @@
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2011-05-25
|
||||
// Updated : 2011-05-25
|
||||
// Updated : 2011-05-31
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/quaternion.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -11,6 +11,40 @@
|
||||
#include <glm/gtx/quaternion.hpp>
|
||||
#include <glm/gtx/epsilon.hpp>
|
||||
|
||||
int test_quat_fastMix()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
glm::quat A = glm::angleAxis(0.0f, glm::vec3(0, 0, 1));
|
||||
glm::quat B = glm::angleAxis(90.0f, glm::vec3(0, 0, 1));
|
||||
glm::quat C = glm::fastMix(A, B, 0.5f);
|
||||
glm::quat D = glm::angleAxis(45.0f, glm::vec3(0, 0, 1));
|
||||
|
||||
Error += glm::equalEpsilon(C.x, D.x, 0.01f) ? 0 : 1;
|
||||
Error += glm::equalEpsilon(C.y, D.y, 0.01f) ? 0 : 1;
|
||||
Error += glm::equalEpsilon(C.z, D.z, 0.01f) ? 0 : 1;
|
||||
Error += glm::equalEpsilon(C.w, D.w, 0.01f) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_quat_shortMix()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
glm::quat A = glm::angleAxis(0.0f, glm::vec3(0, 0, 1));
|
||||
glm::quat B = glm::angleAxis(90.0f, glm::vec3(0, 0, 1));
|
||||
glm::quat C = glm::shortMix(A, B, 0.5f);
|
||||
glm::quat D = glm::angleAxis(45.0f, glm::vec3(0, 0, 1));
|
||||
|
||||
Error += glm::equalEpsilon(C.x, D.x, 0.01f) ? 0 : 1;
|
||||
Error += glm::equalEpsilon(C.y, D.y, 0.01f) ? 0 : 1;
|
||||
Error += glm::equalEpsilon(C.z, D.z, 0.01f) ? 0 : 1;
|
||||
Error += glm::equalEpsilon(C.w, D.w, 0.01f) ? 0 : 1;
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_quat_angleAxis()
|
||||
{
|
||||
int Error = 0;
|
||||
@ -66,6 +100,8 @@ int main()
|
||||
|
||||
Error += test_quat_angle();
|
||||
Error += test_quat_angleAxis();
|
||||
Error += test_quat_fastMix();
|
||||
Error += test_quat_shortMix();
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user