norm.hpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. #ifndef GLM_ENABLE_EXPERIMENTAL
  20. // # 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."
  21. #elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  22. # pragma message("GLM: GLM_GTX_norm extension included")
  23. #endif
  24. namespace glm
  25. {
  26. /// @addtogroup gtx_norm
  27. /// @{
  28. /// Returns the squared length of x.
  29. /// From GLM_GTX_norm extension.
  30. template<length_t L, typename T, qualifier Q>
  31. GLM_FUNC_DECL T length2(vec<L, T, Q> const& x);
  32. /// Returns the squared distance between p0 and p1, i.e., length2(p0 - p1).
  33. /// From GLM_GTX_norm extension.
  34. template<length_t L, typename T, qualifier Q>
  35. GLM_FUNC_DECL T distance2(vec<L, T, Q> const& p0, vec<L, T, Q> const& p1);
  36. //! Returns the L1 norm between x and y.
  37. //! From GLM_GTX_norm extension.
  38. template<typename T, qualifier Q>
  39. GLM_FUNC_DECL T l1Norm(vec<3, T, Q> const& x, vec<3, T, Q> const& y);
  40. //! Returns the L1 norm of v.
  41. //! From GLM_GTX_norm extension.
  42. template<typename T, qualifier Q>
  43. GLM_FUNC_DECL T l1Norm(vec<3, T, Q> const& v);
  44. //! Returns the L2 norm between x and y.
  45. //! From GLM_GTX_norm extension.
  46. template<typename T, qualifier Q>
  47. GLM_FUNC_DECL T l2Norm(vec<3, T, Q> const& x, vec<3, T, Q> const& y);
  48. //! Returns the L2 norm of v.
  49. //! From GLM_GTX_norm extension.
  50. template<typename T, qualifier Q>
  51. GLM_FUNC_DECL T l2Norm(vec<3, T, Q> const& x);
  52. //! Returns the L norm between x and y.
  53. //! From GLM_GTX_norm extension.
  54. template<typename T, qualifier Q>
  55. GLM_FUNC_DECL T lxNorm(vec<3, T, Q> const& x, vec<3, T, Q> const& y, unsigned int Depth);
  56. //! Returns the L norm of v.
  57. //! From GLM_GTX_norm extension.
  58. template<typename T, qualifier Q>
  59. GLM_FUNC_DECL T lxNorm(vec<3, T, Q> const& x, unsigned int Depth);
  60. //! Returns the LMax norm between x and y.
  61. //! From GLM_GTX_norm extension.
  62. template<typename T, qualifier Q>
  63. GLM_FUNC_DECL T lMaxNorm(vec<3, T, Q> const& x, vec<3, T, Q> const& y);
  64. //! Returns the LMax norm of v.
  65. //! From GLM_GTX_norm extension.
  66. template<typename T, qualifier Q>
  67. GLM_FUNC_DECL T lMaxNorm(vec<3, T, Q> const& x);
  68. /// @}
  69. }//namespace glm
  70. #include "norm.inl"