norm.hpp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /// @ref gtx_norm
  2. /// @file glm/gtx/norm.hpp
  3. ///
  4. /// @see core (dependence)
  5. /// @see gtx_quaternion (dependence)
  6. ///
  7. /// @defgroup gtx_norm GLM_GTX_norm
  8. /// @ingroup gtx
  9. ///
  10. /// Include <glm/gtx/norm.hpp> to use the features of this extension.
  11. ///
  12. /// Various ways to compute vector norms.
  13. #pragma once
  14. // Dependency:
  15. #include "../geometric.hpp"
  16. #include "../gtx/quaternion.hpp"
  17. #ifndef GLM_ENABLE_EXPERIMENTAL
  18. # error "GLM: GLM_GTX_norm 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."
  19. #endif
  20. #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  21. # pragma message("GLM: GLM_GTX_norm extension included")
  22. #endif
  23. namespace glm
  24. {
  25. /// @addtogroup gtx_norm
  26. /// @{
  27. /// Returns the squared length of x.
  28. /// From GLM_GTX_norm extension.
  29. template<length_t L, typename T, qualifier Q>
  30. GLM_FUNC_DECL T length2(vec<L, T, Q> const& x);
  31. /// Returns the squared distance between p0 and p1, i.e., length2(p0 - p1).
  32. /// From GLM_GTX_norm extension.
  33. template<length_t L, typename T, qualifier Q>
  34. GLM_FUNC_DECL T distance2(vec<L, T, Q> const& p0, vec<L, T, Q> const& p1);
  35. //! Returns the L1 norm between x and y.
  36. //! From GLM_GTX_norm extension.
  37. template<typename T, qualifier Q>
  38. GLM_FUNC_DECL T l1Norm(vec<3, T, Q> const& x, vec<3, T, Q> const& y);
  39. //! Returns the L1 norm of v.
  40. //! From GLM_GTX_norm extension.
  41. template<typename T, qualifier Q>
  42. GLM_FUNC_DECL T l1Norm(vec<3, T, Q> const& v);
  43. //! Returns the L2 norm between x and y.
  44. //! From GLM_GTX_norm extension.
  45. template<typename T, qualifier Q>
  46. GLM_FUNC_DECL T l2Norm(vec<3, T, Q> const& x, vec<3, T, Q> const& y);
  47. //! Returns the L2 norm of v.
  48. //! From GLM_GTX_norm extension.
  49. template<typename T, qualifier Q>
  50. GLM_FUNC_DECL T l2Norm(vec<3, T, Q> const& x);
  51. //! Returns the L norm between x and y.
  52. //! From GLM_GTX_norm extension.
  53. template<typename T, qualifier Q>
  54. GLM_FUNC_DECL T lxNorm(vec<3, T, Q> const& x, vec<3, T, Q> const& y, unsigned int Depth);
  55. //! Returns the L norm of v.
  56. //! From GLM_GTX_norm extension.
  57. template<typename T, qualifier Q>
  58. GLM_FUNC_DECL T lxNorm(vec<3, T, Q> const& x, unsigned int Depth);
  59. /// @}
  60. }//namespace glm
  61. #include "norm.inl"