Added conversions to and from wxyz quaternion representations
This commit is contained in:
parent
bbffdc5cd7
commit
3b55888fa1
|
@ -443,4 +443,16 @@ namespace SHADE
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SHQuaternion SHQuaternion::FromWXYZ(float w, float x, float y, float z) noexcept
|
||||||
|
{
|
||||||
|
return SHQuaternion{ x, y, z, w };
|
||||||
|
}
|
||||||
|
|
||||||
|
void SHQuaternion::ToWXYZ(const SHQuaternion& from, float& w, float& x, float& y, float& z) noexcept
|
||||||
|
{
|
||||||
|
x = from.x;
|
||||||
|
y = from.y;
|
||||||
|
z = from.z;
|
||||||
|
w = from.w;
|
||||||
|
}
|
||||||
} // namespace SHADE
|
} // namespace SHADE
|
|
@ -128,6 +128,9 @@ namespace SHADE
|
||||||
[[nodiscard]] static SHQuaternion FromToRotation (const SHVec3& from, const SHVec3& to) noexcept;
|
[[nodiscard]] static SHQuaternion FromToRotation (const SHVec3& from, const SHVec3& to) noexcept;
|
||||||
[[nodiscard]] static SHQuaternion LookRotation (const SHVec3& forward, const SHVec3& up) noexcept;
|
[[nodiscard]] static SHQuaternion LookRotation (const SHVec3& forward, const SHVec3& up) noexcept;
|
||||||
[[nodiscard]] static SHQuaternion RotateTowards (const SHQuaternion& from, const SHQuaternion& to, float maxAngleInRad) noexcept;
|
[[nodiscard]] static SHQuaternion RotateTowards (const SHQuaternion& from, const SHQuaternion& to, float maxAngleInRad) noexcept;
|
||||||
|
|
||||||
|
[[nodiscard]] static SHQuaternion FromWXYZ (float w, float x, float y, float z) noexcept;
|
||||||
|
static void ToWXYZ (const SHQuaternion& from, float& w, float& x, float& y, float& z) noexcept;
|
||||||
};
|
};
|
||||||
|
|
||||||
SHQuaternion operator*(float lhs, const SHQuaternion& rhs) noexcept;
|
SHQuaternion operator*(float lhs, const SHQuaternion& rhs) noexcept;
|
||||||
|
|
Loading…
Reference in New Issue