master
ブランチ master
VulkanExample / dep / include / glm / gtx / norm.hpp
2.7 KB、85行 生 Blame 履歴
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
15#pragma once
16
17// Dependency:
18#include "../geometric.hpp"
19#include "../gtx/component_wise.hpp"
20
21#ifndef GLM_ENABLE_EXPERIMENTAL
22# 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."
23#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
24# pragma message("GLM: GLM_GTX_norm extension included")
25#endif
26
27namespace glm
28{
29 /// @addtogroup gtx_norm
30 /// @{
31
32 /// Returns the squared length of x.
33 /// From GLM_GTX_norm extension.
34 template<length_t L, typename T, qualifier Q>
35 GLM_FUNC_DECL T length2(vec<L, T, Q> const& x);
36
37 /// Returns the squared distance between p0 and p1, i.e., length2(p0 - p1).
38 /// From GLM_GTX_norm extension.
39 template<length_t L, typename T, qualifier Q>
40 GLM_FUNC_DECL T distance2(vec<L, T, Q> const& p0, vec<L, T, Q> const& p1);
41
42 //! Returns the L1 norm between x and y.
43 //! From GLM_GTX_norm extension.
44 template<typename T, qualifier Q>
45 GLM_FUNC_DECL T l1Norm(vec<3, T, Q> const& x, vec<3, T, Q> const& y);
46
47 //! Returns the L1 norm of v.
48 //! From GLM_GTX_norm extension.
49 template<typename T, qualifier Q>
50 GLM_FUNC_DECL T l1Norm(vec<3, T, Q> const& v);
51
52 //! Returns the L2 norm between x and y.
53 //! From GLM_GTX_norm extension.
54 template<typename T, qualifier Q>
55 GLM_FUNC_DECL T l2Norm(vec<3, T, Q> const& x, vec<3, T, Q> const& y);
56
57 //! Returns the L2 norm of v.
58 //! From GLM_GTX_norm extension.
59 template<typename T, qualifier Q>
60 GLM_FUNC_DECL T l2Norm(vec<3, T, Q> const& x);
61
62 //! Returns the L norm between x and y.
63 //! From GLM_GTX_norm extension.
64 template<typename T, qualifier Q>
65 GLM_FUNC_DECL T lxNorm(vec<3, T, Q> const& x, vec<3, T, Q> const& y, unsigned int Depth);
66
67 //! Returns the L norm of v.
68 //! From GLM_GTX_norm extension.
69 template<typename T, qualifier Q>
70 GLM_FUNC_DECL T lxNorm(vec<3, T, Q> const& x, unsigned int Depth);
71
72 //! Returns the LMax norm between x and y.
73 //! From GLM_GTX_norm extension.
74 template<typename T, qualifier Q>
75 GLM_FUNC_DECL T lMaxNorm(vec<3, T, Q> const& x, vec<3, T, Q> const& y);
76
77 //! Returns the LMax norm of v.
78 //! From GLM_GTX_norm extension.
79 template<typename T, qualifier Q>
80 GLM_FUNC_DECL T lMaxNorm(vec<3, T, Q> const& x);
81
82 /// @}
83}//namespace glm
84
85#include "norm.inl"