This commit is contained in:
Christophe Riccio
2017-08-25 15:11:40 +02:00
7 changed files with 106 additions and 72 deletions

View File

@@ -225,16 +225,28 @@ int test_quat_mul()
int test_quat_two_axis_ctr()
{
int Error(0);
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);
glm::quat const q1(glm::vec3(1, 0, 0), glm::vec3(0, 1, 0));
glm::vec3 const 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);
glm::quat const q2 = q1 * q1;
glm::vec3 const v2 = q2 * glm::vec3(1, 0, 0);
Error += glm::all(glm::epsilonEqual(v2, glm::vec3(-1, 0, 0), 0.0001f)) ? 0 : 1;
glm::quat const q3(glm::vec3(1, 0, 0), glm::vec3(-1, 0, 0));
glm::vec3 const v3 = q3 * glm::vec3(1, 0, 0);
Error += glm::all(glm::epsilonEqual(v3, glm::vec3(-1, 0, 0), 0.0001f)) ? 0 : 1;
glm::quat const q4(glm::vec3(0, 1, 0), glm::vec3(0, -1, 0));
glm::vec3 const v4 = q4 * glm::vec3(0, 1, 0);
Error += glm::all(glm::epsilonEqual(v4, glm::vec3(0, -1, 0), 0.0001f)) ? 0 : 1;
glm::quat const q5(glm::vec3(0, 0, 1), glm::vec3(0, 0, -1));
glm::vec3 const v5 = q5 * glm::vec3(0, 0, 1);
Error += glm::all(glm::epsilonEqual(v5, glm::vec3(0, 0, -1), 0.0001f)) ? 0 : 1;
return Error;
}

View File

@@ -1,4 +1,5 @@
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtx/extended_min_max.hpp>
#include <glm/gtc/vec1.hpp>
#include <glm/gtc/epsilon.hpp>
@@ -18,6 +19,9 @@ namespace fmin_
glm::vec1 A0 = glm::fmin(glm::vec1(1), glm::vec1(Zero_f / 0.0f));
Error += glm::epsilonEqual(A0.x, 1.0f, glm::epsilon<float>()) ? 0 : 1;
glm::vec1 A1 = glm::fmin(glm::vec1(Zero_f / 0.0f), glm::vec1(1));
Error += glm::epsilonEqual(A1.x, 1.0f, glm::epsilon<float>()) ? 0 : 1;
glm::vec2 B0 = glm::fmin(glm::vec2(1), glm::vec2(1));
glm::vec2 B1 = glm::fmin(glm::vec2(1), 1.0f);
bool B2 = glm::all(glm::equal(B0, B1));
@@ -47,6 +51,9 @@ namespace fmax_
glm::vec1 A0 = glm::fmax(glm::vec1(1), glm::vec1(Zero_f / 0.0f));
Error += glm::epsilonEqual(A0.x, 1.0f, glm::epsilon<float>()) ? 0 : 1;
glm::vec1 A1 = glm::fmax(glm::vec1(Zero_f / 0.0f), glm::vec1(1));
Error += glm::epsilonEqual(A0.x, 1.0f, glm::epsilon<float>()) ? 0 : 1;
glm::vec2 B0 = glm::fmax(glm::vec2(1), glm::vec2(1));
glm::vec2 B1 = glm::fmax(glm::vec2(1), 1.0f);
bool B2 = glm::all(glm::equal(B0, B1));