master
ブランチ master
VulkanExample / dep / include / glm / gtx / rotate_vector.hpp
3.6 KB、121行 生 Blame 履歴
1/// @ref gtx_rotate_vector
2/// @file glm/gtx/rotate_vector.hpp
3///
4/// @see core (dependence)
5/// @see gtx_transform (dependence)
6///
7/// @defgroup gtx_rotate_vector GLM_GTX_rotate_vector
8/// @ingroup gtx
9///
10/// Include <glm/gtx/rotate_vector.hpp> to use the features of this extension.
11///
12/// Function to directly rotate a vector
13
14#pragma once
15
16// Dependency:
17#include "../gtx/transform.hpp"
18#include "../gtc/epsilon.hpp"
19#include "../ext/vector_relational.hpp"
20#include "../glm.hpp"
21
22#ifndef GLM_ENABLE_EXPERIMENTAL
23# error "GLM: GLM_GTX_rotate_vector 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_rotate_vector extension included")
26#endif
27
28namespace glm
29{
30 /// @addtogroup gtx_rotate_vector
31 /// @{
32
33 /// Returns Spherical interpolation between two vectors
34 ///
35 /// @param x A first vector
36 /// @param y A second vector
37 /// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].
38 ///
39 /// @see gtx_rotate_vector
40 template<typename T, qualifier Q>
41 GLM_FUNC_DECL vec<3, T, Q> slerp(
42 vec<3, T, Q> const& x,
43 vec<3, T, Q> const& y,
44 T const& a);
45
46 //! Rotate a two dimensional vector.
47 //! From GLM_GTX_rotate_vector extension.
48 template<typename T, qualifier Q>
49 GLM_FUNC_DECL vec<2, T, Q> rotate(
50 vec<2, T, Q> const& v,
51 T const& angle);
52
53 //! Rotate a three dimensional vector around an axis.
54 //! From GLM_GTX_rotate_vector extension.
55 template<typename T, qualifier Q>
56 GLM_FUNC_DECL vec<3, T, Q> rotate(
57 vec<3, T, Q> const& v,
58 T const& angle,
59 vec<3, T, Q> const& normal);
60
61 //! Rotate a four dimensional vector around an axis.
62 //! From GLM_GTX_rotate_vector extension.
63 template<typename T, qualifier Q>
64 GLM_FUNC_DECL vec<4, T, Q> rotate(
65 vec<4, T, Q> const& v,
66 T const& angle,
67 vec<3, T, Q> const& normal);
68
69 //! Rotate a three dimensional vector around the X axis.
70 //! From GLM_GTX_rotate_vector extension.
71 template<typename T, qualifier Q>
72 GLM_FUNC_DECL vec<3, T, Q> rotateX(
73 vec<3, T, Q> const& v,
74 T const& angle);
75
76 //! Rotate a three dimensional vector around the Y axis.
77 //! From GLM_GTX_rotate_vector extension.
78 template<typename T, qualifier Q>
79 GLM_FUNC_DECL vec<3, T, Q> rotateY(
80 vec<3, T, Q> const& v,
81 T const& angle);
82
83 //! Rotate a three dimensional vector around the Z axis.
84 //! From GLM_GTX_rotate_vector extension.
85 template<typename T, qualifier Q>
86 GLM_FUNC_DECL vec<3, T, Q> rotateZ(
87 vec<3, T, Q> const& v,
88 T const& angle);
89
90 //! Rotate a four dimensional vector around the X axis.
91 //! From GLM_GTX_rotate_vector extension.
92 template<typename T, qualifier Q>
93 GLM_FUNC_DECL vec<4, T, Q> rotateX(
94 vec<4, T, Q> const& v,
95 T const& angle);
96
97 //! Rotate a four dimensional vector around the Y axis.
98 //! From GLM_GTX_rotate_vector extension.
99 template<typename T, qualifier Q>
100 GLM_FUNC_DECL vec<4, T, Q> rotateY(
101 vec<4, T, Q> const& v,
102 T const& angle);
103
104 //! Rotate a four dimensional vector around the Z axis.
105 //! From GLM_GTX_rotate_vector extension.
106 template<typename T, qualifier Q>
107 GLM_FUNC_DECL vec<4, T, Q> rotateZ(
108 vec<4, T, Q> const& v,
109 T const& angle);
110
111 //! Build a rotation matrix from a normal and a up vector.
112 //! From GLM_GTX_rotate_vector extension.
113 template<typename T, qualifier Q>
114 GLM_FUNC_DECL mat<4, 4, T, Q> orientation(
115 vec<3, T, Q> const& Normal,
116 vec<3, T, Q> const& Up);
117
118 /// @}
119}//namespace glm
120
121#include "rotate_vector.inl"