Go to the documentation of this file. 1 #ifndef EAGINE_MATH_MATRIX_ROTATION_HPP
9 #define EAGINE_MATH_MATRIX_ROTATION_HPP
11 #include "../quantities.hpp"
17 EAGINE_DIAG_OFF(
double-promotion)
23 template <
typename X,
int I>
27 template <
typename T,
int N,
bool RM,
bool V,
int I>
28 struct is_matrix_constructor<rotation_I<matrix<T, N, N, RM, V>, I>>
39 template <
typename T,
bool RM,
bool V,
int I>
40 class rotation_I<
matrix<T, 4, 4, RM, V>, I> {
50 return _make(cos(_v), sin(_v) * (RM ? 1 : -1), _axis());
55 -> rotation_I<matrix<T, 4, 4, !RM, V>, I> {
60 using _x = int_constant<0>;
61 using _y = int_constant<1>;
62 using _z = int_constant<2>;
64 static constexpr
auto _make(T cx, T sx, _x) noexcept {
65 return matrix<T, 4, 4, RM, V>{
66 {{T(1), T(0), T(0), T(0)},
67 {T(0), cx, -sx, T(0)},
69 {T(0), T(0), T(0), T(1)}}};
72 static constexpr
auto _make(T cx, T sx, _y) noexcept {
73 return matrix<T, 4, 4, RM, V>{
74 {{cx, T(0), sx, T(0)},
75 {T(0), T(1), T(0), T(0)},
76 {-sx, T(0), cx, T(0)},
77 {T(0), T(0), T(0), T(1)}}};
80 static constexpr
auto _make(T cx, T sx, _z) noexcept {
81 return matrix<T, 4, 4, RM, V>{
82 {{cx, -sx, T(0), T(0)},
84 {T(0), T(0), T(1), T(0)},
85 {T(0), T(0), T(0), T(1)}}};
92 template <
typename T,
int N,
bool RM1,
bool RM2,
bool V,
int I>
94 const rotation_I<matrix<T, N, N, RM1, V>, I>& a,
95 const rotation_I<matrix<T, N, N, RM2, V>, I>& b) noexcept
96 -> rotation_I<matrix<T, N, N, RM1, V>, I> {
97 return {radians_t<T>{T(a._v) + T(b._v)}};
102 template <
typename M>
107 template <
typename M>
112 template <
typename M>
122 template <
typename T,
bool V>
136 template <
typename T,
bool V>
150 template <
typename T,
bool V>
160 #endif // EAGINE_MATH_MATRIX_ROTATION_HPP
rotation_I< M, 2 > rotation_z
Alias for implementation of constructor of rotation along z-axis matrix.
Definition: matrix_rotation.hpp:113
constexpr auto operator()() const
Returns the constructed matrix.
Definition: matrix_rotation.hpp:48
rotation_I< M, 1 > rotation_y
Alias for implementation of constructor of rotation along y-axis matrix.
Definition: matrix_rotation.hpp:108
Math-related code is placed in this namespace.
Definition: eagine.hpp:48
rotation_I< M, 0 > rotation_x
Alias for implementation of constructor of rotation along x-axis matrix.
Definition: matrix_rotation.hpp:103
Helper class used in matrix constructor implementation.
Definition: matrix_ctr.hpp:74
constexpr rotation_I(radians_t< T > v) noexcept
Initializes the matrix constructor.
Definition: matrix_rotation.hpp:44
static auto multiply(const matrix< T, K, M, RM1, V > &m1, const matrix< T, N, K, RM2, V > &m2) noexcept -> matrix< T, N, M, RM1, V >
Matrix multiplication function.
Definition: matrix.hpp:529
std::integral_constant< int, I > int_constant
Alias for signed int constant type.
Definition: int_constant.hpp:25
Value of type T with a specified unit or tag type U.
Definition: tagged_quantity.hpp:27
Basic RxC matrix implementation template.
Definition: fwd.hpp:25