vector_angle.hpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /// @ref gtx_vector_angle
  2. /// @file glm/gtx/vector_angle.hpp
  3. ///
  4. /// @see core (dependence)
  5. /// @see gtx_quaternion (dependence)
  6. /// @see gtx_epsilon (dependence)
  7. ///
  8. /// @defgroup gtx_vector_angle GLM_GTX_vector_angle
  9. /// @ingroup gtx
  10. ///
  11. /// Include <glm/gtx/vector_angle.hpp> to use the features of this extension.
  12. ///
  13. /// Compute angle between vectors
  14. #pragma once
  15. // Dependency:
  16. #include "../glm.hpp"
  17. #include "../gtc/epsilon.hpp"
  18. #include "../gtx/quaternion.hpp"
  19. #include "../gtx/rotate_vector.hpp"
  20. #ifndef GLM_ENABLE_EXPERIMENTAL
  21. # error "GLM: GLM_GTX_vector_angle is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."
  22. #endif
  23. #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  24. # pragma message("GLM: GLM_GTX_vector_angle extension included")
  25. #endif
  26. namespace glm
  27. {
  28. /// @addtogroup gtx_vector_angle
  29. /// @{
  30. //! Returns the absolute angle between two vectors.
  31. //! Parameters need to be normalized.
  32. /// @see gtx_vector_angle extension.
  33. template<length_t L, typename T, qualifier Q>
  34. GLM_FUNC_DECL T angle(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
  35. //! Returns the oriented angle between two 2d vectors.
  36. //! Parameters need to be normalized.
  37. /// @see gtx_vector_angle extension.
  38. template<typename T, qualifier Q>
  39. GLM_FUNC_DECL T orientedAngle(vec<2, T, Q> const& x, vec<2, T, Q> const& y);
  40. //! Returns the oriented angle between two 3d vectors based from a reference axis.
  41. //! Parameters need to be normalized.
  42. /// @see gtx_vector_angle extension.
  43. template<typename T, qualifier Q>
  44. GLM_FUNC_DECL T orientedAngle(vec<3, T, Q> const& x, vec<3, T, Q> const& y, vec<3, T, Q> const& ref);
  45. /// @}
  46. }// namespace glm
  47. #include "vector_angle.inl"