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/vector_query.inl | 164 +++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100755 src/libraries/glm/gtx/vector_query.inl (limited to 'src/libraries/glm/gtx/vector_query.inl') diff --git a/src/libraries/glm/gtx/vector_query.inl b/src/libraries/glm/gtx/vector_query.inl new file mode 100755 index 0000000..d0906e1 --- /dev/null +++ b/src/libraries/glm/gtx/vector_query.inl @@ -0,0 +1,164 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2007-03-05 +// Updated : 2010-02-16 +// Licence : This source is under MIT License +// File : glm/gtx/vector_query.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Dependency: +// - GLM core +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include + +namespace glm +{ + template + GLM_FUNC_QUALIFIER bool areCollinear + ( + detail::tvec2 const & v0, + detail::tvec2 const & v1, + typename detail::tvec2::value_type const & epsilon + ) + { + return length(cross(detail::tvec3(v0, T(0)), detail::tvec3(v1, T(0)))) < epsilon; + } + + template + GLM_FUNC_QUALIFIER bool areCollinear + ( + detail::tvec3 const & v0, + detail::tvec3 const & v1, + typename detail::tvec3::value_type const & epsilon + ) + { + return length(cross(v0, v1)) < epsilon; + } + + template + GLM_FUNC_QUALIFIER bool areCollinear + ( + detail::tvec4 const & v0, + detail::tvec4 const & v1, + typename detail::tvec4::value_type const & epsilon + ) + { + return length(cross(detail::tvec3(v0), detail::tvec3(v1))) < epsilon; + } + + template + GLM_FUNC_QUALIFIER bool areOrthogonal + ( + genType const & v0, + genType const & v1, + typename genType::value_type const & epsilon + ) + { + return abs(dot(v0, v1)) <= max( + typename genType::value_type(1), + length(v0)) * max( + typename genType::value_type(1), + length(v1)) * epsilon; + } + + template class vecType> + GLM_FUNC_QUALIFIER bool isNormalized + ( + vecType const & v, + genType const & epsilon + ) + { + return abs(length(v) - genType(1)) <= genType(2) * epsilon; + } + + template + GLM_FUNC_QUALIFIER bool isNull + ( + detail::tvec2 const & v, + valType const & epsilon + ) + { + return length(v) <= epsilon; + } + + template + GLM_FUNC_QUALIFIER bool isNull + ( + detail::tvec3 const & v, + valType const & epsilon + ) + { + return length(v) <= epsilon; + } + + template + GLM_FUNC_QUALIFIER bool isNull + ( + detail::tvec4 const & v, + valType const & epsilon + ) + { + return length(v) <= epsilon; + } + + template + GLM_FUNC_QUALIFIER bool isCompNull + ( + T const & s, + T const & epsilon + ) + { + return abs(s) < epsilon; + } + + template + GLM_FUNC_QUALIFIER detail::tvec2 isCompNull + ( + detail::tvec2 const & v, + T const & epsilon) + { + return detail::tvec2( + (abs(v.x) < epsilon), + (abs(v.y) < epsilon)); + } + + template + GLM_FUNC_QUALIFIER detail::tvec3 isCompNull + ( + detail::tvec3 const & v, + T const & epsilon + ) + { + return detail::tvec3( + abs(v.x) < epsilon, + abs(v.y) < epsilon, + abs(v.z) < epsilon); + } + + template + GLM_FUNC_QUALIFIER detail::tvec4 isCompNull + ( + detail::tvec4 const & v, + T const & epsilon + ) + { + return detail::tvec4( + abs(v.x) < epsilon, + abs(v.y) < epsilon, + abs(v.z) < epsilon, + abs(v.w) < epsilon); + } + + template + GLM_FUNC_QUALIFIER bool areOrthonormal + ( + genType const & v0, + genType const & v1, + typename genType::value_type const & epsilon + ) + { + return isNormalized(v0, epsilon) && isNormalized(v1, epsilon) && (abs(dot(v0, v1)) <= epsilon); + } + +}//namespace glm -- cgit v1.2.3