Implement Matrix3x3::ToEulerAngle and Matrix3x3::ctor(EulerAngle)

This commit is contained in:
2024-07-01 14:22:10 -04:00
parent cc564b14fe
commit 552715f443
2 changed files with 38 additions and 0 deletions

View File

@@ -5,6 +5,7 @@
#include <J3ML/LinearAlgebra/Vector2.h>
#include <J3ML/LinearAlgebra/Vector3.h>
#include <J3ML/LinearAlgebra/Quaternion.h>
#include <J3ML/LinearAlgebra/EulerAngle.h>
#include <J3ML/Algorithm/RNG.h>
using namespace J3ML::Algorithm;
@@ -61,6 +62,9 @@ namespace J3ML::LinearAlgebra {
Matrix3x3(const Vector3& col0, const Vector3& col1, const Vector3& col2);
/// Constructs this matrix3x3 from the given quaternion.
explicit Matrix3x3(const Quaternion& orientation);
/// Constructs this matrix3x3 from the given euler angle.
explicit Matrix3x3(const EulerAngle& orientation);
/// Constructs this Matrix3x3 from a pointer to an array of floats.
explicit Matrix3x3(const float *data);
/// Creates a new Matrix3x3 that rotates about one of the principal axes by the given angle.
@@ -243,6 +247,8 @@ namespace J3ML::LinearAlgebra {
/// matrix, and there is scaling ,shearing, or mirroring in this matrix)
bool TryConvertToQuat(Quaternion& q) const;
/// Converts this rotation matrix to an Euler Angle.
[[nodiscard]] EulerAngle ToEulerAngle() const;
/// Returns the main diagonal.
/// The main diagonal consists of the elements at m[0][0], m[1][1], m[2][2]