Added initializer lists

This commit is contained in:
Christophe Riccio
2013-09-29 19:44:59 +02:00
parent 5d7c896a3f
commit 71855943e0
12 changed files with 197 additions and 0 deletions

View File

@@ -197,6 +197,37 @@ int test_quat_slerp()
return Error;
}
int test_quat_mul()
{
int Error(0);
glm::quat temp1 = glm::normalize(glm::quat(1.0f, glm::vec3(0.0, 1.0, 0.0)));
glm::quat temp2 = glm::normalize(glm::quat(0.5f, glm::vec3(1.0, 0.0, 0.0)));
glm::vec3 transformed0 = (temp1 * glm::vec3(0.0, 1.0, 0.0) * glm::inverse(temp1));
glm::vec3 temp4 = temp2 * transformed0 * glm::inverse(temp2);
glm::quat temp5 = glm::normalize(temp1 * temp2);
glm::vec3 temp6 = temp5 * glm::vec3(0.0, 1.0, 0.0) * glm::inverse(temp5);
return Error;
}
int test_quat_two_axis_ctr()
{
int Error(0);
glm::quat q1(glm::vec3(1, 0, 0), glm::vec3(0, 1, 0));
glm::vec3 v1 = q1 * glm::vec3(1, 0, 0);
Error += glm::all(glm::epsilonEqual(v1, glm::vec3(0, 1, 0), 0.0001f)) ? 0 : 1;
glm::quat q2 = q1 * q1;
glm::vec3 v2 = q2 * glm::vec3(1, 0, 0);
Error += glm::all(glm::epsilonEqual(v2, glm::vec3(-1, 0, 0), 0.0001f)) ? 0 : 1;
return Error;
}
int test_quat_type()
{
glm::quat A;
@@ -209,6 +240,8 @@ int main()
{
int Error(0);
Error += test_quat_two_axis_ctr();
Error += test_quat_mul();
Error += test_quat_precision();
Error += test_quat_type();
Error += test_quat_angle();