From 30ab2ee25b3cca238a26c56a1baab9b2465659c8 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 5 Mar 2016 23:36:18 +0100 Subject: [PATCH 1/6] Fixed polar coordinates function latitude #485 --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index a044dd14..e3a5e421 100644 --- a/readme.md +++ b/readme.md @@ -54,6 +54,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) #### [GLM 0.9.7.4](https://github.com/g-truc/glm/tree/0.9.7) - 2016-XX-XX ##### Fixes: - Fixed asinh and atanh warning with C++98 STL #484 +- Fixed polar coordinates function latitude #485 #### [GLM 0.9.7.3](https://github.com/g-truc/glm/releases/tag/0.9.7.3) - 2016-02-21 ##### Improvements: From eb33d9c18829b414071fb9f3c22bf02e7f30cfb7 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 5 Mar 2016 23:20:12 +0100 Subject: [PATCH 2/6] - Fixed outerProduct defintions and operator signatures for mat2x4 and vec4 #475 --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index e3a5e421..fb63f4c1 100644 --- a/readme.md +++ b/readme.md @@ -55,6 +55,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) ##### Fixes: - Fixed asinh and atanh warning with C++98 STL #484 - Fixed polar coordinates function latitude #485 +- Fixed outerProduct defintions and operator signatures for mat2x4 and vec4 #475 #### [GLM 0.9.7.3](https://github.com/g-truc/glm/releases/tag/0.9.7.3) - 2016-02-21 ##### Improvements: From 2d813b587a1e5cd954ead889b89f91dcd68250c6 Mon Sep 17 00:00:00 2001 From: sippeangelo Date: Wed, 16 Dec 2015 15:57:29 +0100 Subject: [PATCH 3/6] This fixes #461 --- glm/gtc/quaternion.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 83a1b66f..043a6a1b 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -597,7 +597,7 @@ namespace detail template GLM_FUNC_QUALIFIER T yaw(tquat const & q) { - return asin(T(-2) * (q.x * q.z - q.w * q.y)); + return asin(clamp(T(-2) * (q.x * q.z - q.w * q.y), T(-1), T(1))); } template From 8e411733b23f3bdb46b91e255156f738222f1fec Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sat, 5 Mar 2016 23:49:07 +0100 Subject: [PATCH 4/6] - Fixed eulerAngles precision error, returns NaN #451 --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index fb63f4c1..f464a4a3 100644 --- a/readme.md +++ b/readme.md @@ -56,6 +56,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) - Fixed asinh and atanh warning with C++98 STL #484 - Fixed polar coordinates function latitude #485 - Fixed outerProduct defintions and operator signatures for mat2x4 and vec4 #475 +- Fixed eulerAngles precision error, returns NaN #451 #### [GLM 0.9.7.3](https://github.com/g-truc/glm/releases/tag/0.9.7.3) - 2016-02-21 ##### Improvements: From b3b72527b13173bddb4a8377bfdc61a9003cfaf6 Mon Sep 17 00:00:00 2001 From: Paul Konstantin Gerke Date: Sun, 24 Jan 2016 19:34:26 +0100 Subject: [PATCH 5/6] Fixed: operator signatures of mat2x4 and vec4 (no guaratees that I found all issues) --- glm/detail/type_mat2x4.hpp | 2 +- glm/detail/type_mat2x4.inl | 2 +- glm/detail/type_vec4.hpp | 8 ++++---- glm/detail/type_vec4.inl | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index 8e3c616a..b06ae7c6 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -192,7 +192,7 @@ namespace glm GLM_FUNC_DECL tmat3x4 operator*(tmat2x4 const & m1, tmat3x2 const & m2); template - GLM_FUNC_DECL tmat2x4 operator/(tmat2x4 const & m, T s); + GLM_FUNC_DECL tmat2x4 operator/(tmat2x4 const & m, const T& s); template GLM_FUNC_DECL tmat2x4 operator/(T s, tmat2x4 const & m); diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index 42299787..cac649f6 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -493,7 +493,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tmat2x4 operator/(tmat2x4 const & m, T s) + GLM_FUNC_QUALIFIER tmat2x4 operator/(tmat2x4 const & m, const T& s) { return tmat2x4( m[0] / s, diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index e9fe6c1d..e941b766 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -360,7 +360,7 @@ namespace detail // -- Binary operators -- template - GLM_FUNC_DECL tvec4 operator+(tvec4 const & v, T scalar); + GLM_FUNC_DECL tvec4 operator+(tvec4 const & v, const T& scalar); template GLM_FUNC_DECL tvec4 operator+(tvec4 const & v, tvec1 const & scalar); @@ -375,7 +375,7 @@ namespace detail GLM_FUNC_DECL tvec4 operator+(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator-(tvec4 const & v, T scalar); + GLM_FUNC_DECL tvec4 operator-(tvec4 const & v, const T& scalar); template GLM_FUNC_DECL tvec4 operator-(tvec4 const & v, tvec1 const & scalar); @@ -390,7 +390,7 @@ namespace detail GLM_FUNC_DECL tvec4 operator-(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, T scalar); + GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, const T& scalar); template GLM_FUNC_DECL tvec4 operator*(tvec4 const & v, tvec1 const & scalar); @@ -405,7 +405,7 @@ namespace detail GLM_FUNC_DECL tvec4 operator*(tvec4 const & v1, tvec4 const & v2); template - GLM_FUNC_DECL tvec4 operator/(tvec4 const & v, T scalar); + GLM_FUNC_DECL tvec4 operator/(tvec4 const & v, const T& scalar); template GLM_FUNC_DECL tvec4 operator/(tvec4 const & v, tvec1 const & scalar); diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 8e215d00..5927d99e 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -664,7 +664,7 @@ namespace glm // -- Binary arithmetic operators -- template - GLM_FUNC_QUALIFIER tvec4 operator+(tvec4 const & v, T scalar) + GLM_FUNC_QUALIFIER tvec4 operator+(tvec4 const & v, const T& scalar) { return tvec4( v.x + scalar, @@ -694,7 +694,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec4 operator-(tvec4 const & v, T scalar) + GLM_FUNC_QUALIFIER tvec4 operator-(tvec4 const & v, const T& scalar) { return tvec4( v.x - scalar, @@ -724,7 +724,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec4 operator*(tvec4 const & v, T scalar) + GLM_FUNC_QUALIFIER tvec4 operator*(tvec4 const & v, const T& scalar) { return tvec4( v.x * scalar, @@ -754,7 +754,7 @@ namespace glm } template - GLM_FUNC_QUALIFIER tvec4 operator/(tvec4 const & v, T scalar) + GLM_FUNC_QUALIFIER tvec4 operator/(tvec4 const & v, const T& scalar) { return tvec4( v.x / scalar, From 239cf70ade606cb03b922d4290057f554d56b088 Mon Sep 17 00:00:00 2001 From: Paul Konstantin Gerke Date: Sun, 24 Jan 2016 21:14:25 +0100 Subject: [PATCH 6/6] Fixed: outerProduct was defined incorrectly for unmatched vecX types. E.g. outerProduct(vec2, vec4) did not succeed because the matrix return types were wrong. The computing function seemed fine. I used https://en.wikipedia.org/wiki/Outer_product as reference on what the number of columns/rows ''should'' be and fixed it so that it matches the description from wikipedia Added: tests for outerProduct with unmatched vector dimensions (actually testing all combinations now) --- glm/detail/func_matrix.hpp | 12 ++++++------ test/core/core_func_matrix.cpp | 13 ++++++++++++- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/glm/detail/func_matrix.hpp b/glm/detail/func_matrix.hpp index 5a9cb11f..56d16d2b 100644 --- a/glm/detail/func_matrix.hpp +++ b/glm/detail/func_matrix.hpp @@ -72,19 +72,19 @@ namespace detail template struct outerProduct_trait { - typedef tmat2x3 type; + typedef tmat3x2 type; }; template struct outerProduct_trait { - typedef tmat2x4 type; + typedef tmat4x2 type; }; template struct outerProduct_trait { - typedef tmat3x2 type; + typedef tmat2x3 type; }; template @@ -96,19 +96,19 @@ namespace detail template struct outerProduct_trait { - typedef tmat3x4 type; + typedef tmat4x3 type; }; template struct outerProduct_trait { - typedef tmat4x2 type; + typedef tmat2x4 type; }; template struct outerProduct_trait { - typedef tmat4x3 type; + typedef tmat3x4 type; }; template diff --git a/test/core/core_func_matrix.cpp b/test/core/core_func_matrix.cpp index add5dfd9..80562e0f 100644 --- a/test/core/core_func_matrix.cpp +++ b/test/core/core_func_matrix.cpp @@ -101,7 +101,18 @@ int test_matrixCompMult() int test_outerProduct() { - glm::mat4 m = glm::outerProduct(glm::vec4(1.0f), glm::vec4(1.0f)); + { glm::mat2 m = glm::outerProduct(glm::vec2(1.0f), glm::vec2(1.0f)); } + { glm::mat3 m = glm::outerProduct(glm::vec3(1.0f), glm::vec3(1.0f)); } + { glm::mat4 m = glm::outerProduct(glm::vec4(1.0f), glm::vec4(1.0f)); } + + { glm::mat2x3 m = glm::outerProduct(glm::vec3(1.0f), glm::vec2(1.0f)); } + { glm::mat2x4 m = glm::outerProduct(glm::vec4(1.0f), glm::vec2(1.0f)); } + + { glm::mat3x2 m = glm::outerProduct(glm::vec2(1.0f), glm::vec3(1.0f)); } + { glm::mat3x4 m = glm::outerProduct(glm::vec4(1.0f), glm::vec3(1.0f)); } + + { glm::mat4x2 m = glm::outerProduct(glm::vec2(1.0f), glm::vec4(1.0f)); } + { glm::mat4x3 m = glm::outerProduct(glm::vec3(1.0f), glm::vec4(1.0f)); } return 0; }