26 0.0f, 0.0f, 0.0f, 0.0f,
27 0.0f, 0.0f, 0.0f, 0.0f,
28 0.0f, 0.0f, 0.0f, 0.0f,
29 0.0f, 0.0f, 0.0f, 0.0f
59 float r0c0,
float r0c1,
float r0c2,
float r0c3,
60 float r1c0,
float r1c1,
float r1c2,
float r1c3,
61 float r2c0,
float r2c1,
float r2c2,
float r2c3,
62 float r3c0,
float r3c1,
float r3c2,
float r3c3
65 r0c0, r0c1, r0c2, r0c3,
66 r1c0, r1c1, r1c2, r1c3,
67 r2c0, r2c1, r2c2, r2c3,
68 r3c0, r3c1, r3c2, r3c3
109 float r0c0,
float r0c1,
float r0c2,
float r0c3,
110 float r1c0,
float r1c1,
float r1c2,
float r1c3,
111 float r2c0,
float r2c1,
float r2c2,
float r2c3,
112 float r3c0,
float r3c1,
float r3c2,
float r3c3
266 array<float, 16> _data;
369 data[0] = c + uX2 * c1;
370 data[1] = uX * uY * c1 + uZ * scalar;
371 data[2] = uX * uZ * c1 - uY * scalar;
373 data[4] = uY * uX * c1 - uZ * scalar;
374 data[5] = c + uY2 * c1;
375 data[6] = uY * uZ * c1 + uX * scalar;
377 data[8] = uZ * uX * c1 + uY * scalar;
378 data[9] = uZ * uY * c1 - uX * scalar;
379 data[10] = c + uZ2 * c1;
454 array <float, 16> _data;
465 _data[10] =
data[10];
466 _data[11] =
data[14];
469 _data[14] =
data[11];
470 _data[15] =
data[15];
498 array <float, 16> _data;
515 auto determinant =
data[0] * _data[0] +
data[1] * _data[4] +
data[2] * _data[8] +
data[3] * _data[12];
516 if (determinant == 0.0f) {
520 determinant = 1.0f / determinant;
521 for (
auto i = 0; i < _data.size(); i++)
522 _data[i] = _data[i] * determinant;
549 auto axisALength =
Math::sqrt((_data[0] * _data[0]) + (_data[1] * _data[1]) + (_data[2] * _data[2]));
550 _data[0]*= axisALength;
551 _data[1]*= axisALength;
552 _data[2]*= axisALength;
553 auto axisBLength =
Math::sqrt((_data[4] * _data[4]) + (_data[5] * _data[5]) + (_data[6] * _data[6]));
554 _data[4]*= axisBLength;
555 _data[5]*= axisBLength;
556 _data[6]*= axisBLength;
557 auto axisCLength =
Math::sqrt((_data[8] * _data[8]) + (_data[9] * _data[9]) + (_data[10] * _data[10]));
558 _data[8]*= axisCLength;
559 _data[9]*= axisCLength;
560 _data[10]*= axisCLength;
566 auto cy =
static_cast<float>(
Math::sqrt(_data[axis0 + 4 * axis0] * _data[axis0 + 4 * axis0] + _data[axis1 + 4 * axis0] * _data[axis1 + 4 * axis0]));
568 euler[0] =
static_cast<float>((
Math::atan2(_data[axis2 + 4 * axis1], _data[axis2 + 4 * axis2])));
569 euler[1] =
static_cast<float>((
Math::atan2(-_data[axis2 + 4 * axis0], cy)));
570 euler[2] =
static_cast<float>((
Math::atan2(_data[axis1 + 4 * axis0], _data[axis0 + 4 * axis0])));
572 euler[0] =
static_cast<float>((
Math::atan2(-_data[axis1 + 4 * axis2], _data[axis1 + 4 * axis1])));
573 euler[1] =
static_cast<float>((
Math::atan2(-_data[axis2 + 4 * axis0], cy)));
589 (b.
data[0] * t) + ((1.0f - t) * a.
data[0]),
590 (b.
data[1] * t) + ((1.0f - t) * a.
data[1]),
591 (b.
data[2] * t) + ((1.0f - t) * a.
data[2]),
592 (b.
data[3] * t) + ((1.0f - t) * a.
data[3]),
593 (b.
data[4] * t) + ((1.0f - t) * a.
data[4]),
594 (b.
data[5] * t) + ((1.0f - t) * a.
data[5]),
595 (b.
data[6] * t) + ((1.0f - t) * a.
data[6]),
596 (b.
data[7] * t) + ((1.0f - t) * a.
data[7]),
597 (b.
data[8] * t) + ((1.0f - t) * a.
data[8]),
598 (b.
data[9] * t) + ((1.0f - t) * a.
data[9]),
599 (b.
data[10] * t) + ((1.0f - t) * a.
data[10]),
600 (b.
data[11] * t) + ((1.0f - t) * a.
data[11]),
601 (b.
data[12] * t) + ((1.0f - t) * a.
data[12]),
602 (b.
data[13] * t) + ((1.0f - t) * a.
data[13]),
603 (b.
data[14] * t) + ((1.0f - t) * a.
data[14]),
604 (b.
data[15] * t) + ((1.0f - t) * a.
data[15])
695 return this->
equals(matrix);
704 return this->
equals(matrix) ==
false;
static float sqrt(float value)
Returns the square root of given value.
static float sin(float x)
Returns the sine of x.
static auto square(auto value)
Do the square product.
static float cos(float x)
Returns the cosine of x.
static constexpr float EPSILON
static auto abs(auto value)
Returns absolute value.
static float atan2(float y, float x)
Returns the angle from the conversion of rectangular coordinates to polar coordinates.
static constexpr float PI
static constexpr float DEG2RAD
Matrix4x4 class representing matrix4x4 mathematical structure and operations for 3d space.
Matrix4x4(const Matrix4x4 &matrix)
Public constructor.
Matrix4x4 & multiply(const Matrix4x4 &matrix)
Multiplies this matrix with given matrix.
Matrix4x4 clone() const
Clones this matrix.
Matrix4x4 & identity()
Creates identity matrix.
Matrix4x4 & scale(float scalar)
Scales by scalar.
const float & operator[](int i) const
Const array access operator.
Matrix4x4 & operator*=(const Matrix4x4 matrix)
bool equals(const Matrix4x4 &matrix) const
Compares this matrix with given matrix.
Vector3 multiply(const Vector3 &vector3) const
Multiplies this matrix with vector3.
void getAxes(Vector3 &xAxis, Vector3 &yAxis, Vector3 &zAxis) const
Get coordinate system axes.
float & operator[](int i)
Array access operator.
Matrix4x4 & set(float r0c0, float r0c1, float r0c2, float r0c3, float r1c0, float r1c1, float r1c2, float r1c3, float r2c0, float r2c1, float r2c2, float r2c3, float r3c0, float r3c1, float r3c2, float r3c3)
Sets this matrix by its components.
Vector4 multiply(const Vector4 &vector4) const
Multiplies this matrix with vector4.
Matrix4x4 operator*(const float scalar) const
Operator * scalar.
Vector3 computeEulerAngles() const
Compute Euler angles (rotation around x, y, z axes)
Matrix4x4()
Public constructor.
bool operator!=(const Matrix4x4 &matrix) const
Non equality comparison operator.
bool operator==(const Matrix4x4 &matrix) const
Equality comparison operator.
Matrix4x4(float r0c0, float r0c1, float r0c2, float r0c3, float r1c0, float r1c1, float r1c2, float r1c3, float r2c0, float r2c1, float r2c2, float r2c3, float r3c0, float r3c1, float r3c2, float r3c3)
Public constructor.
Matrix4x4 & setAxes(const Vector3 &axis, float angle)
Set coordinate system axes by rotation around axis by angle.
Matrix4x4 & invert()
Inverts this matrix.
Matrix4x4 & scale(const Vector3 &vector3)
Scales by vector3.
Matrix4x4 & transpose()
Transposes this matrix.
const array< float, 16 > & getArray() const
Matrix4x4 & set(const Matrix4x4 &matrix)
Sets this matrix by given matrix.
Matrix4x4 & set(const array< float, 16 > &matrix)
Sets this matrix by array.
Vector3 multiplyNoTranslation(const Vector3 &vector3) const
Multiplies this matrix with vector3 while ignoring translation.
void getScale(Vector3 &scale) const
Get scale.
void getTranslation(Vector3 &translation) const
Get translation.
Matrix4x4 & setAxes(const Vector3 &xAxis, const Vector3 &yAxis, const Vector3 &zAxis)
Set coordinate system axes.
Matrix4x4 & setTranslation(const Vector3 &translation)
Set translation.
Matrix4x4 & setScale(const Vector3 &scale)
Set scale.
static Matrix4x4 interpolateLinear(const Matrix4x4 &a, const Matrix4x4 &b, float t)
Interpolates between a and b by 0f<=t<=1f linearly.
Matrix4x4(const array< float, 16 > &matrix)
Public constructor.
Vector3 class representing vector3 mathematical structure and operations with x, y,...
float computeLength() const
Vector3 & scale(float scalar)
Scales by scalar.
Vector3 & set(float x, float y, float z)
Sets this vector3 by its components.
Vector3 & normalize()
Normalizes this vector3.
Vector4 class representing vector4 mathematical structure and operations with x, y,...