1 template <u
int8_t Rows,
typename T>
4 template <u
int8_t Rows,
typename T>
7 template <u
int8_t Rows,
typename T>
10 template <u
int8_t Rows,
typename T>
13 template <u
int8_t Rows,
typename T>
15 for (uint8_t row = 0; row < Rows - 1; ++row) {
16 (*this)(row) = vector(row);
19 (*this)(Rows - 1) = value;
22 template <u
int8_t Rows,
typename T>
24 for (uint8_t row = 0; row < Rows; ++row) {
25 (*this)(row) = vector(row);
29 template <u
int8_t Rows,
typename T>
33 for (uint8_t row = 0; row < Rows; ++row) {
34 for (uint8_t col = 0; col < Rows; ++col) {
35 tmp(row) += (*this)(col) * rhs(row, col);
39 *
this = std::move(tmp);
44 template <u
int8_t Rows,
typename T>
50 template <u
int8_t Rows,
typename T>
56 template <u
int8_t Rows,
typename T>
61 template <u
int8_t Rows,
typename T>
66 template <u
int8_t Rows,
typename T>
72 inline constexpr Vector<3, T>
cross(
const Vector<3, T>& lhs,
const Vector<3, T>& rhs) {
74 lhs.y() * rhs.z() - lhs.z() * rhs.y(),
75 lhs.z() * rhs.x() - lhs.x() * rhs.z(),
76 lhs.x() * rhs.y() - lhs.y() * rhs.x()
80 template <u
int8_t Rows,
typename T>
81 inline constexpr T
dot(
const Vector<Rows, T>& lhs,
const Vector<Rows, T>& rhs) {
82 return (lhs.getValues() * rhs.getValues()).sum();
85 template <u
int8_t Rows, u
int8_t Columns,
typename T>
86 inline constexpr Matrix<Rows, Columns, T>
outer(
const Vector<Rows, T>& lhs,
const Vector<Columns, T>& rhs) {
87 return lhs * rhs.transpose();
90 template <u
int8_t Rows,
typename T>
91 inline constexpr Vector<Rows, T>
normalize(
const Vector<Rows, T>& lhs) {
92 return lhs / lhs.length();
95 template <u
int8_t Rows,
typename T>
96 inline Vector<Rows, T>
operator*(
const Vector<Rows, T>& lhs,
const Vector<Rows, T>& rhs) {
97 return {lhs.getValues() * rhs.getValues()};
100 template <u
int8_t Rows,
typename T>
101 inline Vector<Rows, T>
operator/(
const Vector<Rows, T>& lhs,
const Vector<Rows, T>& rhs) {
102 return {lhs.getValues() / rhs.getValues()};
105 template <u
int8_t Rows,
typename T>
106 inline Vector<Rows, T>
operator*(
const Vector<Rows, T>& lhs,
const Matrix<Rows, Rows, T>& rhs) {
107 Vector<Rows, T> vector{lhs};
114 template <u
int8_t Rows,
typename T>
115 inline Vector<Rows, T>
operator*(
const Matrix<Rows, Rows, T>& lhs,
const Vector<Rows, T>& rhs) {
116 Vector<Rows, T> vector{rhs};
123 template <
typename T>
124 inline Vector<3, T>
operator*(
const Vector<3, T>& lhs,
const Matrix<4, 4, T>& rhs) {
125 return Vector<4, T>{lhs, T(1)} * rhs;
128 template <
typename T>
129 inline Vector<3, T>
operator*(
const Matrix<4, 4, T>& lhs,
const Vector<3, T>& rhs) {
130 return lhs * Vector<4, T>{rhs, T(1)};
Vector< Rows, T > operator*=(const Matrix< Rows, Rows, T > &rhs)
constexpr Vector< 3, T > cross(const Vector< 3, T > &lhs, const Vector< 3, T > &rhs)
constexpr Vector< Rows, T > normalize(const Vector< Rows, T > &lhs)
constexpr T squaredLength() const
constexpr Matrix< Rows, Columns, T > outer(const Vector< Rows, T > &lhs, const Vector< Columns, T > &rhs)
constexpr T length() const
Vector< Rows, T > operator/=(const Vector< Rows, T > &rhs)
Matrix< Rows, Columns, T > operator/(const Matrix< Rows, Columns, T > &lhs, T rhs)
constexpr Vector()=default
Matrix< Rows, Columns, T > operator*(const Matrix< Rows, Columns, T > &lhs, T rhs)
T dot(const Quaternion< T > &lhs, const Quaternion< T > &rhs)