master
ブランチ master
VulkanExample / dep / include / glm / gtx / fast_square_root.hpp
3.1 KB、96行 生 Blame 履歴
1/// @ref gtx_fast_square_root
2/// @file glm/gtx/fast_square_root.hpp
3///
4/// @see core (dependence)
5///
6/// @defgroup gtx_fast_square_root GLM_GTX_fast_square_root
7/// @ingroup gtx
8///
9/// Include <glm/gtx/fast_square_root.hpp> to use the features of this extension.
10///
11/// Fast but less accurate implementations of square root based functions.
12/// - Sqrt optimisation based on Newton's method,
13/// www.gamedev.net/community/forums/topic.asp?topic id=139956
14
15#pragma once
16
17// Dependency:
18#include "../common.hpp"
19#include "../exponential.hpp"
20#include "../geometric.hpp"
21
22#ifndef GLM_ENABLE_EXPERIMENTAL
23# error "GLM: GLM_GTX_fast_square_root 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."
24#elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
25# pragma message("GLM: GLM_GTX_fast_square_root extension included")
26#endif
27
28namespace glm
29{
30 /// @addtogroup gtx_fast_square_root
31 /// @{
32
33 /// Faster than the common sqrt function but less accurate.
34 ///
35 /// @see gtx_fast_square_root extension.
36 template<typename genType>
37 GLM_FUNC_DECL genType fastSqrt(genType x);
38
39 /// Faster than the common sqrt function but less accurate.
40 ///
41 /// @see gtx_fast_square_root extension.
42 template<length_t L, typename T, qualifier Q>
43 GLM_FUNC_DECL vec<L, T, Q> fastSqrt(vec<L, T, Q> const& x);
44
45 /// Faster than the common inversesqrt function but less accurate.
46 ///
47 /// @see gtx_fast_square_root extension.
48 template<typename genType>
49 GLM_FUNC_DECL genType fastInverseSqrt(genType x);
50
51 /// Faster than the common inversesqrt function but less accurate.
52 ///
53 /// @see gtx_fast_square_root extension.
54 template<length_t L, typename T, qualifier Q>
55 GLM_FUNC_DECL vec<L, T, Q> fastInverseSqrt(vec<L, T, Q> const& x);
56
57 /// Faster than the common length function but less accurate.
58 ///
59 /// @see gtx_fast_square_root extension.
60 template<typename genType>
61 GLM_FUNC_DECL genType fastLength(genType x);
62
63 /// Faster than the common length function but less accurate.
64 ///
65 /// @see gtx_fast_square_root extension.
66 template<length_t L, typename T, qualifier Q>
67 GLM_FUNC_DECL T fastLength(vec<L, T, Q> const& x);
68
69 /// Faster than the common distance function but less accurate.
70 ///
71 /// @see gtx_fast_square_root extension.
72 template<typename genType>
73 GLM_FUNC_DECL genType fastDistance(genType x, genType y);
74
75 /// Faster than the common distance function but less accurate.
76 ///
77 /// @see gtx_fast_square_root extension.
78 template<length_t L, typename T, qualifier Q>
79 GLM_FUNC_DECL T fastDistance(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
80
81 /// Faster than the common normalize function but less accurate.
82 ///
83 /// @see gtx_fast_square_root extension.
84 template<typename genType>
85 GLM_FUNC_DECL genType fastNormalize(genType x);
86
87 /// Faster than the common normalize function but less accurate.
88 ///
89 /// @see gtx_fast_square_root extension.
90 template<length_t L, typename T, qualifier Q>
91 GLM_FUNC_DECL vec<L, T, Q> fastNormalize(vec<L, T, Q> const& x);
92
93 /// @}
94}// namespace glm
95
96#include "fast_square_root.inl"