mirror of
https://github.com/g-truc/glm.git
synced 2024-11-29 11:24:35 +00:00
Merge pull request #1047 from gottfriedleibniz/patch/is_identity
fix: isIdentity for non-symmetric matrices #1047
This commit is contained in:
commit
3a25105d86
@ -33,13 +33,13 @@ namespace glm
|
|||||||
GLM_FUNC_QUALIFIER bool isIdentity(mat<C, R, T, Q> const& m, T const& epsilon)
|
GLM_FUNC_QUALIFIER bool isIdentity(mat<C, R, T, Q> const& m, T const& epsilon)
|
||||||
{
|
{
|
||||||
bool result = true;
|
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;
|
result = abs(m[i][j]) <= epsilon;
|
||||||
if(result)
|
if(result && i < m[0].length())
|
||||||
result = abs(m[i][i] - 1) <= epsilon;
|
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;
|
result = abs(m[i][j]) <= epsilon;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user