diff --git a/test/gtx/gtx_intersect.cpp b/test/gtx/gtx_intersect.cpp index 10217cd0..83401913 100644 --- a/test/gtx/gtx_intersect.cpp +++ b/test/gtx/gtx_intersect.cpp @@ -57,12 +57,26 @@ int test_LineLineProper() { return Error; } +int test_overlapSegment() { + int Error(0); + + Error += !overlapSegment(vec2(0, 1), vec2(2, 1), vec2(1, 1), vec2(1, 2)) ? 0 : 1; + Error += !overlapSegment(vec2(0, 1), vec2(2, 1), vec2(1, 2), vec2(1, 1)) ? 0 : 1; + Error += !overlapSegment(vec2(0, 0), vec2(0, 1), vec2(0, 1), vec2(0, 2)) ? 0 : 1; + Error += overlapSegment(vec2(0, 0), vec2(0, 1), vec2(0, 0.5), vec2(0, 2)) ? 0 : 1; + Error += overlapSegment(vec2(0.5, 1), vec2(2, 2.5), vec2(1, 1.5), vec2(1.5, 2)) ? 0 : 1; + Error += !overlapSegment(vec2(0.5, 1), vec2(2, 2.5), vec2(1, 1.51), vec2(1.5, 2)) ? 0 : 1; + + return Error; +} + int main() { int Error(0); Error += test_LineLine(); Error += test_LineLineProper(); + Error += test_overlapSegment(); return Error; } diff --git a/test/gtx/gtx_vector_query.cpp b/test/gtx/gtx_vector_query.cpp index 7668c152..2d74ed8b 100644 --- a/test/gtx/gtx_vector_query.cpp +++ b/test/gtx/gtx_vector_query.cpp @@ -55,6 +55,16 @@ int test_areCollinear() Error += TestA ? 0 : 1; } + { + bool TestA = glm::areCollinear(glm::vec2(0, 0), glm::vec2(1, 1), glm::vec2(2, 2)); + Error += TestA ? 0 : 1; + } + + { + bool TestA = glm::areCollinear(glm::vec2(0, 0), glm::vec2(1, 1), glm::vec2(4, 2)); + Error += !TestA ? 0 : 1; + } + return Error; }