9 template<
typename T =
float>
18 for (
UInt_8 i = 0; i < 9; ++i)
25 for (
UInt_8 i = 0; i < 4; ++i)
26 data[i / 2 * 4 + i % 2] = mat.data[i];
32 for (
UInt_8 i = 0; i < 9; ++i)
33 data[i] = mat.data[i];
42 for (
UInt_8 i = 0; i < 9; ++i)
43 data[i] = mat.data[i];
52 for (
UInt_8 i = 0; i < 4; ++i)
53 result[i] = data[i / 2 * 4 + i % 2];
58 operator const T*()
const
71 result.
x = vec.
x * data[0] + vec.
y * data[3] + vec.
z * data[6];
72 result.
y = vec.
x * data[1] + vec.
y * data[4] + vec.
z * data[7];
73 result.
z = vec.
x * data[2] + vec.
y * data[5] + vec.
z * data[8];
80 for (
UInt_8 i = 0; i < 9; ++i)
89 for (
UInt_8 i = 0; i < 9; ++i)
90 result.data[i] = data[i] * scalar;
98 for (
UInt_8 i = 0; i < 9; ++i)
103 data[i] += old.data[0 * 3 + column] * mat.data[row * 3 + 0];
104 data[i] += old.data[1 * 3 + column] * mat.data[row * 3 + 1];
105 data[i] += old.data[2 * 3 + column] * mat.data[row * 3 + 2];
114 for (
UInt_8 i = 0; i < 9; ++i)
118 result.data[i] += data[0 * 3 + column] * mat.data[row * 3 + 0];
119 result.data[i] += data[1 * 3 + column] * mat.data[row * 3 + 1];
120 result.data[i] += data[2 * 3 + column] * mat.data[row * 3 + 2];
129 for (
UInt_8 i = 0; i < 9; ++i)
130 result.data[i] = data[3 * (i % 3) + i / 3];
138 for (
UInt_8 i = 0; i < 9; ++i)
139 data[i] = old.data[3 * (i % 3) + i / 3];
146 for (
UInt_8 r = 0; r < 3; ++r)
147 for (
UInt_8 c = 0; c < 3; ++c)
148 result[3 * r + c] =
Cut(r, c).GetDeterminant();
157 for (
UInt_8 r = 0; r < 3; ++r)
158 for (
UInt_8 c = 0; c < 3; ++c)
159 data[3 * r + c] = old.
Cut(r, c).GetDeterminant();
167 for (
UInt_8 r = 0; r < 3; ++r)
169 for (
UInt_8 c = 0; c < 3; ++c)
171 if (r == row || c == column)
174 result[index++] = data[3 * r + c];
186 for (
UInt_8 c = 0; c < 3; ++c)
187 result += data[c] * cofactor[c];
197 for (
UInt_8 r = 0; r < 3; ++r)
199 for (
UInt_8 c = 0; c < 3; ++c)
202 result.data[i] = minor.data[i] * Math::Pow<T>(-1, r + c);
213 for (
UInt_8 r = 0; r < 3; ++r)
215 for (
UInt_8 c = 0; c < 3; ++c)
218 data[i] = minor.data[i] * Math::Pow<T>(-1, r + c);
265 result.data[0] = scale.
x;
266 result.data[4] = scale.
y;
267 result.data[8] = scale.
z;
void Cofactor()
Definition: Mat3.h:209
void Minor()
Definition: Mat3.h:153
Mat3< T > GetAdjugate() const
Definition: Mat3.h:223
static Mat3< T > PitchRotate(const T angle)
Definition: Mat3.h:272
T GetDeterminant() const
Definition: Mat3.h:181
static Mat3< T > Rotate(const Vec3< T > &vec)
Definition: Mat3.h:314
static Mat3< T > Identity()
Definition: Mat3.h:253
void Inverse()
Definition: Mat3.h:243
Vec3< T > operator*(Vec3< T > vec) const
Definition: Mat3.h:68
Mat3< T > operator*(const Mat3< T > &mat) const
Definition: Mat3.h:111
Mat3()
Definition: Mat3.h:16
Mat3< T > & operator*=(const T scalar)
Definition: Mat3.h:78
void Adjugate()
Definition: Mat3.h:228
static Mat3< T > Scale(const Vec3< T > &scale)
Definition: Mat3.h:262
Mat3< T > GetTranspose() const
Definition: Mat3.h:126
Mat3< T > operator*(const T scalar) const
Definition: Mat3.h:86
Mat3< T > & operator=(const Mat3< C > &mat)
Definition: Mat3.h:37
static Mat3< T > YawRotate(const T angle)
Definition: Mat3.h:286
Mat2< T > Cut(const UInt_8 row, const UInt_8 column) const
Definition: Mat3.h:162
static Mat3< T > RollRotate(const T angle)
Definition: Mat3.h:300
Mat3< T > & operator*=(const Mat3< T > &mat)
Definition: Mat3.h:95
Mat3< T > GetCofactor() const
Definition: Mat3.h:192
Mat3(const Mat3< C > &mat)
Definition: Mat3.h:30
Mat3< T > GetMinor() const
Definition: Mat3.h:142
Mat3< T > GetInverse() const
Definition: Mat3.h:234
Mat3(const Mat2< C > &mat)
Definition: Mat3.h:23
void Transpose()
Definition: Mat3.h:135
static T Rads(const T from)
Definition: Math.h:89
static R Sin(const R angle, const R precision=0.001)
Definition: Math.h:257
static R Cos(const R angle, const R precision=0.001)
Definition: Math.h:298
static bool ComCmp(float a, float b)
Combined absolute and relative tolerance comparison for single precision floats.
Definition: Math.cpp:26
unsigned char UInt_8
Definition: Types.h:43
Mat3< double > Mat3_d
Definition: Mat3.h:324
Mat3< float > Mat3_f
Definition: Mat3.h:323