33#include <NDEVR/BaseValues.h>
34#include <NDEVR/Vector.h>
35#include <NDEVR/Angle.h>
41 template<u
int01 t_cols, u
int01 t_rows>
48 template<
class t_type>
56 class MatrixInverter<2, 2>
59 template<
class t_type>
60 static constexpr t_type determinant(
const Vector<2, Vector<2, t_type>>& value)
62 return value[0][0] * value[1][1] - value[1][0] * value[0][1];
64 template<
class t_type>
65 static Vector<2, Vector<2, t_type>> invert(
const Vector<2, Vector<2, t_type>>& value)
67 t_type OneOverDeterminant =
static_cast<t_type
>(1) / value.determinant();
68 return Vector<3, Vector<3, t_type>>(
69 +value[1][1] * OneOverDeterminant,
70 -value[0][1] * OneOverDeterminant,
71 -value[1][0] * OneOverDeterminant,
72 +value[0][0] * OneOverDeterminant).
template getAs<t_type, 2, 2>();
77 class MatrixInverter<3, 3>
80 template<
class t_type>
81 static constexpr t_type determinant(
const Vector<3, Vector<3, t_type>>& value)
83 return + value[0][0] * (value[1][1] * value[2][2] - value[2][1] * value[1][2])
84 - value[1][0] * (value[0][1] * value[2][2] - value[2][1] * value[0][2])
85 + value[2][0] * (value[0][1] * value[1][2] - value[1][1] * value[0][2]);
87 template<
class t_type>
88 static Vector<3, Vector<3, t_type>> invert(
const Vector<3, Vector<3, t_type>>& value)
90 t_type OneOverDeterminant =
static_cast<t_type
>(1) / determinant(value);
91 Vector<3, Vector<3, t_type>> Inverse;
92 Inverse[0][0] = +(value[1][1] * value[2][2] - value[2][1] * value[1][2]) * OneOverDeterminant;
93 Inverse[1][0] = -(value[1][0] * value[2][2] - value[2][0] * value[1][2]) * OneOverDeterminant;
94 Inverse[2][0] = +(value[1][0] * value[2][1] - value[2][0] * value[1][1]) * OneOverDeterminant;
95 Inverse[0][1] = -(value[0][1] * value[2][2] - value[2][1] * value[0][2]) * OneOverDeterminant;
96 Inverse[1][1] = +(value[0][0] * value[2][2] - value[2][0] * value[0][2]) * OneOverDeterminant;
97 Inverse[2][1] = -(value[0][0] * value[2][1] - value[2][0] * value[0][1]) * OneOverDeterminant;
98 Inverse[0][2] = +(value[0][1] * value[1][2] - value[1][1] * value[0][2]) * OneOverDeterminant;
99 Inverse[1][2] = -(value[0][0] * value[1][2] - value[1][0] * value[0][2]) * OneOverDeterminant;
100 Inverse[2][2] = +(value[0][0] * value[1][1] - value[1][0] * value[0][1]) * OneOverDeterminant;
106 class MatrixInverter<4, 4>
109 template<
class t_type>
110 static Vector<4, Vector<4, t_type>> invert(
const Vector<4, Vector<4, t_type>>& value)
112 t_type Coef00 = value[2][2] * value[3][3] - value[3][2] * value[2][3];
113 t_type Coef02 = value[1][2] * value[3][3] - value[3][2] * value[1][3];
114 t_type Coef03 = value[1][2] * value[2][3] - value[2][2] * value[1][3];
116 t_type Coef04 = value[2][1] * value[3][3] - value[3][1] * value[2][3];
117 t_type Coef06 = value[1][1] * value[3][3] - value[3][1] * value[1][3];
118 t_type Coef07 = value[1][1] * value[2][3] - value[2][1] * value[1][3];
120 t_type Coef08 = value[2][1] * value[3][2] - value[3][1] * value[2][2];
121 t_type Coef10 = value[1][1] * value[3][2] - value[3][1] * value[1][2];
122 t_type Coef11 = value[1][1] * value[2][2] - value[2][1] * value[1][2];
124 t_type Coef12 = value[2][0] * value[3][3] - value[3][0] * value[2][3];
125 t_type Coef14 = value[1][0] * value[3][3] - value[3][0] * value[1][3];
126 t_type Coef15 = value[1][0] * value[2][3] - value[2][0] * value[1][3];
128 t_type Coef16 = value[2][0] * value[3][2] - value[3][0] * value[2][2];
129 t_type Coef18 = value[1][0] * value[3][2] - value[3][0] * value[1][2];
130 t_type Coef19 = value[1][0] * value[2][2] - value[2][0] * value[1][2];
132 t_type Coef20 = value[2][0] * value[3][1] - value[3][0] * value[2][1];
133 t_type Coef22 = value[1][0] * value[3][1] - value[3][0] * value[1][1];
134 t_type Coef23 = value[1][0] * value[2][1] - value[2][0] * value[1][1];
136 Vector<4, t_type> Fac0(Coef00, Coef00, Coef02, Coef03);
137 Vector<4, t_type> Fac1(Coef04, Coef04, Coef06, Coef07);
138 Vector<4, t_type> Fac2(Coef08, Coef08, Coef10, Coef11);
139 Vector<4, t_type> Fac3(Coef12, Coef12, Coef14, Coef15);
140 Vector<4, t_type> Fac4(Coef16, Coef16, Coef18, Coef19);
141 Vector<4, t_type> Fac5(Coef20, Coef20, Coef22, Coef23);
143 Vector<4, t_type> Vec0(value[1][0], value[0][0], value[0][0], value[0][0]);
144 Vector<4, t_type> Vec1(value[1][1], value[0][1], value[0][1], value[0][1]);
145 Vector<4, t_type> Vec2(value[1][2], value[0][2], value[0][2], value[0][2]);
146 Vector<4, t_type> Vec3(value[1][3], value[0][3], value[0][3], value[0][3]);
148 Vector<4, t_type> Inv0(Vec1 * Fac0 - Vec2 * Fac1 + Vec3 * Fac2);
149 Vector<4, t_type> Inv1(Vec0 * Fac0 - Vec2 * Fac3 + Vec3 * Fac4);
150 Vector<4, t_type> Inv2(Vec0 * Fac1 - Vec1 * Fac3 + Vec3 * Fac5);
151 Vector<4, t_type> Inv3(Vec0 * Fac2 - Vec1 * Fac4 + Vec2 * Fac5);
153 Vector<4, t_type> SignA(+1, -1, +1, -1);
154 Vector<4, t_type> SignB(-1, +1, -1, +1);
156 Vector<4, t_type> Row0(Inv0[0] * SignA[0], Inv1[0] * SignB[0], Inv2[0] * SignA[0], Inv3[0] * SignB[0]);
158 Vector<4, t_type> Dot0(Vector<4, t_type>(value[0][0], value[0][1], value[0][2], value[0][3]) * Row0);
159 t_type Dot1 = Dot0.sum();
162 t_type OneOverDeterminant =
static_cast<t_type
>(1) / Dot1;
163 Inv0 = Inv0 * SignA * OneOverDeterminant;
164 Inv1 = Inv1 * SignB * OneOverDeterminant;
165 Inv2 = Inv2 * SignA * OneOverDeterminant;
166 Inv3 = Inv3 * SignB * OneOverDeterminant;
167 return Vector<4, Vector<4, t_type>>(
168 { Inv0[0], Inv0[1], Inv0[2], Inv0[3] }
169 , { Inv1[0], Inv1[1], Inv1[2], Inv1[3] }
170 , { Inv2[0], Inv2[1], Inv2[2], Inv2[3]}
171 , { Inv3[0], Inv3[1], Inv3[2], Inv3[3]});
174 template<
class t_type, u
int01 t_row_dims = 4, u
int01 t_col_dims = 4>
181 constexpr explicit Matrix(
const t_type diagonal)
184 for (
uint01 i = 0; i <
getMin(t_row_dims, t_col_dims); i++)
186 (*this)[i][i] = diagonal;
191 const t_type n00,
const t_type n10,
192 const t_type n01,
const t_type n11)
194 Vector<2, t_type>(n00, n10)
195 ,
Vector<2, t_type>(n01, n11))
197 static_assert(t_row_dims == 2 && t_col_dims == 2,
"Bad Transform Constructor, should be 2x2");
200 const t_type n00,
const t_type n10,
const t_type n20,
201 const t_type n01,
const t_type n11,
const t_type n21,
202 const t_type n02,
const t_type n12,
const t_type n22)
204 Vector<3, t_type>(n00, n10, n20)
205 ,
Vector<3, t_type>(n01, n11, n21)
206 ,
Vector<3, t_type>(n02, n12, n22))
208 static_assert(t_row_dims == 3 && t_col_dims == 3,
"Bad Transform Constructor, should be 3x3");
211 const t_type n00,
const t_type n10,
const t_type n20,
const t_type n30,
212 const t_type n01,
const t_type n11,
const t_type n21,
const t_type n31,
213 const t_type n02,
const t_type n12,
const t_type n22,
const t_type n32,
214 const t_type n03,
const t_type n13,
const t_type n23,
const t_type n33)
216 Vector<4, t_type>(n00, n10, n20, n30)
217 ,
Vector<4, t_type>(n01, n11, n21, n31)
218 ,
Vector<4, t_type>(n02, n12, n22, n32)
219 ,
Vector<4, t_type>(n03, n13, n23, n33))
221 static_assert(t_row_dims == 4 && t_col_dims == 4,
"Bad Transform Constructor, should be 4x4");
223 template<
class t_angle_type>
230 (*this)[t_row_dims - 1][0] =
offset[
X];
231 if constexpr (t_col_dims >= 2)
232 (*
this)[t_row_dims - 1][1] =
offset[
Y];
233 if constexpr (t_col_dims >= 3)
234 (*
this)[t_row_dims - 1][2] =
offset[
Z];
236 *
this = this->
scale(scale);
243 :
Vector<t_row_dims,
Vector<t_col_dims, t_type>>(vector)
247 template<
class t_new_type>
251 for (
uint01 row = 0; row < t_row_dims; ++row)
253 for (
uint01 col = 0; col < t_col_dims; ++col)
260 template<u
int01 t_i0, u
int01 t_i1, u
int01 t_j0, u
int01 t_j1>
261 [[nodiscard]]
constexpr Matrix<t_type, t_i1 - t_i0 + 1, t_j1 - t_j0 + 1>
subMatrix()
const
263 Matrix<t_type, t_i1 - t_i0 + 1, t_j1 - t_j0 + 1> mat;
264 for (
uint01 i = t_i0; i <= t_i1; i++)
266 for (
uint01 j = t_j0; j <= t_j1; j++)
267 mat[i - t_i0][j - t_j0] = (*
this)[i][j];
271 template<u
int01 t_j0, u
int01 t_j1, u
int01 t_i_size>
274 Matrix<t_type, t_i_size, t_j1 - t_j0 + 1> mat;
275 for (
uint01 i = 0; i < t_i_size; i++)
277 for (
uint01 j = t_j0; j <= t_j1; j++)
279 mat[i][j - t_j0] = (*this)[r[i]][j];
284 template<
class t_new_type, u
int01 t_new_row_dims, u
int01 t_new_col_dims>
288 for (
uint01 row = 0; row <
getMin(t_row_dims, t_new_row_dims); ++row)
290 for (
uint01 col = 0; col <
getMin(t_col_dims, t_new_col_dims); ++col)
300 mat[t_row_dims - 1][0] = translation[
X];
301 if constexpr (t_col_dims >= 2)
302 mat[t_row_dims - 1][1] = translation[
Y];
303 if constexpr (t_col_dims >= 3)
304 mat[t_row_dims - 1][2] = translation[
Z];
311 if constexpr (t_col_dims >= 2 && t_row_dims >= 2)
313 if constexpr (t_col_dims >= 3 && t_row_dims >= 3)
321 if constexpr (t_col_dims >= 2 && t_row_dims >= 2)
329 if constexpr (t_col_dims >= 2 && t_row_dims >= 2)
331 if constexpr (t_col_dims >= 3 && t_row_dims >= 3)
335 template<
class t_angle_type>
338 t_type ch = t_type(1);
339 t_type sh = t_type(0);
340 t_type ca = t_type(1);
341 t_type sa = t_type(0);
342 t_type cb = t_type(1);
343 t_type sb = t_type(0);
346 ch =
cos(orientation[
YAW]);
347 sh =
sin(orientation[
YAW]);
360 t_type m00 = ch * ca;
361 t_type m01 = ch * sa * sb - sh * cb;
362 t_type m02 = ch * sa * cb + sh * sb;
363 t_type m10 = sh * ca;
364 t_type m11 = sh * sa * sb + ch * cb;
365 t_type m12 = sh * sa * cb - ch * sb;
367 t_type m21 = ca * sb;
368 t_type m22 = ca * cb;
375 template<
class t_angle_type>
378 const t_type cos_val =
cos(phi);
379 const t_type sin_val =
sin(phi);
380 const t_type x = axis[
X];
381 const t_type y = axis[
Y];
382 const t_type z = axis[
Z];
384 (cos_val + x * x * (1 - cos_val)), (z * sin_val + y * x * (1 - cos_val)), (-y * sin_val + z * x * (1 - cos_val)), 0
385 , (-z * sin_val + x * y * (1 - cos_val)), (cos_val + y * y * (1 - cos_val)), (x * sin_val + z * y * (1 - cos_val)), 0
386 , (y * sin_val + x * z * (1 - cos_val)), (-x * sin_val + y * z * (1 - cos_val)), (cos_val + z * z * (1 - cos_val)), 0
391 static_assert(t_col_dims == t_row_dims,
"Rows and columns must be equal for determinate");
395 return (*
this)[0][0];
397 return (*
this)[0][0] * (*this)[1][1] - (*this)[1][0] * (*this)[0][1];
400 +(*this)[0][0] * ((*this)[1][1] * (*this)[2][2] - (*this)[2][1] * (*this)[1][2])
401 - (*
this)[1][0] * ((*this)[0][1] * (*this)[2][2] - (*this)[2][1] * (*this)[0][2])
402 + (*
this)[2][0] * ((*this)[0][1] * (*this)[1][2] - (*this)[1][1] * (*this)[0][2]);
405 t_type SubFactor00 = (*this)[2][2] * (*this)[3][3] - (*this)[3][2] * (*this)[2][3];
406 t_type SubFactor01 = (*this)[2][1] * (*this)[3][3] - (*this)[3][1] * (*this)[2][3];
407 t_type SubFactor02 = (*this)[2][1] * (*this)[3][2] - (*this)[3][1] * (*this)[2][2];
408 t_type SubFactor03 = (*this)[2][0] * (*this)[3][3] - (*this)[3][0] * (*this)[2][3];
409 t_type SubFactor04 = (*this)[2][0] * (*this)[3][2] - (*this)[3][0] * (*this)[2][2];
410 t_type SubFactor05 = (*this)[2][0] * (*this)[3][1] - (*this)[3][0] * (*this)[2][1];
412 +((*
this)[1][1] * SubFactor00 - (*
this)[1][2] * SubFactor01 + (*
this)[1][3] * SubFactor02),
413 -((*
this)[1][0] * SubFactor00 - (*
this)[1][2] * SubFactor03 + (*
this)[1][3] * SubFactor04),
414 +((*
this)[1][0] * SubFactor01 - (*
this)[1][1] * SubFactor03 + (*
this)[1][3] * SubFactor05),
415 -((*
this)[1][0] * SubFactor02 - (*
this)[1][1] * SubFactor04 + (*
this)[1][2] * SubFactor05));
417 (*
this)[0][0] * DetCof[0] + (*this)[0][1] * DetCof[1] +
418 (*this)[0][2] * DetCof[2] + (*this)[0][3] * DetCof[3];
426 static_assert(t_col_dims >= 4 && t_row_dims >= 4,
"Cannot decompose lower dimension matrix");
429 for (
uint01 i = 0; i < 3; i++)
436 if (
dot(temp_z, rows[2]) < 0)
438 scaling[
X] = -scaling[
X];
445 static_assert(t_col_dims >= 3 && t_row_dims >= 3,
"Cannot decompose lower dimension matrix");
456 template<
class t_angle_type>
459 static_assert(t_col_dims >= 3 && t_row_dims >= 3,
"Cannot decompose lower dimension matrix");
462 for (
uint01 i = 0; i < 3; i++)
467 if (
dot(temp_z, rows[2]) < 0)
471 for (
uint04 i = 0; i < 3; i++)
475 t_type sy =
sqrt(rows[0][0] * rows[0][0] + rows[0][1] * rows[0][1]);
493 t_type trace = (*this)[0][0] + (*this)[1][1] + (*this)[2][2];
496 if (trace > t_type(0.0))
498 t_type s =
sqrt(trace + t_type(1.0));
499 temp[3] = (s * t_type(0.5));
502 temp[0] = (((*this)[2][1] - (*this)[1][2]) * s);
503 temp[1] = (((*this)[0][2] - (*this)[2][0]) * s);
504 temp[2] = (((*this)[1][0] - (*this)[0][1]) * s);
508 uint01 i = (*this)[0][0] < (*this)[1][1] ?
509 ((*this)[1][1] < (*this)[2][2] ? 2U : 1U) :
510 ((*this)[0][0] < (*this)[2][2] ? 2U : 0U);
514 t_type s = t_type((*
this)[i][i] - (*
this)[j][j] - (*
this)[k][k] + t_type(1.0));
515 temp[i] = s * t_type(0.5);
518 temp[3] = ((*this)[k][j] - (*this)[j][k]) * s;
519 temp[j] = ((*this)[j][i] + (*this)[i][j]) * s;
520 temp[k] = ((*this)[k][i] + (*this)[i][k]) * s;
524 template<
class t_angle_type>
527 static_assert(t_col_dims >= 4 && t_row_dims >= 4,
"Cannot decompose lower dimension matrix");
529 position[
X] = (*this)[3][0];
530 position[
Y] = (*this)[3][1];
531 position[
Z] = (*this)[3][2];
534 for (
uint01 i = 0; i < 3; i++)
541 if (
dot(temp_z, rows[2]) < 0)
543 scaling[
X] = -scaling[
X];
546 for (
uint04 i = 0; i < 3; i++)
550 t_type sy =
sqrt(rows[0][0] * rows[0][0] + rows[0][1] * rows[0][1]);
567 mat[t_row_dims - 1][0] = translation[
X];
568 if constexpr (t_col_dims >= 2)
569 mat[t_row_dims - 1][1] = translation[
Y];
570 if constexpr (t_col_dims >= 3)
571 mat[t_row_dims - 1][2] = 0;
572 return (*
this) * mat;
601 for (
uint01 i = 0; i <
getMin(t_row_dims, t_col_dims); i++)
603 if (
abs((*
this)[i][i]) < epsilon)
604 (*this)[i][i] = new_value;
611 mat[0][0] += (
scale - 1) * direction[
X] * direction[
X];
612 mat[0][1] += (
scale - 1) * direction[
Y] * direction[
X];
613 mat[0][2] += (
scale - 1) * direction[
Z] * direction[
X];
615 mat[1][0] += (
scale - 1) * direction[
X] * direction[
Y];
616 mat[1][1] += (
scale - 1) * direction[
Y] * direction[
Y];
617 mat[1][2] += (
scale - 1) * direction[
Z] * direction[
Y];
619 mat[2][0] += (
scale - 1) * direction[
X] * direction[
Z];
620 mat[2][1] += (
scale - 1) * direction[
Y] * direction[
Z];
621 mat[2][2] += (
scale - 1) * direction[
Z] * direction[
Z];
623 return (*
this) * mat;
625 template<
class t_angle_type>
630 template<
class t_angle_type>
640 return (*
this) * mat;
645 for (
uint01 row = 0; row < t_row_dims; row++)
646 for (
uint01 col = 0; col < t_col_dims; col++)
647 mat[col][row] = (*
this)[row][col];
651 template<u
int01 t_cols = t_col_dims, u
int01 t_rows = t_row_dims>
657 [[nodiscard]]
inline t_type*
begin()
659 return &(*this)[0][0];
662 [[nodiscard]]
inline const t_type*
begin()
const
664 return &(*this)[0][0];
671 for(
uint01 col = 0; col < t_col_dims; ++col)
673 for(
uint01 row = 0; row < t_row_dims; ++row)
675 for(
uint01 i = 0; i < t_row_dims; ++i)
677 product[row][col] += ((*this)[i][col] * right[row][i]);
685 for(
uint01 col = 0; col < t_col_dims; ++col)
687 for(
uint01 row = 0; row < t_row_dims; ++row)
689 (*this)[row][col] = right[row][col];
696 *
this = *
this * right;
710 template<
class t_type, u
int01 t_row_dims, u
int01 t_col_dims>
711 struct Constant<Matrix<t_type, t_row_dims, t_col_dims>>
713 constexpr const static Matrix<t_type, t_row_dims, t_col_dims>
Invalid = Matrix<t_type, t_row_dims, t_col_dims>(Constant<Vector<t_row_dims, Vector<t_col_dims, t_type>>>
::Invalid);
714 constexpr const static Matrix<t_type, t_row_dims, t_col_dims>
Min = Matrix<t_type, t_row_dims, t_col_dims>(Constant<Vector<t_row_dims, Vector<t_col_dims, t_type>>>
::Min);
715 constexpr const static Matrix<t_type, t_row_dims, t_col_dims>
Max = Matrix<t_type, t_row_dims, t_col_dims>(Constant<Vector<t_row_dims, Vector<t_col_dims, t_type>>>
::Max);
735 template<
class t_type, u
int01 t_row_dims, u
int01 t_col_dims>
736 static constexpr bool IsInvalid(
const Matrix<t_type, t_row_dims, t_col_dims>& value)
738 for (
uint01 dim_a = 0; dim_a < t_col_dims; ++dim_a)
740 for (
uint01 dim_b = 0; dim_b < t_row_dims; ++dim_b)
#define lib_assert(expression, message)
Definition LibAssert.h:61
The primary angle storage class for this API. Stores an angle in an optimized format.
Definition StringStream.h:540
static Angle atan2(t_value_type x, t_value_type y)
measures the counterclockwise angle between the positive x-axis and the point (x, y)
Definition Angle.h:328
Definition Matrix.hpp:176
Matrix operator*(const Matrix &right) const
Definition Matrix.hpp:668
constexpr Vector< 4, t_type > decomposeRotationQuaternion() const
Definition Matrix.hpp:491
constexpr Matrix(const t_type n00, const t_type n10, const t_type n20, const t_type n01, const t_type n11, const t_type n21, const t_type n02, const t_type n12, const t_type n22)
Definition Matrix.hpp:199
static constexpr Matrix< t_type > RotationMatrix(const Angle< t_angle_type > &phi, const Vector< 3, t_type > &axis)
Definition Matrix.hpp:376
constexpr Matrix< t_type, t_i1 - t_i0+1, t_j1 - t_j0+1 > subMatrix() const
Definition Matrix.hpp:261
const t_type * begin() const
Definition Matrix.hpp:662
constexpr Matrix shear(t_type dx, t_type dy) const
Definition Matrix.hpp:635
constexpr Matrix(const Vector< t_row_dims *t_col_dims, t_type > &vector)
Definition Matrix.hpp:238
constexpr Matrix offset(const Vector< 2, t_type > &translation) const
Definition Matrix.hpp:564
constexpr void decompose(Vector< 3, t_type > &scaling, Vector< 3, Angle< t_angle_type > > &rotation, Vector< 3, t_type > &position) const
Definition Matrix.hpp:525
constexpr Matrix scale(t_type scale) const
Definition Matrix.hpp:582
constexpr Matrix< t_type > rotate(const Angle< t_angle_type > &phi, const Vector< 3, t_type > &axis) const
Definition Matrix.hpp:631
constexpr Matrix(const t_type n00, const t_type n10, const t_type n20, const t_type n30, const t_type n01, const t_type n11, const t_type n21, const t_type n31, const t_type n02, const t_type n12, const t_type n22, const t_type n32, const t_type n03, const t_type n13, const t_type n23, const t_type n33)
Definition Matrix.hpp:210
constexpr Matrix()
Definition Matrix.hpp:178
constexpr Matrix(const t_type diagonal)
Definition Matrix.hpp:181
constexpr Matrix scale(const Vector< 3, t_type > &direction, t_type scale) const
Definition Matrix.hpp:608
static constexpr Matrix< t_type > OffsetMatrix(const Vector< 3, t_type > &translation)
Definition Matrix.hpp:297
Matrix & operator=(const Matrix &right)
Definition Matrix.hpp:683
constexpr Matrix< t_type, t_col_dims, t_row_dims > transpose() const
Definition Matrix.hpp:642
Matrix< t_type, t_cols, t_rows > invert() const
Definition Matrix.hpp:652
constexpr t_type determinant() const
Definition Matrix.hpp:389
constexpr Matrix< t_new_type > as() const
Definition Matrix.hpp:248
constexpr Vector< 3, t_type > decomposeOffset() const
Definition Matrix.hpp:443
static constexpr Matrix< t_type > ScalerMatrix(const Vector< 2, t_type > &scale)
Definition Matrix.hpp:317
constexpr Matrix(const Vector< t_row_dims - 1, t_type > &offset, const Vector< 3, Angle< t_angle_type > > &orientation, const Vector< t_row_dims - 1, t_type > &scale)
Definition Matrix.hpp:224
static constexpr Matrix< t_type > RotationMatrix(const Vector< 3, Angle< t_angle_type > > &orientation)
Definition Matrix.hpp:336
constexpr Matrix rotate(const Vector< 3, Angle< t_angle_type > > &orientation) const
Definition Matrix.hpp:626
static constexpr Matrix< t_type > ScalerMatrix(t_type scale)
Definition Matrix.hpp:307
t_type * begin()
Definition Matrix.hpp:657
constexpr Matrix scale(const Vector< 3, t_type > &scale) const
Definition Matrix.hpp:594
constexpr Matrix offset(const Vector< 3, t_type > &translation) const
Definition Matrix.hpp:577
constexpr Matrix< t_type, t_i_size, t_j1 - t_j0+1 > subMatrix(const Vector< t_i_size, uint01 > &r) const
Definition Matrix.hpp:272
constexpr Matrix(const Matrix &mat)=default
static constexpr Matrix< t_type > ScalerMatrix(const Vector< 3, t_type > &scale)
Definition Matrix.hpp:325
constexpr Matrix(const Vector< t_row_dims, Vector< t_col_dims, t_type > > &vector)
Definition Matrix.hpp:242
constexpr Matrix< t_new_type, t_new_row_dims, t_new_col_dims > as() const
Definition Matrix.hpp:285
Matrix & operator*=(const Matrix &right)
Definition Matrix.hpp:694
constexpr Vector< 3, Angle< t_angle_type > > decomposeRotation() const
Definition Matrix.hpp:457
void correctZeroScale(t_type new_value=1e-6, t_type epsilon=1e-9)
Definition Matrix.hpp:599
constexpr Matrix scale(const Vector< 2, t_type > &scale) const
Definition Matrix.hpp:588
constexpr Vector< 3, t_type > decomposeScale() const
Definition Matrix.hpp:424
constexpr Matrix(const t_type n00, const t_type n10, const t_type n01, const t_type n11)
Definition Matrix.hpp:190
Templated logic for inverting a matrix based on the number of rows and columns.
Definition Matrix.hpp:42
A fixed-size array with better performance compared to dynamic containers.
Definition Vector.hpp:60
constexpr t_magnitude_type magnitude() const
Definition Vector.hpp:448
constexpr t_type product() const
Definition Vector.hpp:488
constexpr Vector< t_dims, t_norm_type > normalized(Vector< t_dims, t_norm_type > value_if_nan=Constant< Vector< t_dims, t_norm_type > >::Invalid) const
Definition Vector.hpp:464
constexpr bool IsInvalid(const t_type &value)
Query if 'value' is valid or invalid. Invalid values should return invalid if used for calculations o...
Definition BaseFunctions.hpp:170
t_type dot(const Vector< t_dims, t_type > &v1, const Vector< t_dims, t_type > &v2)
Definition VectorFunctions.hpp:1030
@ ROLL
Definition Angle.h:45
@ YAW
Definition Angle.h:47
@ PITCH
Definition Angle.h:46
constexpr Vector< t_dims, Angle< t_angle_type > > quantize(const Vector< t_dims, Angle< t_angle_type > > &value, Angle< t_angle_type > d=Angle< t_angle_type >(DEGREES, 1.0))
Definition AngleFunctions.h:828
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:80
@ RADIANS
Definition Angle.h:57
std::enable_if<!ObjectInfo< t_type >::Float, fltp08 >::type cos(const Angle< t_type > &angle)
Performs optimized cosine operation on the given angle using pre-computed lookup table for optimal sp...
Definition AngleFunctions.h:124
constexpr Vector< 1, t_type > cross(const Vector< 1, t_type > &, const Vector< 1, t_type > &)
Definition VectorFunctions.hpp:898
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
Definition BaseValues.hpp:96
t_type sqrt(const t_type &value)
Definition VectorFunctions.hpp:1225
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:375
constexpr Angle< t_angle_type > abs(const Angle< t_angle_type > &value)
Changes an input with a negative sign, to a positive sign.
Definition AngleFunctions.h:645
std::enable_if<!ObjectInfo< t_type >::Float, fltp08 >::type sin(const Angle< t_type > &angle)
Performs optimized sine operation on the given angle using pre-computed lookup table for optimal spee...
Definition AngleFunctions.h:79
@ Y
Definition BaseValues.hpp:169
@ X
Definition BaseValues.hpp:167
@ Z
Definition BaseValues.hpp:171
constexpr t_type getMin(const t_type &left, const t_type &right)
Finds the minimum of the given arguments based on the < operator Author: Tyler Parke Date: 2017-11-05...
Definition BaseFunctions.hpp:56
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Definition BaseValues.hpp:233
static const t_type Invalid
Definition BaseValues.hpp:234
static const t_type Min
Definition BaseValues.hpp:235
static const t_type Max
Definition BaseValues.hpp:236