9
3

norm.hpp 2.6 KB

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