Go to the documentation of this file. 1 #ifndef EAGINE_MATH_TMAT_HPP
9 #define EAGINE_MATH_TMAT_HPP
11 #include "../all_are_same.hpp"
20 template <
typename T,
int C,
int R,
bool RM,
bool V>
21 struct tmat : matrix<T, C, R, RM, V> {
27 :
base{identity<base>{}()} {}
34 tmat(
const T* d,
int n) noexcept
38 tmat(
const T (&d)[C * R]) noexcept
44 typename = std::enable_if_t<
45 ((
sizeof...(P)) == (C * R)) && all_are_convertible_to<T, P...>::value>>
46 static auto _make(P&&... p) {
47 T d[C * R] = {T(p)...};
54 typename = std::enable_if_t<
55 ((
sizeof...(P)) == (R * C)) && all_are_convertible_to<T, P...>::value>>
57 :
base(_make(std::forward<P>(p)...)) {}
61 typename = std::enable_if_t<((
sizeof...(P)) == (RM ? R : C))>>
62 constexpr
tmat(
const vector<P, RM ? C : R, V>&... v) noexcept
70 std::enable_if_t<std::is_convertible_v<P, T> && (C <= M) && (R <= N)>>
71 constexpr
tmat(
const matrix<P, M, N, RM, V>& m) noexcept
75 template <
typename T,
int C,
int R,
bool RM,
bool V>
80 template <
typename T,
int C,
int R,
bool RM,
bool V>
81 struct is_known_matrix_type<math::
tmat<T, C, R, RM, V>> : std::is_scalar<T> {};
83 template <
typename T,
int C,
int R,
bool RM,
bool V>
84 struct canonical_compound_type<math::
tmat<T, C, R, RM, V>>
85 : type_identity<std::remove_cv_t<T[C][R]>> {};
87 template <
typename T,
int C,
int R,
bool RM,
bool V>
88 struct compound_view_maker<math::
tmat<T, C, R, RM, V>> {
89 auto operator()(
const math::tmat<T, C, R, RM, V>& m)
const noexcept {
90 return vect::view < T, RM ? C : R, V > ::apply(m._v);
94 template <
typename T,
int C,
int R,
bool RM,
bool V>
99 #endif // EAGINE_MATH_TMAT_HPP
Common code is placed in this namespace.
Definition: eagine.hpp:21
constexpr tmat() noexcept
Default constructor. Constructs identity matrix.
Definition: tmat.hpp:26
constexpr tmat(const base &m) noexcept
Construction from a base matrix.
Definition: tmat.hpp:30
std::integral_constant< bool, B > bool_constant
Alias for boolean constant type.
Definition: int_constant.hpp:20
math::tmat< T, C, R, RM, V > tmat
Template alias for math::tmat.
Definition: matrix.hpp:24
tmat(const T(&d)[C *R]) noexcept
Construction from element data array.
Definition: tmat.hpp:38
static auto from(const P *dt, span_size_t sz) noexcept -> matrix
Creates a matrix from data pointer and size.
Definition: matrix.hpp:49
matrix< T, C, R, RM, V > base
The base matrix type.
Definition: tmat.hpp:23
Basic RxC matrix implementation template.
Definition: fwd.hpp:25
tmat(const T *d, int n) noexcept
Construction from element data pointer and count.
Definition: tmat.hpp:34