• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /// @brief Various ways to compute vector norms.
11 ///
12 /// <glm/gtx/norm.hpp> need to be included to use these functionalities.
13 
14 #pragma once
15 
16 // Dependency:
17 #include "../detail/func_geometric.hpp"
18 #include "../gtx/quaternion.hpp"
19 
20 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
21 #	pragma message("GLM: GLM_GTX_norm extension included")
22 #endif
23 
24 namespace glm
25 {
26 	/// @addtogroup gtx_norm
27 	/// @{
28 
29 	/// Returns the squared length of x.
30 	/// From GLM_GTX_norm extension.
31 	template <typename T, precision P, template <typename, precision> class vecType>
32 	GLM_FUNC_DECL T length2(
33 		vecType<T, P> const & x);
34 
35 	/// Returns the squared distance between p0 and p1, i.e., length2(p0 - p1).
36 	/// From GLM_GTX_norm extension.
37 	template <typename T, precision P, template <typename, precision> class vecType>
38 	GLM_FUNC_DECL T distance2(
39 		vecType<T, P> const & p0,
40 		vecType<T, P> const & p1);
41 
42 	//! Returns the L1 norm between x and y.
43 	//! From GLM_GTX_norm extension.
44 	template <typename T, precision P>
45 	GLM_FUNC_DECL T l1Norm(
46 		tvec3<T, P> const & x,
47 		tvec3<T, P> const & y);
48 
49 	//! Returns the L1 norm of v.
50 	//! From GLM_GTX_norm extension.
51 	template <typename T, precision P>
52 	GLM_FUNC_DECL T l1Norm(
53 		tvec3<T, P> const & v);
54 
55 	//! Returns the L2 norm between x and y.
56 	//! From GLM_GTX_norm extension.
57 	template <typename T, precision P>
58 	GLM_FUNC_DECL T l2Norm(
59 		tvec3<T, P> const & x,
60 		tvec3<T, P> const & y);
61 
62 	//! Returns the L2 norm of v.
63 	//! From GLM_GTX_norm extension.
64 	template <typename T, precision P>
65 	GLM_FUNC_DECL T l2Norm(
66 		tvec3<T, P> const & x);
67 
68 	//! Returns the L norm between x and y.
69 	//! From GLM_GTX_norm extension.
70 	template <typename T, precision P>
71 	GLM_FUNC_DECL T lxNorm(
72 		tvec3<T, P> const & x,
73 		tvec3<T, P> const & y,
74 		unsigned int Depth);
75 
76 	//! Returns the L norm of v.
77 	//! From GLM_GTX_norm extension.
78 	template <typename T, precision P>
79 	GLM_FUNC_DECL T lxNorm(
80 		tvec3<T, P> const & x,
81 		unsigned int Depth);
82 
83 	/// @}
84 }//namespace glm
85 
86 #include "norm.inl"
87