Add test_isLeft to gtx_vector_query.cpp

This commit is contained in:
Jesse Talavera-Greenberg 2015-09-28 18:54:58 -04:00
parent 49aa226974
commit 47753b5826

View file

@ -34,6 +34,8 @@
#include <glm/vec4.hpp>
#include <glm/gtx/vector_query.hpp>
using namespace glm;
int test_areCollinear()
{
int Error(0);
@ -96,6 +98,18 @@ int test_areOrthonormal()
return Error;
}
int test_isLeft()
{
int Error(0);
Error += isLeft(vec2(1, 1), vec2(2.5, 2), vec2(1.305, 3.062)) ? 0 : 1;
Error += isLeft(vec2(1.278, 1.176), vec2(0.734, 2.257), vec2(0.5, 1.5)) ? 0 : 1;
Error += isLeft(vec2(1.183, 1.326), vec2(0.923, 0.695), vec2(2, 0)) ? 0 : 1;
Error += !isLeft(vec2(0.923, 0.695), vec2(1.183, 1.326), vec2(2, 0)) ? 0 : 1;
Error += isLeft(vec2(0, 0), vec2(1, 0), vec2(-1, 1)) ? 0 : 1;
return Error;
}
int main()
{
int Error(0);
@ -105,6 +119,7 @@ int main()
Error += test_isNormalized();
Error += test_isNull();
Error += test_areOrthonormal();
Error += test_isLeft();
return Error;
}