Files
XCEngine/engine/include/XCEngine/Core/Math/Quaternion.h
ssdfasd d575532966 docs: update TEST_SPEC.md and README.md to reflect new directory structure
- TEST_SPEC.md: Updated test directory structure to reflect Core/Asset,
  Core/IO, and Resources/<Type> subdirectories
- TEST_SPEC.md: Updated module names and test counts (852 total)
- TEST_SPEC.md: Updated build commands for new Resources subdirectories
- README.md: Updated engine structure with Core/Asset/ and Core/IO/
- README.md: Updated Resources section with layered architecture
- README.md: Updated test coverage table with accurate counts
2026-03-24 16:14:05 +08:00

41 lines
1.2 KiB
C++

#pragma once
#include "Math.h"
#include "Vector3.h"
namespace XCEngine {
namespace Math {
struct Matrix4x4;
struct Quaternion {
float x = 0.0f;
float y = 0.0f;
float z = 0.0f;
float w = 1.0f;
Quaternion() = default;
constexpr Quaternion(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) {}
static Quaternion Identity() { return Quaternion(0, 0, 0, 1); }
static Quaternion FromAxisAngle(const Vector3& axis, float radians);
static Quaternion FromEulerAngles(float pitch, float yaw, float roll);
static Quaternion FromEulerAngles(const Vector3& euler);
static Quaternion FromRotationMatrix(const Matrix4x4& matrix);
static Quaternion Slerp(const Quaternion& a, const Quaternion& b, float t);
static Quaternion LookRotation(const Vector3& forward, const Vector3& up = Vector3::Up());
Vector3 ToEulerAngles() const;
Matrix4x4 ToMatrix4x4() const;
Quaternion operator*(const Quaternion& other) const;
Quaternion Inverse() const;
float Dot(const Quaternion& other) const;
float Magnitude() const;
Quaternion Normalized() const;
static Quaternion Normalize(const Quaternion& q);
};
} // namespace Math
} // namespace XCEngine