From c068f22329d5cc722622a2183bbb22eef2093df7 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Mon, 24 Aug 2026 11:16:07 +0200 Subject: initial import --- src/libraries/glm/gtx/matrix_query.inl | 154 +++++++++++++++++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100755 src/libraries/glm/gtx/matrix_query.inl (limited to 'src/libraries/glm/gtx/matrix_query.inl') diff --git a/src/libraries/glm/gtx/matrix_query.inl b/src/libraries/glm/gtx/matrix_query.inl new file mode 100755 index 0000000..52eabe9 --- /dev/null +++ b/src/libraries/glm/gtx/matrix_query.inl @@ -0,0 +1,154 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-03-05 +// Updated : 2007-03-05 +// Licence : This source is under MIT License +// File : glm/gtx/matrix_query.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + template + GLM_FUNC_QUALIFIER bool isNull + ( + detail::tmat2x2 const & m, + T const & epsilon) + { + bool result = true; + for(int i = 0; result && i < 2 ; ++i) + result = isNull(m[i], epsilon); + return result; + } + + template + GLM_FUNC_QUALIFIER bool isNull + ( + detail::tmat3x3 const & m, + T const & epsilon + ) + { + bool result = true; + for(int i = 0; result && i < 3 ; ++i) + result = isNull(m[i], epsilon); + return result; + } + + template + GLM_FUNC_QUALIFIER bool isNull + ( + detail::tmat4x4 const & m, + T const & epsilon + ) + { + bool result = true; + for(int i = 0; result && i < 4 ; ++i) + result = isNull(m[i], epsilon); + return result; + } + + template + GLM_FUNC_QUALIFIER bool isIdentity + ( + genType const & m, + typename genType::value_type const & epsilon + ) + { + bool result = true; + for(typename genType::size_type i = typename genType::size_type(0); result && i < genType::col_size(); ++i) + { + for(typename genType::size_type j = typename genType::size_type(0); result && j < i ; ++j) + result = abs(m[i][j]) <= epsilon; + if(result) + result = abs(m[i][i] - typename genType::value_type(1)) <= epsilon; + for(typename genType::size_type j = i + typename genType::size_type(1); result && j < genType::row_size(); ++j) + result = abs(m[i][j]) <= epsilon; + } + return result; + } + + template + GLM_FUNC_QUALIFIER bool isNormalized + ( + detail::tmat2x2 const & m, + genType const & epsilon + ) + { + bool result(true); + for(typename detail::tmat2x2::size_type i(0); result && i < m.length(); ++i) + result = isNormalized(m[i], epsilon); + for(typename detail::tmat2x2::size_type i(0); result && i < m.length(); ++i) + { + typename detail::tmat2x2::col_type v; + for(typename detail::tmat2x2::size_type j(0); j < m.length(); ++j) + v[j] = m[j][i]; + result = isNormalized(v, epsilon); + } + return result; + } + + template + GLM_FUNC_QUALIFIER bool isNormalized + ( + detail::tmat3x3 const & m, + genType const & epsilon + ) + { + bool result(true); + for(typename detail::tmat3x3::size_type i(0); result && i < m.length(); ++i) + result = isNormalized(m[i], epsilon); + for(typename detail::tmat3x3::size_type i(0); result && i < m.length(); ++i) + { + typename detail::tmat3x3::col_type v; + for(typename detail::tmat3x3::size_type j(0); j < m.length(); ++j) + v[j] = m[j][i]; + result = isNormalized(v, epsilon); + } + return result; + } + + template + GLM_FUNC_QUALIFIER bool isNormalized + ( + detail::tmat4x4 const & m, + genType const & epsilon + ) + { + bool result(true); + for(typename detail::tmat4x4::size_type i(0); result && i < m.length(); ++i) + result = isNormalized(m[i], epsilon); + for(typename detail::tmat4x4::size_type i(0); result && i < m.length(); ++i) + { + typename detail::tmat4x4::col_type v; + for(typename detail::tmat4x4::size_type j(0); j < m.length(); ++j) + v[j] = m[j][i]; + result = isNormalized(v, epsilon); + } + return result; + } + + template class matType> + GLM_FUNC_QUALIFIER bool isOrthogonal + ( + matType const & m, + genType const & epsilon + ) + { + bool result(true); + for(typename matType::size_type i(0); result && i < m.length() - 1; ++i) + for(typename matType::size_type j(i + 1); result && j < m.length(); ++j) + result = areOrthogonal(m[i], m[j], epsilon); + + if(result) + { + matType tmp = transpose(m); + for(typename matType::size_type i(0); result && i < m.length() - 1 ; ++i) + for(typename matType::size_type j(i + 1); result && j < m.length(); ++j) + result = areOrthogonal(tmp[i], tmp[j], epsilon); + } + return result; + } +}//namespace glm -- cgit v1.2.3