Large Restructure and Organization

This commit is contained in:
2024-02-27 00:42:24 -05:00
parent 8049fd3a60
commit 718f63a3c8
26 changed files with 507 additions and 76 deletions

View File

@@ -1,13 +1,22 @@
#pragma once
#include <J3ML/LinearAlgebra.h>
#include <J3ML/LinearAlgebra/Matrix3x3.h>
#include <J3ML/LinearAlgebra/Matrix4x4.h>
#include <J3ML/LinearAlgebra/Vector4.h>
#include <J3ML/LinearAlgebra/AxisAngle.h>
#include <J3ML/LinearAlgebra/Matrix3x3.h>
//#include <J3ML/LinearAlgebra/AxisAngle.h>
#include <cmath>
namespace J3ML::LinearAlgebra
{
class Matrix3x3;
class Quaternion : public Vector4 {
public:
Quaternion();
@@ -23,13 +32,9 @@ namespace J3ML::LinearAlgebra
// Constructs this quaternion by specifying a rotation axis and the amount of rotation to be performed about that axis
// @param rotationAxis The normalized rotation axis to rotate about. If using Vector4 version of the constructor, the w component of this vector must be 0.
Quaternion(const Vector3 &rotationAxis, float rotationAngleBetween) {
SetFromAxisAngle(rotationAxis, rotationAngleBetween);
}
Quaternion(const Vector3 &rotationAxis, float rotationAngleBetween);
Quaternion(const Vector4 &rotationAxis, float rotationAngleBetween) {
SetFromAxisAngle(rotationAxis, rotationAngleBetween);
}
Quaternion(const Vector4 &rotationAxis, float rotationAngleBetween);
//void Inverse();
explicit Quaternion(Vector4 vector4);
@@ -49,15 +54,9 @@ namespace J3ML::LinearAlgebra
Vector3 GetWorldZ() const;
Vector3 GetAxis() const {
float rcpSinAngle = 1 - (std::sqrt(1 - w * w));
Vector3 GetAxis() const;
return Vector3(x, y, z) * rcpSinAngle;
}
float GetAngle() const {
return std::acos(w) * 2.f;
}
float GetAngle() const;
Matrix3x3 ToMatrix3x3() const;
@@ -102,7 +101,7 @@ namespace J3ML::LinearAlgebra
Quaternion operator - () const;
float Dot(const Quaternion &quaternion) const;
float Angle() const { return std::acos(w) * 2.f;}
float Angle() const { return acos(w) * 2.f;}
float AngleBetween(const Quaternion& target) const;