Fixed ticket #153, vector and matrix queries

This commit is contained in:
Christophe Riccio
2011-12-06 12:22:43 +00:00
parent dd244d8d25
commit 7ff95df5e6
7 changed files with 115 additions and 54 deletions

View File

@@ -10,11 +10,33 @@
#include <glm/glm.hpp>
#include <glm/gtx/vector_query.hpp>
int test_isNull()
int test_areCollinear()
{
int Error(0);
{
bool TestA = glm::areCollinear(glm::vec2(-1), glm::vec2(1), 0.00001f);
Error += TestA ? 0 : 1;
}
{
bool TestA = glm::areCollinear(glm::vec3(-1), glm::vec3(1), 0.00001f);
Error += TestA ? 0 : 1;
}
{
bool TestA = glm::areCollinear(glm::vec4(-1), glm::vec4(1), 0.00001f);
Error += TestA ? 0 : 1;
}
return Error;
}
int test_areOrthogonal()
{
int Error(0);
bool TestA = glm::isNull(glm::vec4(0), 0.00001f);
bool TestA = glm::areOrthogonal(glm::vec2(1, 0), glm::vec2(0, 1), 0.00001f);
Error += TestA ? 0 : 1;
return Error;
@@ -30,11 +52,21 @@ int test_isNormalized()
return Error;
}
int test_areOrthogonal()
int test_isNull()
{
int Error(0);
bool TestA = glm::areOrthogonal(glm::vec2(1, 0), glm::vec2(0, 1), 0.00001f);
bool TestA = glm::isNull(glm::vec4(0), 0.00001f);
Error += TestA ? 0 : 1;
return Error;
}
int test_areOrthonormal()
{
int Error(0);
bool TestA = glm::areOrthonormal(glm::vec2(1, 0), glm::vec2(0, 1), 0.00001f);
Error += TestA ? 0 : 1;
return Error;
@@ -44,9 +76,11 @@ int main()
{
int Error(0);
Error += test_isNull();
Error += test_isNormalized();
Error += test_areCollinear();
Error += test_areOrthogonal();
Error += test_isNormalized();
Error += test_isNull();
Error += test_areOrthonormal();
return Error;
}