Implement Transform2D.h

This commit is contained in:
2024-01-23 04:14:24 -05:00
parent fd2289cee3
commit f7a7ec38d7
5 changed files with 132 additions and 12 deletions

View File

@@ -37,6 +37,20 @@ namespace LinearAlgebra
Vector3 GetWorldY() const;
Vector3 GetWorldZ() const;
Vector3 GetAxis() const
{
float rcpSinAngle = 1 - (std::sqrt(1 - w * w));
return Vector3(x, y, z) * rcpSinAngle;
}
float GetAngle() const
{
return std::acos(w) * 2.f;
}
Matrix3x3 ToMatrix3x3() const;
Vector3 Transform(const Vector3& vec) const;
@@ -57,7 +71,6 @@ namespace LinearAlgebra
// TODO: Document (But do not override!) certain math functions that are the same for Vec4
// TODO: Double Check which operations need to be overriden for correct behavior!
// Multiplies two quaternions together.
// The product q1 * q2 returns a quaternion that concatenates the two orientation rotations.
// The rotation q2 is applied first before q1.
@@ -71,9 +84,9 @@ namespace LinearAlgebra
// Divides a quaternion by another. Divison "a / b" results in a quaternion that rotates the orientation b to coincide with orientation of
Quaternion operator / (const Quaternion& rhs) const;
Quaternion operator +(const Quaternion& rhs) const;
Quaternion operator +() const;
Quaternion operator -() const;
Quaternion operator + (const Quaternion& rhs) const;
Quaternion operator + () const;
Quaternion operator - () const;
float Dot(const Quaternion &quaternion) const;
float Angle() const;