From 00c47203052bf50598869ecd74a5e8882e84cb3a Mon Sep 17 00:00:00 2001 From: Gottfried Leibniz <37632412+gottfriedleibniz@users.noreply.github.com> Date: Sun, 6 Dec 2020 11:26:14 -0400 Subject: [PATCH] fix: isIdentity for non-symmetric matrices --- glm/gtx/matrix_query.inl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glm/gtx/matrix_query.inl b/glm/gtx/matrix_query.inl index 77bd2310..b763c1ab 100644 --- a/glm/gtx/matrix_query.inl +++ b/glm/gtx/matrix_query.inl @@ -33,13 +33,13 @@ namespace glm GLM_FUNC_QUALIFIER bool isIdentity(mat const& m, T const& epsilon) { bool result = true; - for(length_t i = 0; result && i < m[0].length() ; ++i) + for(length_t i = 0; result && i < m.length(); ++i) { - for(length_t j = 0; result && j < i ; ++j) + for(length_t j = 0; result && j < glm::min(i, m[0].length()); ++j) result = abs(m[i][j]) <= epsilon; - if(result) + if(result && i < m[0].length()) result = abs(m[i][i] - 1) <= epsilon; - for(length_t j = i + 1; result && j < m.length(); ++j) + for(length_t j = i + 1; result && j < m[0].length(); ++j) result = abs(m[i][j]) <= epsilon; } return result;