2.2 KB、66行 生 Blame 履歴
1/// @ref gtx_rotate_normalized_axis
2/// @file glm/gtx/rotate_normalized_axis.hpp
3///
4/// @see core (dependence)
5/// @see gtc_matrix_transform
6/// @see gtc_quaternion
7///
8/// @defgroup gtx_rotate_normalized_axis GLM_GTX_rotate_normalized_axis
9/// @ingroup gtx
10///
11/// Include <glm/gtx/rotate_normalized_axis.hpp> to use the features of this extension.
12///
13/// Quaternions and matrices rotations around normalized axis.
14
15#pragma once
16
17// Dependency:
18#include "../glm.hpp"
19#include "../gtc/epsilon.hpp"
20#include "../gtc/quaternion.hpp"
21
22#ifndef GLM_ENABLE_EXPERIMENTAL
23# error "GLM: GLM_GTX_rotate_normalized_axis 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_normalized_axis extension included")
26#endif
27
28namespace glm
29{
30 /// @addtogroup gtx_rotate_normalized_axis
31 /// @{
32
33 /// Builds a rotation 4 * 4 matrix created from a normalized axis and an angle.
34 ///
35 /// @param m Input matrix multiplied by this rotation matrix.
36 /// @param angle Rotation angle expressed in radians.
37 /// @param axis Rotation axis, must be normalized.
38 /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
39 ///
40 /// @see gtx_rotate_normalized_axis
41 /// @see - rotate(T angle, T x, T y, T z)
42 /// @see - rotate(mat<4, 4, T, Q> const& m, T angle, T x, T y, T z)
43 /// @see - rotate(T angle, vec<3, T, Q> const& v)
44 template<typename T, qualifier Q>
45 GLM_FUNC_DECL mat<4, 4, T, Q> rotateNormalizedAxis(
46 mat<4, 4, T, Q> const& m,
47 T const& angle,
48 vec<3, T, Q> const& axis);
49
50 /// Rotates a quaternion from a vector of 3 components normalized axis and an angle.
51 ///
52 /// @param q Source orientation
53 /// @param angle Angle expressed in radians.
54 /// @param axis Normalized axis of the rotation, must be normalized.
55 ///
56 /// @see gtx_rotate_normalized_axis
57 template<typename T, qualifier Q>
58 GLM_FUNC_DECL qua<T, Q> rotateNormalizedAxis(
59 qua<T, Q> const& q,
60 T const& angle,
61 vec<3, T, Q> const& axis);
62
63 /// @}
64}//namespace glm
65
66#include "rotate_normalized_axis.inl"