vector_angle.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  21. # ifndef GLM_ENABLE_EXPERIMENTAL
  22. # pragma message("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.")
  23. # else
  24. # pragma message("GLM: GLM_GTX_vector_angle extension included")
  25. # endif
  26. #endif
  27. namespace glm
  28. {
  29. /// @addtogroup gtx_vector_angle
  30. /// @{
  31. //! Returns the absolute angle between two vectors.
  32. //! Parameters need to be normalized.
  33. /// @see gtx_vector_angle extension.
  34. template<length_t L, typename T, qualifier Q>
  35. GLM_FUNC_DECL T angle(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
  36. //! Returns the oriented angle between two 2d vectors.
  37. //! Parameters need to be normalized.
  38. /// @see gtx_vector_angle extension.
  39. template<typename T, qualifier Q>
  40. GLM_FUNC_DECL T orientedAngle(vec<2, T, Q> const& x, vec<2, T, Q> const& y);
  41. //! Returns the oriented angle between two 3d vectors based from a reference axis.
  42. //! Parameters need to be normalized.
  43. /// @see gtx_vector_angle extension.
  44. template<typename T, qualifier Q>
  45. GLM_FUNC_DECL T orientedAngle(vec<3, T, Q> const& x, vec<3, T, Q> const& y, vec<3, T, Q> const& ref);
  46. /// @}
  47. }// namespace glm
  48. #include "vector_angle.inl"