24 static_assert (
sizeof (
Matrix3x3 ) ==
sizeof ( float ) * 9,
"Size of Matrix3x3 is not the same as float[9]." );
33 memcpy (
mMatrix, aMatrix3x3,
sizeof (
float ) * 9 );
38 const float* scalar = aList.begin();
39 for (
size_t i = 0; i < 9; ++i )
41 mMatrix[i] = ( scalar != aList.end() ) ? *scalar++ : ( i % 4 ) ? 0.0f : 1.0f;
97 assert ( aIndex < 9 );
103 auto radians = float ( ( angle / 180.0f ) *
static_cast<float> ( M_PI ) );
104 float c = cosf ( radians );
105 float s = sinf ( radians );
108 x * x * ( 1 - c ) + c,
109 x * y * ( 1 - c ) - z * s,
110 x * z * ( 1 - c ) + y * s,
111 y * x * ( 1 - c ) + z * s,
112 y * y * ( 1 - c ) + c,
113 y * z * ( 1 - c ) - x * s,
114 x * z * ( 1 - c ) - y * s,
115 y * z * ( 1 - c ) + x * s,
116 z * z * ( 1 - c ) + c,
132 rhs[0] * lhs[0] + rhs[1] * lhs[3] + rhs[2] * lhs[6],
133 rhs[0] * lhs[1] + rhs[1] * lhs[4] + rhs[2] * lhs[7],
134 rhs[0] * lhs[2] + rhs[1] * lhs[5] + rhs[2] * lhs[8]
147 std::abs ( aMatrix3x3[0] ),
148 std::abs ( aMatrix3x3[1] ),
149 std::abs ( aMatrix3x3[2] ),
150 std::abs ( aMatrix3x3[3] ),
151 std::abs ( aMatrix3x3[4] ),
152 std::abs ( aMatrix3x3[5] ),
153 std::abs ( aMatrix3x3[6] ),
154 std::abs ( aMatrix3x3[7] ),
155 std::abs ( aMatrix3x3[8] )
Inline functions related to 3D Math.
float * Invert3x3Matrix(const float *src, float *dst)
Inverts a 3x3 Matrix.
Header for 3x3 matrix class.
Header for the 3D vector class.
3 by 3 matrix in colum mayor order.
DLL const Matrix3x3 GetInvertedMatrix3x3()
Get the inverted matrix.
DLL Matrix3x3 & operator*=(const Matrix3x3 &lhs)
Multiply this matrix by another matrix.
DLL Matrix3x3()
Default constructor.
DLL const float *const GetMatrix3x3() const
Get a pointer to the internal matrix data.
static DLL const Matrix3x3 GetRotationMatrix(float angle, float x, float y, float z)
Constructs the rotation matrix defined by the axis-angle provided.
DLL const float operator[](size_t aIndex) const
Access a matrix element by index.
float mMatrix[9]
Lineal row mayor matrix.
DLL Matrix3x3 & Invert()
Invert this matrix in place.
DLL Matrix3x3 & Rotate(float angle, float x, float y, float z)
Apply a rotation to this matrix.
<- This is here just for the literals
DLL const Matrix3x3 operator*(const Matrix3x3 &lhs, const Matrix3x3 &rhs)
Multiplies two 3x3 matrices. Multiplies two 3x3 matrices.
DLL const Matrix3x3 Abs(const Matrix3x3 &aMatrix3x3)
Compute the element-wise absolute value of a matrix.
DLL const bool operator==(const Matrix3x3 &lhs, const Matrix3x3 &rhs)
Compare two 3x3 matrices for equality.