Go to the documentation of this file. 1 #ifndef EAGINE_MATH_MATRIX_ORBITING_HPP
9 #define EAGINE_MATH_MATRIX_ORBITING_HPP
11 #include "../quantities.hpp"
21 template <
typename T,
int N,
bool RM,
bool V>
22 struct is_matrix_constructor<orbiting_y_up<matrix<T, N, N, RM, V>>>
33 template <
typename T,
bool RM,
bool V>
34 class orbiting_y_up<
matrix<T, 4, 4, RM, V>> {
36 constexpr orbiting_y_up(
48 constexpr orbiting_y_up(
56 , _x{{-sa, T(0), -ca}}
57 , _z{{ce * ca, se, ce * -sa}}
86 -> orbiting_y_up<matrix<T, 4, 4, !RM, V>> {
87 return {c._t, c._x, c._y, c._z, c._r};
91 constexpr
auto _make(std::true_type)
const noexcept {
92 return matrix<T, 4, 4, true, V>{
93 {{_x[0], _x[1], _x[2], -_r *
dot(_x, _z) -
dot(_x, _t)},
94 {_y[0], _y[1], _y[2], -_r *
dot(_y, _z) -
dot(_y, _t)},
95 {_z[0], _z[1], _z[2], -_r *
dot(_z, _z) -
dot(_z, _t)},
96 {T(0), T(0), T(0), T(1)}}};
99 constexpr
auto _make(std::false_type)
const noexcept {
100 return reorder(_make(std::true_type()));
104 vector<T, 3, V> _x, _z, _y;
110 template <
typename T,
bool V>
116 #endif // EAGINE_MATH_MATRIX_ORBITING_HPP
static auto reorder(const matrix< T, C, R, RM, V > &m) noexcept -> matrix< T, C, R, !RM, V >
Returns a matrix reordered (switches row/column major).
Definition: matrix.hpp:314
std::integral_constant< bool, B > bool_constant
Alias for boolean constant type.
Definition: int_constant.hpp:20
Math-related code is placed in this namespace.
Definition: eagine.hpp:48
static constexpr auto dot(const vector< T, N, V > &a, const vector< T, N, V > &b) noexcept
Vector dot product.
Definition: vector.hpp:311
Helper class used in matrix constructor implementation.
Definition: matrix_ctr.hpp:74
constexpr orbiting_y_up(const vector< T, 3, V > &target, const T radius, radians_t< T > azimuth, radians_t< T > elevation)
Initalizes the matrix constructor.
Definition: matrix_orbiting.hpp:66
constexpr auto operator()() const noexcept
Returns the constructed matrix.
Definition: matrix_orbiting.hpp:80
Value of type T with a specified unit or tag type U.
Definition: tagged_quantity.hpp:27
static auto cross(const vector< T, 3, V > &a, const vector< T, 3, V > &b) noexcept
3D vector cross product.
Definition: vector.hpp:326
Basic RxC matrix implementation template.
Definition: fwd.hpp:25
convertible_matrix_constructor< orbiting_y_up< matrix< T, 4, 4, true, V > >> matrix_orbiting_y_up
Alias for constructor of orbiting matrix used for camera transformations.
Definition: matrix_orbiting.hpp:112