From e5f8ebbfd70cc500fca10596e43e06801b805e3d Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 26 Dec 2013 20:38:28 +0100 Subject: [PATCH] Tests to reproduce bug #135, could not reproduce it --- test/gtx/gtx_spline.cpp | 88 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/test/gtx/gtx_spline.cpp b/test/gtx/gtx_spline.cpp index 0f410b9a..79b5698f 100644 --- a/test/gtx/gtx_spline.cpp +++ b/test/gtx/gtx_spline.cpp @@ -11,9 +11,97 @@ #include #include +namespace catmullRom +{ + int test() + { + int Error(0); + + glm::vec2 Result2 = glm::catmullRom( + glm::vec2(0.0f, 0.0f), + glm::vec2(1.0f, 0.0f), + glm::vec2(1.0f, 1.0f), + glm::vec2(0.0f, 1.0f), 0.5f); + + glm::vec3 Result3 = glm::catmullRom( + glm::vec3(0.0f, 0.0f, 0.0f), + glm::vec3(1.0f, 0.0f, 0.0f), + glm::vec3(1.0f, 1.0f, 0.0f), + glm::vec3(0.0f, 1.0f, 0.0f), 0.5f); + + glm::vec4 Result4 = glm::catmullRom( + glm::vec4(0.0f, 0.0f, 0.0f, 1.0f), + glm::vec4(1.0f, 0.0f, 0.0f, 1.0f), + glm::vec4(1.0f, 1.0f, 0.0f, 1.0f), + glm::vec4(0.0f, 1.0f, 0.0f, 1.0f), 0.5f); + + return Error; + } +}//catmullRom + +namespace hermite +{ + int test() + { + int Error(0); + + glm::vec2 Result2 = glm::hermite( + glm::vec2(0.0f, 0.0f), + glm::vec2(1.0f, 0.0f), + glm::vec2(1.0f, 1.0f), + glm::vec2(0.0f, 1.0f), 0.5f); + + glm::vec3 Result3 = glm::hermite( + glm::vec3(0.0f, 0.0f, 0.0f), + glm::vec3(1.0f, 0.0f, 0.0f), + glm::vec3(1.0f, 1.0f, 0.0f), + glm::vec3(0.0f, 1.0f, 0.0f), 0.5f); + + glm::vec4 Result4 = glm::hermite( + glm::vec4(0.0f, 0.0f, 0.0f, 1.0f), + glm::vec4(1.0f, 0.0f, 0.0f, 1.0f), + glm::vec4(1.0f, 1.0f, 0.0f, 1.0f), + glm::vec4(0.0f, 1.0f, 0.0f, 1.0f), 0.5f); + + return Error; + } +}//catmullRom + +namespace cubic +{ + int test() + { + int Error(0); + + glm::vec2 Result2 = glm::cubic( + glm::vec2(0.0f, 0.0f), + glm::vec2(1.0f, 0.0f), + glm::vec2(1.0f, 1.0f), + glm::vec2(0.0f, 1.0f), 0.5f); + + glm::vec3 Result3 = glm::cubic( + glm::vec3(0.0f, 0.0f, 0.0f), + glm::vec3(1.0f, 0.0f, 0.0f), + glm::vec3(1.0f, 1.0f, 0.0f), + glm::vec3(0.0f, 1.0f, 0.0f), 0.5f); + + glm::vec4 Result = glm::cubic( + glm::vec4(0.0f, 0.0f, 0.0f, 1.0f), + glm::vec4(1.0f, 0.0f, 0.0f, 1.0f), + glm::vec4(1.0f, 1.0f, 0.0f, 1.0f), + glm::vec4(0.0f, 1.0f, 0.0f, 1.0f), 0.5f); + + return Error; + } +}//catmullRom + int main() { int Error(0); + Error += catmullRom::test(); + Error += hermite::test(); + Error += cubic::test(); + return Error; }