diff --git a/glm/gtx/rotate_vector.hpp b/glm/gtx/rotate_vector.hpp index 2b420772..ce51e245 100644 --- a/glm/gtx/rotate_vector.hpp +++ b/glm/gtx/rotate_vector.hpp @@ -36,37 +36,38 @@ namespace glm //! From GLM_GTX_rotate_vector extension. template detail::tvec2 rotate( - const detail::tvec2& v, - T angle); + detail::tvec2 const & v, + T const & angle); //! Rotate a three dimensional vector around an axis. //! From GLM_GTX_rotate_vector extension. template detail::tvec3 rotate( - const detail::tvec3& v, - T angle, - const detail::tvec3& normal); + detail::tvec3 const & v, + T const & angle, + detail::tvec3 const & normal); //! Rotate a four dimensional vector around an axis. //! From GLM_GTX_rotate_vector extension. template detail::tvec4 rotate( - const detail::tvec4& v, T angle, - const detail::tvec3& normal); + detail::tvec4 const & v, + T const & angle, + detail::tvec3 const & normal); //! Rotate a three dimensional vector around the X axis. //! From GLM_GTX_rotate_vector extension. template detail::tvec3 rotateX( - const detail::tvec3& v, - T angle); + detail::tvec3 const & v, + T const & angle); //! Rotate a three dimensional vector around the Y axis. //! From GLM_GTX_rotate_vector extension. template detail::tvec3 rotateY( - const detail::tvec3& v, - T angle); + detail::tvec3 const & v, + T const & angle); //! Rotate a three dimensional vector around the Z axis. //! From GLM_GTX_rotate_vector extension. diff --git a/test/gtx/CMakeLists.txt b/test/gtx/CMakeLists.txt index 941cfadc..fca74f16 100644 --- a/test/gtx/CMakeLists.txt +++ b/test/gtx/CMakeLists.txt @@ -1,7 +1,7 @@ glmCreateTestGTC(gtx_bit) glmCreateTestGTC(gtx_noise) +glmCreateTestGTC(gtx_rotate_vector) glmCreateTestGTC(gtx_simd_vec4) glmCreateTestGTC(gtx_simd_mat4) glmCreateTestGTC(gtx_ulp) glmCreateTestGTC(gtx_vector_angle) - diff --git a/test/gtx/gtx_rotate_vector.cpp b/test/gtx/gtx_rotate_vector.cpp new file mode 100644 index 00000000..256cab6e --- /dev/null +++ b/test/gtx/gtx_rotate_vector.cpp @@ -0,0 +1,95 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2011-05-16 +// Updated : 2011-05-16 +// Licence : This source is under MIT licence +// File : test/gtx/rotate_vector.cpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include +#include + +int test_rotate() +{ + int Error = 0; + + glm::vec2 A = glm::rotate(glm::vec2(1, 0), 90.f); + + glm::vec3 B = glm::rotate(glm::vec3(1, 0, 0), 90.f, glm::vec3(0, 0, 1)); + + glm::vec4 C = glm::rotate(glm::vec4(1, 0, 0, 1), 90.f, glm::vec3(0, 0, 1)); + + glm::vec3 D = glm::rotateX(glm::vec3(1, 0, 0), 90.f); + + glm::vec4 E = glm::rotateX(glm::vec4(1, 0, 0, 1), 90.f); + + glm::vec3 F = glm::rotateY(glm::vec3(1, 0, 0), 90.f); + + glm::vec4 G = glm::rotateY(glm::vec4(1, 0, 0, 1), 90.f); + + glm::vec3 H = glm::rotateZ(glm::vec3(1, 0, 0), 90.f); + + glm::vec4 I = glm::rotateZ(glm::vec4(1, 0, 0,1 ), 90.f); + + glm::mat4 O = glm::orientation(glm::normalize(glm::vec3(1)), glm::vec3(0, 0, 1)); + + return Error; +} + +int test_rotateX() +{ + int Error = 0; + + glm::vec3 D = glm::rotateX(glm::vec3(1, 0, 0), 90.f); + + glm::vec4 E = glm::rotateX(glm::vec4(1, 0, 0, 1), 90.f); + + return Error; +} + +int test_rotateY() +{ + int Error = 0; + + glm::vec3 F = glm::rotateY(glm::vec3(1, 0, 0), 90.f); + + glm::vec4 G = glm::rotateY(glm::vec4(1, 0, 0, 1), 90.f); + + return Error; +} + + +int test_rotateZ() +{ + int Error = 0; + + glm::vec3 H = glm::rotateZ(glm::vec3(1, 0, 0), 90.f); + + glm::vec4 I = glm::rotateZ(glm::vec4(1, 0, 0,1 ), 90.f); + + return Error; +} + +int test_orientation() +{ + int Error = 0; + + glm::mat4 O = glm::orientation(glm::normalize(glm::vec3(1)), glm::vec3(0, 0, 1)); + + return Error; +} + +int main() +{ + int Error = 0; + Error += test_rotate(); + Error += test_rotateX(); + Error += test_rotateY(); + Error += test_rotateZ(); + Error += test_orientation(); + + return Error; +} + +