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_angle.inl | 57 ++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 src/libraries/glm/gtx/vector_angle.inl (limited to 'src/libraries/glm/gtx/vector_angle.inl') diff --git a/src/libraries/glm/gtx/vector_angle.inl b/src/libraries/glm/gtx/vector_angle.inl new file mode 100755 index 0000000..183f1c7 --- /dev/null +++ b/src/libraries/glm/gtx/vector_angle.inl @@ -0,0 +1,57 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2005-12-30 +// Updated : 2008-09-29 +// Licence : This source is under MIT License +// File : glm/gtx/vector_angle.inl +/////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace glm +{ + template + GLM_FUNC_QUALIFIER typename genType::value_type angle + ( + genType const & x, + genType const & y + ) + { + return degrees(acos(dot(x, y))); + } + + //! \todo epsilon is hard coded to 0.01 + template + GLM_FUNC_QUALIFIER valType orientedAngle + ( + detail::tvec2 const & x, + detail::tvec2 const & y + ) + { +#ifdef GLM_FORCE_RADIANS + valType const Angle(acos(dot(x, y))); +#else + valType const Angle(glm::degrees(acos(dot(x, y)))); +#endif + detail::tvec2 const TransformedVector(glm::rotate(x, Angle)); + if(all(epsilonEqual(y, TransformedVector, valType(0.01)))) + return Angle; + else + return -Angle; + } + + template + GLM_FUNC_QUALIFIER valType orientedAngle + ( + detail::tvec3 const & x, + detail::tvec3 const & y, + detail::tvec3 const & ref + ) + { + valType const Angle(glm::degrees(glm::acos(glm::dot(x, y)))); + + if(glm::dot(ref, glm::cross(x, y)) < valType(0)) + return -Angle; + else + return Angle; + } +}//namespace glm -- cgit v1.2.3